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.
- _nullius_app/.env.example +55 -0
- _nullius_app/app.py +96 -0
- _nullius_app/requirements.txt +1 -0
- _nullius_app/static/brand/README.md +20 -0
- _nullius_app/static/brand/docker.svg +1 -0
- _nullius_app/static/brand/favicon.svg +1 -0
- _nullius_app/static/brand/huggingface.svg +37 -0
- _nullius_app/static/brand/mark-dark.svg +1 -0
- _nullius_app/static/brand/marks.svg +34 -0
- _nullius_app/static/brand/tokens.json +51 -0
- _nullius_app/static/brand/typesafe.png +0 -0
- _nullius_app/static/brand/wordmark-dark.svg +1 -0
- _nullius_app/static/builder/command-builder-core.js +763 -0
- _nullius_app/static/builder/command-builder.css +248 -0
- _nullius_app/static/builder/command-builder.js +997 -0
- _nullius_app/static/builder/model-picker.js +113 -0
- _nullius_app/static/catalogue/add.js +46 -0
- _nullius_app/static/catalogue/agents/README.md +19 -0
- _nullius_app/static/catalogue/agents/goose.svg +1 -0
- _nullius_app/static/catalogue/agents/jiuwenswarm.svg +33 -0
- _nullius_app/static/catalogue/agents/marks.json +8 -0
- _nullius_app/static/catalogue/agents/mini-swe-agent.svg +7 -0
- _nullius_app/static/catalogue/agents/opencode.svg +7 -0
- _nullius_app/static/catalogue/catalogue.css +436 -0
- _nullius_app/static/catalogue/catalogue.js +87 -0
- _nullius_app/static/catalogue/marks.svg +29 -0
- _nullius_app/static/catalogue/new.js +78 -0
- _nullius_app/static/catalogue/versions.js +27 -0
- _nullius_app/static/compare/comparison.css +117 -0
- _nullius_app/static/controls.js +117 -0
- _nullius_app/static/disclosures.js +70 -0
- _nullius_app/static/fonts/0569c822cab6c510.ttf +0 -0
- _nullius_app/static/fonts/DMSans-Medium.woff2 +0 -0
- _nullius_app/static/fonts/DMSans-Regular.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Medium.woff2 +0 -0
- _nullius_app/static/fonts/IBMPlexMono-Regular.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Italic.woff2 +0 -0
- _nullius_app/static/fonts/InstrumentSerif-Regular.woff2 +0 -0
- _nullius_app/static/fonts/README.md +11 -0
- _nullius_app/static/fonts/c1e7453ea26a1d1e.ttf +0 -0
- _nullius_app/static/fonts/dmsans-OFL.txt +93 -0
- _nullius_app/static/fonts/ibmplexmono-OFL.txt +93 -0
- _nullius_app/static/fonts/instrumentserif-OFL.txt +93 -0
- _nullius_app/static/fonts.css +49 -0
- _nullius_app/static/notifications.js +49 -0
- _nullius_app/static/onboarding.css +78 -0
- _nullius_app/static/onboarding.js +158 -0
- _nullius_app/static/runs/board.css +358 -0
- _nullius_app/static/runs/board.js +127 -0
- _nullius_app/static/runs/launches.css +88 -0
- _nullius_app/static/runs/live-board.css +186 -0
- _nullius_app/static/runs/live-board.js +394 -0
- _nullius_app/static/runs/path-suggestions.js +119 -0
- _nullius_app/static/runs/start.css +38 -0
- _nullius_app/static/settings/autosave.js +162 -0
- _nullius_app/static/settings/custom-keys.js +100 -0
- _nullius_app/static/settings/data-providers.js +88 -0
- _nullius_app/static/settings/judges.js +61 -0
- _nullius_app/static/settings/modal.css +32 -0
- _nullius_app/static/settings/modal.js +91 -0
- _nullius_app/static/settings/navigation.js +55 -0
- _nullius_app/static/settings/prices.js +68 -0
- _nullius_app/static/settings/providers.js +134 -0
- _nullius_app/static/settings/sandbox.js +20 -0
- _nullius_app/static/settings/settings.css +288 -0
- _nullius_app/static/style.css +1752 -0
- _nullius_app/static/traces/conversation.css +49 -0
- _nullius_app/static/traces/conversation.js +215 -0
- _nullius_app/templates/agents/entry.html +145 -0
- _nullius_app/templates/agents/kits.html +55 -0
- _nullius_app/templates/agents/standard.html +58 -0
- _nullius_app/templates/base.html +479 -0
- _nullius_app/templates/builder/new_run.html +55 -0
- _nullius_app/templates/catalogue/add_dialog.html +32 -0
- _nullius_app/templates/catalogue/benchmark.html +270 -0
- _nullius_app/templates/catalogue/benchmarks.html +91 -0
- _nullius_app/templates/catalogue/new.html +141 -0
- _nullius_app/templates/catalogue/use_bundle.html +11 -0
- _nullius_app/templates/compare/_detail.html +37 -0
- _nullius_app/templates/compare/compare.html +298 -0
- _nullius_app/templates/compare/compare_picker.html +51 -0
- _nullius_app/templates/compare/compare_task.html +329 -0
- _nullius_app/templates/runs/_execution.html +131 -0
- _nullius_app/templates/runs/_runtime.html +5 -0
- _nullius_app/templates/runs/ascii-mark.html +485 -0
- _nullius_app/templates/runs/feasibility.html +127 -0
- _nullius_app/templates/runs/index.html +609 -0
- _nullius_app/templates/runs/job.html +460 -0
- _nullius_app/templates/runs/preparing.html +14 -0
- _nullius_app/templates/runs/reconcile.html +124 -0
- _nullius_app/templates/runs/setup.html +272 -0
- _nullius_app/templates/runs/start.html +51 -0
- _nullius_app/templates/settings/custom_keys.html +82 -0
- _nullius_app/templates/settings/data_providers.html +27 -0
- _nullius_app/templates/settings/settings.html +564 -0
- _nullius_app/templates/traces/_charts.html +165 -0
- _nullius_app/templates/traces/_conversation.html +37 -0
- _nullius_app/templates/traces/_judgement.html +72 -0
- _nullius_app/templates/traces/artifact.html +15 -0
- _nullius_app/templates/traces/trial.html +838 -0
- _nullius_app/templates/workspaces/workspaces.html +54 -0
- _nullius_app/web/__init__.py +1 -0
- _nullius_app/web/agents.py +230 -0
- _nullius_app/web/builder.py +406 -0
- _nullius_app/web/catalogue.py +370 -0
- _nullius_app/web/compare.py +489 -0
- _nullius_app/web/core.py +17 -0
- _nullius_app/web/execute.py +223 -0
- _nullius_app/web/feasibility.py +60 -0
- _nullius_app/web/filters.py +231 -0
- _nullius_app/web/judge.py +623 -0
- _nullius_app/web/judge_tasks.py +33 -0
- _nullius_app/web/onboarding.py +20 -0
- _nullius_app/web/reconcile.py +47 -0
- _nullius_app/web/runs.py +464 -0
- _nullius_app/web/settings.py +324 -0
- _nullius_app/web/shared.py +507 -0
- _nullius_app/web/traces.py +306 -0
- _nullius_app/web/workspaces.py +84 -0
- nullius/__init__.py +32 -0
- nullius/__main__.py +5 -0
- nullius/catalogue/__init__.py +0 -0
- nullius/catalogue/agents/codex/agent.json +222 -0
- nullius/catalogue/agents/codex/config.toml +25 -0
- nullius/catalogue/agents/goose/agent.json +131 -0
- nullius/catalogue/agents/goose/config.yaml +20 -0
- nullius/catalogue/agents/jiuwenswarm/agent.json +197 -0
- nullius/catalogue/agents/jiuwenswarm/agent.py +355 -0
- nullius/catalogue/agents/mini-swe-agent/agent.json +68 -0
- nullius/catalogue/agents/mini-swe-agent/run.py +37 -0
- nullius/catalogue/agents/opencode/agent.json +135 -0
- nullius/catalogue/agents/opencode/opencode.json +32 -0
- nullius/catalogue/agents/reference/agent.json +89 -0
- nullius/catalogue/agents/reference/agent.py +209 -0
- nullius/catalogue/agents/terminus-2/agent.json +64 -0
- nullius/catalogue/agents/terminus-2/run.py +139 -0
- nullius/catalogue/benchmarks/gaia/benchmark.json +72 -0
- nullius/catalogue/benchmarks/gaia/data-source.json +29 -0
- nullius/catalogue/benchmarks/gaia/driver.py +188 -0
- nullius/catalogue/benchmarks/gaia/env/data.Dockerfile +1 -0
- nullius/catalogue/benchmarks/gaia/standard.json +278 -0
- nullius/catalogue/benchmarks/gaia/upstream-settings.json +275 -0
- nullius/catalogue/benchmarks/gsm8k/benchmark.json +34 -0
- nullius/catalogue/benchmarks/gsm8k/driver.py +101 -0
- nullius/catalogue/benchmarks/gsm8k/standard.json +124 -0
- nullius/catalogue/benchmarks/gsm8k/upstream-settings.json +86 -0
- nullius/catalogue/benchmarks/humaneval/benchmark.json +36 -0
- nullius/catalogue/benchmarks/humaneval/driver.py +243 -0
- nullius/catalogue/benchmarks/humaneval/standard.json +115 -0
- nullius/catalogue/benchmarks/humaneval/upstream-settings.json +72 -0
- nullius/catalogue/benchmarks/locomo/benchmark.json +43 -0
- nullius/catalogue/benchmarks/locomo/driver.py +270 -0
- nullius/catalogue/benchmarks/locomo/standard.json +265 -0
- nullius/catalogue/benchmarks/locomo/upstream-settings.json +112 -0
- nullius/catalogue/benchmarks/longmemeval/benchmark.json +65 -0
- nullius/catalogue/benchmarks/longmemeval/driver.py +379 -0
- nullius/catalogue/benchmarks/longmemeval/standard.json +733 -0
- nullius/catalogue/benchmarks/longmemeval/upstream-settings.json +76 -0
- nullius/catalogue/benchmarks/swe-bench-verified/benchmark.json +87 -0
- nullius/catalogue/benchmarks/swe-bench-verified/driver.py +116 -0
- nullius/catalogue/benchmarks/swe-bench-verified/images.json +502 -0
- nullius/catalogue/benchmarks/swe-bench-verified/standard.json +108 -0
- nullius/catalogue/benchmarks/swe-bench-verified/upstream-settings.json +32 -0
- nullius/catalogue/benchmarks/tau3-bench/benchmark.json +49 -0
- nullius/catalogue/benchmarks/tau3-bench/driver.py +608 -0
- nullius/catalogue/benchmarks/tau3-bench/mcp_server.py +114 -0
- nullius/catalogue/benchmarks/tau3-bench/search_relay.py +19 -0
- nullius/catalogue/benchmarks/tau3-bench/standard.json +547 -0
- nullius/catalogue/benchmarks/tau3-bench/upstream-settings.json +639 -0
- nullius/catalogue/benchmarks/terminal-bench/benchmark.json +69 -0
- nullius/catalogue/benchmarks/terminal-bench/driver.py +267 -0
- nullius/catalogue/benchmarks/terminal-bench/standard.json +166 -0
- nullius/catalogue/benchmarks/terminal-bench/upstream-settings.json +36 -0
- nullius/catalogue/capabilities/keyword-memory/capability.json +33 -0
- nullius/catalogue/capabilities/keyword-memory/capability.py +55 -0
- nullius/catalogue/capabilities/mem0/capability.json +135 -0
- nullius/catalogue/capabilities/mem0/capability.py +173 -0
- nullius/catalogue/catalog.py +426 -0
- nullius/catalogue/citation.py +116 -0
- nullius/catalogue/harbor_entry.py +367 -0
- nullius/catalogue/sources.py +107 -0
- nullius/catalogue/storage.py +125 -0
- nullius/cli.py +85 -0
- nullius/compare/__init__.py +0 -0
- nullius/compare/cli.py +265 -0
- nullius/compare/comparison.py +184 -0
- nullius/execution.py +1653 -0
- nullius/gitrefs.py +128 -0
- nullius/harbor/__init__.py +0 -0
- nullius/harbor/feed.py +228 -0
- nullius/harbor/source.py +582 -0
- nullius/hosts.py +368 -0
- nullius/importers/__init__.py +140 -0
- nullius/importers/atif.py +387 -0
- nullius/importers/cli.py +135 -0
- nullius/importers/otel.py +274 -0
- nullius/judge/__init__.py +14 -0
- nullius/judge/batch.py +122 -0
- nullius/judge/client.py +433 -0
- nullius/judge/floors.json +86 -0
- nullius/judge/lanes.py +89 -0
- nullius/judge/questions.py +309 -0
- nullius/judge/reconcile.py +176 -0
- nullius/judge/state.py +224 -0
- nullius/judge/store.py +167 -0
- nullius/migrate.py +268 -0
- nullius/onboarding.py +116 -0
- nullius/paths.py +89 -0
- nullius/prerequisites.py +129 -0
- nullius/prices.py +283 -0
- nullius/progress.py +294 -0
- nullius/providers.py +335 -0
- nullius/recipes/__init__.py +0 -0
- nullius/recipes/launch.py +78 -0
- nullius/redact.py +72 -0
- nullius/runs/__init__.py +0 -0
- nullius/runs/artifacts.py +67 -0
- nullius/runs/classify.py +216 -0
- nullius/runs/cli.py +316 -0
- nullius/runs/feasibility.py +442 -0
- nullius/runs/launches.py +149 -0
- nullius/runs/live.py +715 -0
- nullius/runs/parse.py +1016 -0
- nullius/runs/verifier.py +241 -0
- nullius/sandbox.py +109 -0
- nullius/secrets.py +218 -0
- nullius/settings.py +544 -0
- nullius/standard/__init__.py +15 -0
- nullius/standard/acp.py +305 -0
- nullius/standard/cancellation.py +19 -0
- nullius/standard/cli.py +703 -0
- nullius/standard/conform.py +149 -0
- nullius/standard/container.py +1870 -0
- nullius/standard/definitions.py +1651 -0
- nullius/standard/egress.py +192 -0
- nullius/standard/fidelity.py +256 -0
- nullius/standard/forward.py +139 -0
- nullius/standard/hostreq.py +105 -0
- nullius/standard/howto.py +220 -0
- nullius/standard/install.py +428 -0
- nullius/standard/job.py +551 -0
- nullius/standard/jsonl.py +129 -0
- nullius/standard/kits/agent-conversation-v1/driver.py +27 -0
- nullius/standard/kits/agent-conversation-v1/standard.json +26 -0
- nullius/standard/kits/agent-search-v1/driver.py +171 -0
- nullius/standard/kits/agent-search-v1/standard.json +99 -0
- nullius/standard/kits/agent-task-v1/driver.py +25 -0
- nullius/standard/kits/agent-task-v1/standard.json +100 -0
- nullius/standard/kits/agent-tools-v1/driver.py +206 -0
- nullius/standard/kits/agent-tools-v1/mcp_kit.py +209 -0
- nullius/standard/kits/agent-tools-v1/standard.json +119 -0
- nullius/standard/kits/agent-workspace-v1/driver.py +65 -0
- nullius/standard/kits/agent-workspace-v1/standard.json +95 -0
- nullius/standard/kits/cap-memory-v1/driver.py +39 -0
- nullius/standard/kits/cap-memory-v1/standard.json +91 -0
- nullius/standard/ledger.py +326 -0
- nullius/standard/match.py +66 -0
- nullius/standard/mcp_bridge.py +62 -0
- nullius/standard/mcp_machine.py +193 -0
- nullius/standard/merge.py +239 -0
- nullius/standard/names.py +37 -0
- nullius/standard/network_requirements.py +44 -0
- nullius/standard/pace.py +53 -0
- nullius/standard/payload.py +278 -0
- nullius/standard/pins.py +130 -0
- nullius/standard/ports.py +70 -0
- nullius/standard/prove.py +373 -0
- nullius/standard/recipe.py +746 -0
- nullius/standard/relay.py +785 -0
- nullius/standard/run.py +1781 -0
- nullius/standard/setup_container.py +208 -0
- nullius/standard/shard.py +71 -0
- nullius/standard/web_services.py +30 -0
- nullius/traces/__init__.py +0 -0
- nullius/traces/behavior.py +131 -0
- nullius/traces/charts.py +898 -0
- nullius/traces/conversation.py +159 -0
- nullius/traces/otel.py +608 -0
- nullius/traces/trace.py +1477 -0
- nullius/traces/trajectory.py +586 -0
- nullius/workspace.py +417 -0
- nullius/workspace_cli.py +119 -0
- nullius_eval-0.1.0.dist-info/METADATA +93 -0
- nullius_eval-0.1.0.dist-info/RECORD +291 -0
- nullius_eval-0.1.0.dist-info/WHEEL +5 -0
- nullius_eval-0.1.0.dist-info/entry_points.txt +2 -0
- nullius_eval-0.1.0.dist-info/licenses/LICENSE +202 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/dmsans-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/ibmplexmono-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/licenses/app/static/fonts/instrumentserif-OFL.txt +93 -0
- nullius_eval-0.1.0.dist-info/top_level.txt +2 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
const list = document.getElementById('path-list');
|
|
3
|
+
const menu = document.getElementById('path-suggestions');
|
|
4
|
+
const csrf = document.querySelector('#pathform [name=csrf]').value;
|
|
5
|
+
let field = null, timer, request, index = -1;
|
|
6
|
+
|
|
7
|
+
function close() {
|
|
8
|
+
clearTimeout(timer);
|
|
9
|
+
request?.abort();
|
|
10
|
+
request = null;
|
|
11
|
+
menu.hidden = true;
|
|
12
|
+
menu.replaceChildren();
|
|
13
|
+
index = -1;
|
|
14
|
+
if (field) {
|
|
15
|
+
field.setAttribute('aria-expanded', 'false');
|
|
16
|
+
field.removeAttribute('aria-activedescendant');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function prepare(input) {
|
|
21
|
+
input.setAttribute('role', 'combobox');
|
|
22
|
+
input.setAttribute('aria-autocomplete', 'list');
|
|
23
|
+
input.setAttribute('aria-controls', menu.id);
|
|
24
|
+
input.setAttribute('aria-expanded', 'false');
|
|
25
|
+
input.removeAttribute('aria-activedescendant');
|
|
26
|
+
}
|
|
27
|
+
list.querySelectorAll('input').forEach(prepare);
|
|
28
|
+
|
|
29
|
+
function highlight(next) {
|
|
30
|
+
index = next;
|
|
31
|
+
[...menu.children].forEach((row, i) => {
|
|
32
|
+
row.classList.toggle('is-active', i === index);
|
|
33
|
+
row.setAttribute('aria-selected', String(i === index));
|
|
34
|
+
});
|
|
35
|
+
const row = menu.children[index];
|
|
36
|
+
field.setAttribute('aria-activedescendant', row.id);
|
|
37
|
+
// Scroll the menu only, keeping the page and the input still.
|
|
38
|
+
if (row.offsetTop < menu.scrollTop) menu.scrollTop = row.offsetTop;
|
|
39
|
+
if (row.offsetTop + row.offsetHeight > menu.scrollTop + menu.clientHeight)
|
|
40
|
+
menu.scrollTop = row.offsetTop + row.offsetHeight - menu.clientHeight;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function choose(row) {
|
|
44
|
+
field.value = row.dataset.path;
|
|
45
|
+
field.dispatchEvent(new Event('input', {bubbles: true}));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function suggest(input, delay = 180, edge = 0) {
|
|
49
|
+
close();
|
|
50
|
+
field = input;
|
|
51
|
+
prepare(input);
|
|
52
|
+
const value = input.value;
|
|
53
|
+
if (!value.trim()) return;
|
|
54
|
+
timer = setTimeout(async () => {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
request = controller;
|
|
57
|
+
try {
|
|
58
|
+
const response = await nulliusFetch(list.dataset.suggestionsUrl, {
|
|
59
|
+
method: 'POST', signal: controller.signal,
|
|
60
|
+
headers: {'X-CSRF-Token': csrf}, body: new URLSearchParams({path: value})
|
|
61
|
+
});
|
|
62
|
+
if (!response.ok) return;
|
|
63
|
+
const data = await response.json();
|
|
64
|
+
if (controller.signal.aborted || field !== input || input.value !== value || document.activeElement !== input) return;
|
|
65
|
+
if (!data.paths.length) return;
|
|
66
|
+
menu.replaceChildren(...data.paths.map((path, i) => {
|
|
67
|
+
const row = document.createElement('div');
|
|
68
|
+
row.className = 'ui-select-option';
|
|
69
|
+
row.id = `${menu.id}-${i}`;
|
|
70
|
+
row.setAttribute('role', 'option');
|
|
71
|
+
row.setAttribute('aria-selected', 'false');
|
|
72
|
+
row.setAttribute('aria-label', path);
|
|
73
|
+
row.dataset.path = path;
|
|
74
|
+
row.title = path;
|
|
75
|
+
const separator = path.slice(-1);
|
|
76
|
+
row.textContent = path.slice(0, -1).split(separator).pop() + separator;
|
|
77
|
+
return row;
|
|
78
|
+
}));
|
|
79
|
+
const rect = input.getBoundingClientRect();
|
|
80
|
+
const below = window.innerHeight - rect.bottom - 12;
|
|
81
|
+
const above = rect.top - 12;
|
|
82
|
+
const up = below < 150 && above > below;
|
|
83
|
+
menu.style.left = `${rect.left}px`;
|
|
84
|
+
menu.style.width = `${rect.width}px`;
|
|
85
|
+
menu.style.maxHeight = `${Math.min(260, Math.max(0, up ? above : below))}px`;
|
|
86
|
+
menu.style.top = up ? 'auto' : `${rect.bottom + 4}px`;
|
|
87
|
+
menu.style.bottom = up ? `${window.innerHeight - rect.top + 4}px` : 'auto';
|
|
88
|
+
menu.hidden = false;
|
|
89
|
+
field.setAttribute('aria-expanded', 'true');
|
|
90
|
+
if (edge) highlight(edge < 0 ? menu.children.length - 1 : 0);
|
|
91
|
+
} catch (_) { /* Typing can cancel a pending lookup; the path remains editable. */ }
|
|
92
|
+
}, delay);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
list.addEventListener('input', e => { if (e.target.matches('input')) suggest(e.target); });
|
|
96
|
+
list.addEventListener('focusin', e => { if (e.target.matches('input')) suggest(e.target); });
|
|
97
|
+
list.addEventListener('focusout', close);
|
|
98
|
+
list.addEventListener('keydown', e => {
|
|
99
|
+
if (!e.target.matches('input')) return;
|
|
100
|
+
if (e.key === 'Escape') { close(); e.stopPropagation(); return; }
|
|
101
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
const direction = e.key === 'ArrowDown' ? 1 : -1;
|
|
104
|
+
if (menu.hidden) { suggest(e.target, 0, direction); return; }
|
|
105
|
+
highlight(index < 0 ? (direction < 0 ? menu.children.length - 1 : 0)
|
|
106
|
+
: (index + direction + menu.children.length) % menu.children.length);
|
|
107
|
+
} else if (e.key === 'Enter' && !menu.hidden && index >= 0) {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
choose(menu.children[index]);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
menu.addEventListener('pointerdown', e => e.preventDefault());
|
|
113
|
+
menu.addEventListener('click', e => {
|
|
114
|
+
const row = e.target.closest('[role=option]');
|
|
115
|
+
if (row) choose(row);
|
|
116
|
+
});
|
|
117
|
+
window.addEventListener('resize', () => { if (!menu.hidden) close(); });
|
|
118
|
+
document.addEventListener('scroll', e => { if (!menu.hidden && !menu.contains(e.target)) close(); }, true);
|
|
119
|
+
})();
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* Runs with no workspace open: build a run, or bring the ones made elsewhere,
|
|
2
|
+
or open a workspace already here. Colours are the app's tokens (style.css). */
|
|
3
|
+
.start { width: 100%; max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
|
|
4
|
+
.start-head { display: flex; flex-direction: column; gap: 8px; }
|
|
5
|
+
.start-head h1 { margin: 0; }
|
|
6
|
+
.start-head p { margin: 0; font-size: 15px; color: var(--text-dim); }
|
|
7
|
+
.start-ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 18px; }
|
|
8
|
+
.start-card { display: flex; flex-direction: column; gap: 14px; padding: clamp(24px, 2vw, 36px); border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface); color: var(--text); }
|
|
9
|
+
.start-ic { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-strong); }
|
|
10
|
+
.start-ic .ic { width: 20px; height: 20px; }
|
|
11
|
+
.start-t { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -.01em; text-transform: none; color: var(--text); }
|
|
12
|
+
.start-d { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text-dim); }
|
|
13
|
+
.start-go { margin-top: auto; font-size: 14px; color: var(--accent); white-space: nowrap; }
|
|
14
|
+
.start-ws { display: flex; flex-direction: column; gap: 10px; }
|
|
15
|
+
.start-ws h2 { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text); }
|
|
16
|
+
.start-ws ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-soft); }
|
|
17
|
+
.start-ws li { border-bottom: 1px solid var(--border-soft); }
|
|
18
|
+
.start-ws form { margin: 0; }
|
|
19
|
+
.start-ws-row { width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 6px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 8px; }
|
|
20
|
+
.start-ws-row:hover { background: var(--surface); }
|
|
21
|
+
.start-ws-row:hover .start-go { color: var(--accent-strong); }
|
|
22
|
+
.start-ws-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
|
|
23
|
+
.start-ws-text small { font-size: 12.5px; color: var(--text-dim); }
|
|
24
|
+
.start-all { font-size: 13px; }
|
|
25
|
+
.start .sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
|
|
26
|
+
|
|
27
|
+
.start-title { display: flex; align-items: center; gap: 12px; }
|
|
28
|
+
.start-count { border: 1px solid var(--border-soft); border-radius: 20px; padding: 3px 9px; font-size: 12px; color: var(--text-dim); }
|
|
29
|
+
.start-card { min-height: clamp(256px, 22vh, 320px); box-shadow: var(--shadow); }
|
|
30
|
+
.start-ic { flex: none; width: 42px; height: 42px; border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent); }
|
|
31
|
+
.start-ic .ic { width: 22px; height: 22px; }
|
|
32
|
+
.start-action { display: inline-flex; align-items: center; gap: 16px; align-self: flex-start; margin-top: auto; padding: 10px 15px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 500; }
|
|
33
|
+
.start-action:hover { text-decoration: none; border-color: var(--accent); }
|
|
34
|
+
.start-primary { background: var(--accent); color: var(--btn-fg); border-color: transparent; }
|
|
35
|
+
.start-primary:hover { background: var(--accent-strong); }
|
|
36
|
+
.start-signature { display: flex; align-items: center; justify-content: center; color: var(--text-dim); user-select: none; pointer-events: none; }
|
|
37
|
+
.start-ascii { flex: 0 0 auto; width: clamp(320px, 32vw, 560px); max-width: 100%; height: auto; aspect-ratio: 1; opacity: .75; font: 8px monospace; }
|
|
38
|
+
@media (max-width: 520px) { .start-card { min-height: 236px; } }
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Serialize writes; refresh only unchanged fields so another edit is never lost.
|
|
2
|
+
(() => {
|
|
3
|
+
const form = document.getElementById('settings-form');
|
|
4
|
+
if (!form) return;
|
|
5
|
+
const status = form.querySelector('[data-changes]');
|
|
6
|
+
const retry = form.querySelector('[data-settings-retry]');
|
|
7
|
+
status.closest('.st-savebar').hidden = true;
|
|
8
|
+
const snapshot = () => new Map(new FormData(form));
|
|
9
|
+
let saved = snapshot(), pending = null;
|
|
10
|
+
const changes = current => [...current].filter(([key, value]) => !['csrf', 'embedded'].includes(key) && value !== (saved.get(key) ?? ''));
|
|
11
|
+
function say(message, error = false, retryable = false) {
|
|
12
|
+
status.textContent = message;
|
|
13
|
+
retry.hidden = !retryable;
|
|
14
|
+
status.closest('.st-savebar').hidden = !error;
|
|
15
|
+
form.dataset.saveError = String(error);
|
|
16
|
+
}
|
|
17
|
+
function notify(message) {
|
|
18
|
+
window.nulliusNotify(message, {key: 'settings'});
|
|
19
|
+
}
|
|
20
|
+
async function write() {
|
|
21
|
+
const current = snapshot();
|
|
22
|
+
const changed = changes(current);
|
|
23
|
+
if (!changed.length) return true;
|
|
24
|
+
const body = new FormData();
|
|
25
|
+
body.set('csrf', current.get('csrf'));
|
|
26
|
+
if (current.has('embedded')) body.set('embedded', '1');
|
|
27
|
+
const names = new Set();
|
|
28
|
+
for (const [key, value] of changed) {
|
|
29
|
+
body.set(key, value);
|
|
30
|
+
if (key.startsWith('clear:')) {
|
|
31
|
+
names.add(key.slice(6));
|
|
32
|
+
body.set('value:' + key.slice(6), current.get('value:' + key.slice(6)) || '');
|
|
33
|
+
} else if (key.startsWith('value:')) names.add(key.slice(6));
|
|
34
|
+
}
|
|
35
|
+
// A model edit always carries the displayed provider, including a sole auto-selection.
|
|
36
|
+
for (const prefix of ['SYSTEM_ONE', 'LLM_JUDGE']) {
|
|
37
|
+
if (body.has('value:' + prefix + '_MODEL') || body.has('clear:' + prefix + '_MODEL')) {
|
|
38
|
+
const provider = current.get('value:' + prefix + '_PROVIDER');
|
|
39
|
+
if (provider) body.set('value:' + prefix + '_PROVIDER', provider);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Removing the final host is an explicit removal, not an empty "keep" input.
|
|
43
|
+
if (body.has('value:HOSTS') && !body.get('value:HOSTS')) body.set('clear:HOSTS', '1');
|
|
44
|
+
const agentContainer = document.getElementById('AGENT_KEYS');
|
|
45
|
+
const agentFields = [...agentContainer.querySelectorAll('[name]')].map(input => input.name);
|
|
46
|
+
const agentChanged = changed.some(([key]) => key.startsWith('agent_key_'));
|
|
47
|
+
if (agentChanged) {
|
|
48
|
+
body.set('agent_key_name', current.get('agent_key_name') || '');
|
|
49
|
+
body.set('agent_key_value', current.get('agent_key_value') || '');
|
|
50
|
+
if (!body.get('agent_key_name') || !body.get('agent_key_value')) {
|
|
51
|
+
say('Enter both the key name and its value.', true);
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// A new endpoint: its name, URL and optional key go together.
|
|
56
|
+
const endpointChanged = changed.some(([key]) => key.startsWith('endpoint_'));
|
|
57
|
+
if (endpointChanged) {
|
|
58
|
+
for (const part of ['name', 'url', 'key']) body.set('endpoint_' + part, current.get('endpoint_' + part) || '');
|
|
59
|
+
if (!body.get('endpoint_name') || !body.get('endpoint_url')) {
|
|
60
|
+
say('Enter the endpoint name and its URL.', true);
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
say('');
|
|
65
|
+
form.setAttribute('aria-busy', 'true');
|
|
66
|
+
try {
|
|
67
|
+
const response = await nulliusFetch(form.action, {method: 'POST', headers: {Accept: 'application/json'}, body});
|
|
68
|
+
if (!response.ok && !response.headers.get('content-type')?.includes('application/json')) throw new Error('Settings could not be saved. Try again.');
|
|
69
|
+
const result = await response.json();
|
|
70
|
+
if (!result.ok) {
|
|
71
|
+
const error = new Error(result.message || 'Settings could not be saved.');
|
|
72
|
+
error.retryable = result.retryable === true;
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
if (result.reload) { // an endpoint added, renamed or removed: its cards and the judge pickers change
|
|
76
|
+
saved = snapshot();
|
|
77
|
+
history.replaceState(null, '', location.pathname + location.search + '#providers');
|
|
78
|
+
location.reload();
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
let message = 'Settings saved';
|
|
82
|
+
if (names.has('HOSTS')) {
|
|
83
|
+
const entries = value => (value || '').split(',').map(x => x.trim()).filter(Boolean);
|
|
84
|
+
const before = entries(saved.get('value:HOSTS')), after = entries(current.get('value:HOSTS'));
|
|
85
|
+
message = after.some(x => !before.includes(x)) ? 'Host added' : 'Host removed';
|
|
86
|
+
} else if (agentChanged || [...names].some(name => document.getElementById(name)?.dataset.secret === 'yes')) {
|
|
87
|
+
message = [...names].some(name => body.get('clear:' + name) === '1') ? 'Key removed' : 'Key saved';
|
|
88
|
+
}
|
|
89
|
+
const fresh = new DOMParser().parseFromString(result.html, 'text/html');
|
|
90
|
+
const now = snapshot();
|
|
91
|
+
for (const [key, value] of changed) saved.set(key, value);
|
|
92
|
+
for (const name of names) {
|
|
93
|
+
if (name === 'HOSTS') continue; // host-list listeners and chips stay in place
|
|
94
|
+
const field = document.getElementById(name), replacement = fresh.getElementById(name);
|
|
95
|
+
if (!field || !replacement || (field.contains(document.activeElement) && document.activeElement.matches('input:not([type=hidden]), textarea, select')) || field.querySelector('input[type=radio]')) continue;
|
|
96
|
+
const keys = [...field.querySelectorAll('[name]')].map(input => input.name);
|
|
97
|
+
if (keys.some(key => now.get(key) !== current.get(key))) continue;
|
|
98
|
+
field.replaceWith(replacement);
|
|
99
|
+
for (const input of replacement.querySelectorAll('[name]')) {
|
|
100
|
+
if (input.type !== 'radio' || input.checked) saved.set(input.name, input.value);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if ((agentChanged || [...names].some(name => agentContainer.contains(document.getElementById(name)))) && agentFields.every(key => now.get(key) === current.get(key))) {
|
|
104
|
+
const target = document.getElementById('AGENT_KEYS'), replacement = fresh.getElementById('AGENT_KEYS');
|
|
105
|
+
target.replaceWith(replacement);
|
|
106
|
+
const updated = snapshot();
|
|
107
|
+
for (const [key, value] of updated) {
|
|
108
|
+
if (key.startsWith('agent_key_') || [...replacement.querySelectorAll('[name]')].some(input => input.name === key)) saved.set(key, value);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
say('');
|
|
112
|
+
notify(result.message && result.message !== 'Saved' ? result.message : message);
|
|
113
|
+
document.dispatchEvent(new CustomEvent('nullius-settings-saved', {detail: {
|
|
114
|
+
removedKeys: [...names].filter(name => body.get('clear:' + name) === '1' && document.getElementById(name)?.dataset.secret === 'yes'),
|
|
115
|
+
providers: [...fresh.querySelectorAll('[data-provider-card]')].map(card => ({
|
|
116
|
+
key: card.dataset.providerCard, configured: card.dataset.configured, ready: card.dataset.ready,
|
|
117
|
+
label: card.querySelector('[data-provider-state]')?.textContent ?? '', // the new-endpoint form has no state line
|
|
118
|
+
tested: card.querySelector('[data-provider-test-state]')?.textContent, mark: card.querySelector('[data-provider-test-state]')?.dataset.state ?? ''
|
|
119
|
+
}))
|
|
120
|
+
}}));
|
|
121
|
+
return true;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
say(error.message || 'Settings could not be saved. Try again.', true, error.retryable !== false);
|
|
124
|
+
return false;
|
|
125
|
+
} finally {
|
|
126
|
+
form.removeAttribute('aria-busy');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function flush() {
|
|
130
|
+
if (pending) { const ok = await pending; return ok ? flush() : false; }
|
|
131
|
+
if (!changes(snapshot()).length) { say(''); return true; }
|
|
132
|
+
pending = write();
|
|
133
|
+
let ok;
|
|
134
|
+
try { ok = await pending; } finally { pending = null; }
|
|
135
|
+
return ok && changes(snapshot()).length ? flush() : ok;
|
|
136
|
+
}
|
|
137
|
+
window.nulliusSettings = {flush, dirty: () => changes(snapshot()).length > 0};
|
|
138
|
+
// Replace, type, then Keep: moving to Keep blurs the input, whose change
|
|
139
|
+
// would save the text Keep is about to throw away. A change whose focus
|
|
140
|
+
// stays in the field (Keep, or Remove on the way to it) waits until focus
|
|
141
|
+
// leaves the field; Keep has emptied the input by then.
|
|
142
|
+
const replacing = input => input.name?.startsWith('value:') && !input.hidden
|
|
143
|
+
&& input.closest('.st-field')?.querySelector('[data-replace]') ? input.closest('.st-field') : null;
|
|
144
|
+
form.addEventListener('change', event => {
|
|
145
|
+
if (event.target.closest('[data-key-new]')) return; // Add/Cancel or leaving the key editor owns this draft.
|
|
146
|
+
const field = replacing(event.target);
|
|
147
|
+
if (!field) { void flush(); return; }
|
|
148
|
+
setTimeout(() => {
|
|
149
|
+
if (!field.contains(document.activeElement) || document.activeElement === event.target) { void flush(); return; }
|
|
150
|
+
const leave = e => {
|
|
151
|
+
if (field.contains(e.relatedTarget)) return;
|
|
152
|
+
field.removeEventListener('focusout', leave);
|
|
153
|
+
void flush();
|
|
154
|
+
};
|
|
155
|
+
field.addEventListener('focusout', leave);
|
|
156
|
+
}, 0);
|
|
157
|
+
});
|
|
158
|
+
form.addEventListener('submit', event => { event.preventDefault(); void flush(); });
|
|
159
|
+
window.addEventListener('beforeunload', event => {
|
|
160
|
+
if (changes(snapshot()).length) { event.preventDefault(); event.returnValue = ''; }
|
|
161
|
+
});
|
|
162
|
+
})();
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Credential rows share one editor pattern; each keeps its existing save destination.
|
|
2
|
+
(() => {
|
|
3
|
+
const section = document.getElementById('custom-keys');
|
|
4
|
+
if (!section) return;
|
|
5
|
+
const add = section.querySelector('[data-key-add]');
|
|
6
|
+
const writable = !!document.getElementById('settings-form');
|
|
7
|
+
const cards = () => [...section.querySelectorAll('[data-key-card]')];
|
|
8
|
+
const newCard = () => section.querySelector('[data-key-new]');
|
|
9
|
+
function reveal(element, open, animate = true) {
|
|
10
|
+
if (element.dataset.keyOpen === String(open)) return;
|
|
11
|
+
element.dataset.keyOpen = String(open);
|
|
12
|
+
if (animate && window.NulliusDisclosure) window.NulliusDisclosure.setHidden(element, open);
|
|
13
|
+
else { element.hidden = !open; element.inert = !open; }
|
|
14
|
+
}
|
|
15
|
+
function editor(card, open, animate = true) {
|
|
16
|
+
const button = card.querySelector('[data-key-edit]');
|
|
17
|
+
button.hidden = false;
|
|
18
|
+
button.setAttribute('aria-expanded', String(open));
|
|
19
|
+
button.textContent = open ? (!writable ? 'Close' : card.dataset.keyKind === 'agent' ? 'Done' : 'Cancel') : button.dataset.keyLabel;
|
|
20
|
+
reveal(card.querySelector('[data-key-editor]'), open, animate);
|
|
21
|
+
card.dataset.keyReady = 'true';
|
|
22
|
+
}
|
|
23
|
+
function initialiseNew() {
|
|
24
|
+
const panel = newCard();
|
|
25
|
+
panel.querySelectorAll('button').forEach(button => { button.hidden = false; });
|
|
26
|
+
panel.querySelector('[data-key-new-save]').disabled = true;
|
|
27
|
+
panel.dataset.keyReady = 'true';
|
|
28
|
+
reveal(panel, false, false);
|
|
29
|
+
add.setAttribute('aria-expanded', 'false');
|
|
30
|
+
}
|
|
31
|
+
function initialise() {
|
|
32
|
+
cards().forEach(card => editor(card, false, false));
|
|
33
|
+
if (add) {
|
|
34
|
+
add.hidden = false; add.setAttribute('aria-expanded', 'false');
|
|
35
|
+
initialiseNew();
|
|
36
|
+
}
|
|
37
|
+
const empty = section.querySelector('[data-keys-empty]');
|
|
38
|
+
if (empty) empty.hidden = cards().length > 0;
|
|
39
|
+
}
|
|
40
|
+
function closeNew() {
|
|
41
|
+
const panel = newCard();
|
|
42
|
+
panel.querySelectorAll('input').forEach(input => { input.value = ''; });
|
|
43
|
+
panel.querySelector('[data-key-new-save]').disabled = true;
|
|
44
|
+
// Clear any incomplete-name validation without saving a discarded draft.
|
|
45
|
+
void window.nulliusSettings?.flush();
|
|
46
|
+
reveal(panel, false);
|
|
47
|
+
add.setAttribute('aria-expanded', 'false');
|
|
48
|
+
add.focus({preventScroll: true});
|
|
49
|
+
}
|
|
50
|
+
section.addEventListener('input', event => {
|
|
51
|
+
const panel = event.target.closest('[data-key-new]');
|
|
52
|
+
if (panel) panel.querySelector('[data-key-new-save]').disabled = ![...panel.querySelectorAll('input')].every(input => input.value.trim());
|
|
53
|
+
});
|
|
54
|
+
section.addEventListener('click', async event => {
|
|
55
|
+
const toggle = event.target.closest('[data-key-edit]');
|
|
56
|
+
if (toggle) {
|
|
57
|
+
const card = toggle.closest('[data-key-card]');
|
|
58
|
+
const open = toggle.getAttribute('aria-expanded') !== 'true';
|
|
59
|
+
if (!open && card.dataset.keyKind === 'agent' && window.nulliusSettings && !await window.nulliusSettings.flush()) return;
|
|
60
|
+
// A save may replace the agent card while flush resolves.
|
|
61
|
+
if (!card.isConnected) { add?.focus({preventScroll: true}); return; }
|
|
62
|
+
if (!open && card.dataset.keyKind === 'benchmark') card.querySelectorAll('input').forEach(input => { input.value = ''; });
|
|
63
|
+
editor(card, open);
|
|
64
|
+
if (open) card.querySelector('[data-key-editor] input:not([type=hidden])')?.focus({preventScroll: true});
|
|
65
|
+
else toggle.focus({preventScroll: true});
|
|
66
|
+
}
|
|
67
|
+
if (event.target.closest('[data-key-add]')) {
|
|
68
|
+
reveal(newCard(), true); add.setAttribute('aria-expanded', 'true');
|
|
69
|
+
newCard().querySelector('input').focus({preventScroll: true});
|
|
70
|
+
}
|
|
71
|
+
if (event.target.closest('[data-key-new-cancel]')) closeNew();
|
|
72
|
+
if (event.target.closest('[data-key-new-save]')) {
|
|
73
|
+
if (window.nulliusSettings && await window.nulliusSettings.flush()) add.focus({preventScroll: true});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
// Add and Cancel control this draft. Moving within it must not save before Cancel runs.
|
|
77
|
+
section.addEventListener('focusout', event => {
|
|
78
|
+
const panel = event.target.closest('[data-key-new]');
|
|
79
|
+
if (!panel || panel.contains(event.relatedTarget)) return;
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
if (panel.isConnected && !panel.hidden && !panel.contains(document.activeElement)) void window.nulliusSettings?.flush();
|
|
82
|
+
}, 0);
|
|
83
|
+
});
|
|
84
|
+
document.addEventListener('nullius-settings-saved', () => {
|
|
85
|
+
// Autosave replaces AGENT_KEYS, so initialise new nodes rather than retaining old cards.
|
|
86
|
+
section.querySelectorAll('#AGENT_KEYS [data-key-card]:not([data-key-ready])').forEach(card => editor(card, false, false));
|
|
87
|
+
if (add && !newCard().dataset.keyReady) initialiseNew();
|
|
88
|
+
const empty = section.querySelector('[data-keys-empty]');
|
|
89
|
+
if (empty) empty.hidden = cards().length > 0;
|
|
90
|
+
});
|
|
91
|
+
function fromHash() {
|
|
92
|
+
let id;
|
|
93
|
+
try { id = decodeURIComponent(location.hash.slice(1)); } catch { return; }
|
|
94
|
+
const target = document.getElementById(id);
|
|
95
|
+
const card = target?.closest('[data-key-card]');
|
|
96
|
+
if (card && section.contains(card)) editor(card, true, false);
|
|
97
|
+
}
|
|
98
|
+
window.addEventListener('hashchange', fromHash);
|
|
99
|
+
initialise(); fromHash();
|
|
100
|
+
})();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Provider credentials use their own stores, never the model settings form.
|
|
2
|
+
(() => {
|
|
3
|
+
const section = document.getElementById('data-providers');
|
|
4
|
+
if (!section) return;
|
|
5
|
+
const $ = s => section.querySelector(s);
|
|
6
|
+
const cards = [...section.querySelectorAll('[data-data-card]')];
|
|
7
|
+
const choices = [...section.querySelectorAll('[data-data-select]')];
|
|
8
|
+
const add = $('[data-data-add]'), search = $('[data-data-search]');
|
|
9
|
+
let saved = {}, mode = 'list', selected = '', asked = false, busy = false;
|
|
10
|
+
const notify = (message, error = false) => window.nulliusNotify?.(message, {error});
|
|
11
|
+
const filter = () => {
|
|
12
|
+
choices.forEach(c => { c.hidden = !!saved[c.dataset.dataSelect] || !c.dataset.name.toLowerCase().replaceAll(' ', '').includes(search.value.toLowerCase().replaceAll(' ', '').trim()); });
|
|
13
|
+
$('[data-data-no-results]').hidden = choices.some(c => !c.hidden);
|
|
14
|
+
};
|
|
15
|
+
const render = () => {
|
|
16
|
+
if (add) add.hidden = mode !== 'list' || cards.every(c => saved[c.dataset.dataCard]);
|
|
17
|
+
$('[data-data-back]').hidden = mode === 'list';
|
|
18
|
+
$('[data-data-empty]').hidden = mode !== 'list' || cards.some(c => saved[c.dataset.dataCard]);
|
|
19
|
+
$('[data-data-catalogue]').hidden = mode !== 'catalogue';
|
|
20
|
+
cards.forEach(card => {
|
|
21
|
+
const key = card.dataset.dataCard, editing = mode === 'editor' && key === selected;
|
|
22
|
+
card.hidden = !(editing || mode === 'list' && saved[key]);
|
|
23
|
+
card.querySelector('[data-data-edit]').hidden = editing;
|
|
24
|
+
card.querySelector('[data-data-fields]').hidden = !editing;
|
|
25
|
+
card.querySelector('[data-data-account]').textContent = key === 'dockerhub' ? saved[key] || '' : saved[key] ? 'Token saved' : '';
|
|
26
|
+
const remove = card.querySelector('[data-data-remove]'); if (remove) remove.hidden = !saved[key];
|
|
27
|
+
});
|
|
28
|
+
filter();
|
|
29
|
+
};
|
|
30
|
+
const leave = () => {
|
|
31
|
+
cards.forEach(card => card.querySelector('form')?.reset());
|
|
32
|
+
mode = 'list'; render();
|
|
33
|
+
const target = saved[selected] ? $(`[data-data-card="${selected}"] [data-data-edit]`) : add;
|
|
34
|
+
if (target && !target.hidden) target.focus();
|
|
35
|
+
};
|
|
36
|
+
const edit = key => {
|
|
37
|
+
selected = key; mode = 'editor'; render();
|
|
38
|
+
const card = $(`[data-data-card="${key}"]`);
|
|
39
|
+
const username = card.querySelector('[name=username]'); if (username) username.value = saved[key] || '';
|
|
40
|
+
(card.querySelector('input') || $('[data-data-back]')).focus();
|
|
41
|
+
};
|
|
42
|
+
if (add) add.addEventListener('click', () => { mode = 'catalogue'; search.value = ''; render(); search.focus(); });
|
|
43
|
+
$('[data-data-back]').addEventListener('click', () => { if (!busy) leave(); });
|
|
44
|
+
search.addEventListener('input', filter);
|
|
45
|
+
choices.forEach(c => c.addEventListener('click', () => edit(c.dataset.dataSelect)));
|
|
46
|
+
const change = async (card, remove) => {
|
|
47
|
+
if (busy) return;
|
|
48
|
+
busy = true;
|
|
49
|
+
const key = card.dataset.dataCard, form = card.querySelector('form');
|
|
50
|
+
const fields = new FormData(form);
|
|
51
|
+
if (key === 'huggingface') fields.set('action', remove ? 'remove' : 'save');
|
|
52
|
+
// Removing a connection never submits a replacement token.
|
|
53
|
+
if (remove) fields.delete('token');
|
|
54
|
+
const url = key === 'huggingface' ? section.dataset.huggingface : remove ? section.dataset.dockerhubRemove : section.dataset.dockerhub;
|
|
55
|
+
section.querySelectorAll('button').forEach(b => { b.disabled = true; });
|
|
56
|
+
try {
|
|
57
|
+
const response = await nulliusFetch(url, {method: 'POST', headers: {'X-CSRF-Token': section.dataset.csrf}, body: fields});
|
|
58
|
+
const result = await response.json();
|
|
59
|
+
if (!response.ok || !result.ok) { notify(result.error || 'Could not save the connection.', true); return; }
|
|
60
|
+
saved[key] = remove ? null : key === 'huggingface' ? true : result.user;
|
|
61
|
+
notify(remove ? 'Connection removed' : key === 'dockerhub' ? 'Signed in to Docker Hub' : 'Connection saved');
|
|
62
|
+
leave();
|
|
63
|
+
} catch { notify('Could not save the connection.', true); }
|
|
64
|
+
finally {
|
|
65
|
+
form.querySelector('[name=token]').value = '';
|
|
66
|
+
section.querySelectorAll('button').forEach(b => { b.disabled = false; });
|
|
67
|
+
busy = false;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
cards.forEach(card => {
|
|
71
|
+
card.querySelector('[data-data-edit]').addEventListener('click', () => edit(card.dataset.dataCard));
|
|
72
|
+
card.querySelector('form')?.addEventListener('submit', e => { e.preventDefault(); void change(card, false); });
|
|
73
|
+
card.querySelector('[data-data-remove]')?.addEventListener('click', () => void change(card, true));
|
|
74
|
+
});
|
|
75
|
+
const load = async () => {
|
|
76
|
+
if (asked || section.hidden) return;
|
|
77
|
+
asked = true;
|
|
78
|
+
try {
|
|
79
|
+
const response = await nulliusFetch(section.dataset.state);
|
|
80
|
+
if (!response.ok) throw new Error();
|
|
81
|
+
saved = await response.json(); render();
|
|
82
|
+
} catch {
|
|
83
|
+
const error = $('[data-data-error]'); error.textContent = 'Could not load data providers. Reopen Settings to retry.'; error.hidden = false;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
new MutationObserver(load).observe(section, {attributes: true, attributeFilter: ['hidden']});
|
|
87
|
+
load();
|
|
88
|
+
})();
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Judge choices reuse configured connections; credentials live only in Model providers.
|
|
2
|
+
(() => {
|
|
3
|
+
const cards = [...document.querySelectorAll('[data-judge-card]')];
|
|
4
|
+
const writable = !!document.getElementById('settings-form');
|
|
5
|
+
function update(card, states) {
|
|
6
|
+
const choices = [...card.querySelectorAll('[data-provider]')];
|
|
7
|
+
for (const choice of choices) {
|
|
8
|
+
if (states) choice.dataset.available = states.some(s => s.key === choice.dataset.provider && s.ready === 'true') ? 'true' : 'false';
|
|
9
|
+
choice.hidden = choice.dataset.available !== 'true';
|
|
10
|
+
const input = choice.querySelector('input');
|
|
11
|
+
input.disabled = !writable || choice.hidden;
|
|
12
|
+
if (choice.hidden) input.checked = false;
|
|
13
|
+
}
|
|
14
|
+
const available = choices.filter(c => !c.hidden);
|
|
15
|
+
if (available.length === 1) available[0].querySelector('input').checked = true;
|
|
16
|
+
card.querySelector('[data-picker]').classList.toggle('st-judge-single', available.length === 1);
|
|
17
|
+
card.querySelector('[data-no-judge-provider]').hidden = available.length > 0;
|
|
18
|
+
const modelField = card.querySelector('.st-field[id$="_MODEL"]');
|
|
19
|
+
const on = card.querySelector('[data-picker] input:checked');
|
|
20
|
+
modelField.hidden = !on;
|
|
21
|
+
const model = modelField.querySelector('input.st-input');
|
|
22
|
+
const list = model?.list;
|
|
23
|
+
if (list) {
|
|
24
|
+
list.replaceChildren();
|
|
25
|
+
for (const value of (on?.dataset.models || '').split('|').filter(Boolean)) {
|
|
26
|
+
const option = document.createElement('option'); option.value = value; list.append(option);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (model) model.placeholder = on?.dataset.default || '';
|
|
30
|
+
}
|
|
31
|
+
// A provider with no list of its own here: its catalogue, asked once when the field is first used. Typing a model still works.
|
|
32
|
+
const catalogues = new Map();
|
|
33
|
+
async function offerCatalogue(card, model) {
|
|
34
|
+
const on = card.querySelector('[data-picker] input:checked');
|
|
35
|
+
if (!on || on.dataset.models || !model.list) return;
|
|
36
|
+
const provider = on.value.replace(/^local(?=$|:)/, 'custom'); // local:<id>, a named endpoint, is the builder's custom:<id>
|
|
37
|
+
if (!catalogues.has(provider)) {
|
|
38
|
+
catalogues.set(provider, nulliusFetch('/new-run/models', {method: 'POST', headers: {'Content-Type': 'application/json',
|
|
39
|
+
'X-CSRF-Token': document.querySelector('#settings-form [name=csrf]').value}, body: JSON.stringify({provider})})
|
|
40
|
+
.then(r => { if (!r.ok) throw new Error("Model catalogue unavailable"); return r.json(); }).then(j => { if (j.error) throw new Error(j.error); return j.models || []; }).catch(() => { catalogues.delete(provider); return []; }));
|
|
41
|
+
}
|
|
42
|
+
const models = await catalogues.get(provider);
|
|
43
|
+
if (card.querySelector('[data-picker] input:checked') !== on) return;
|
|
44
|
+
model.list.replaceChildren(...models.map(m => {
|
|
45
|
+
const option = document.createElement('option'); option.value = m.id; if (m.name !== m.id) option.label = m.name; return option;
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
cards.forEach(card => {
|
|
49
|
+
card.addEventListener('change', event => { if (event.target.matches('[data-picker] input')) update(card); });
|
|
50
|
+
card.addEventListener('focusin', event => { if (event.target.matches('input.st-input')) offerCatalogue(card, event.target); });
|
|
51
|
+
});
|
|
52
|
+
// Initialize after autosave records the server state, so a sole replacement
|
|
53
|
+
// for an unavailable saved provider is persisted rather than merely displayed.
|
|
54
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
55
|
+
cards.forEach(card => update(card));
|
|
56
|
+
if (writable) document.getElementById('settings-form').dispatchEvent(new Event('change'));
|
|
57
|
+
});
|
|
58
|
+
document.addEventListener('nullius-settings-saved', event => {
|
|
59
|
+
cards.forEach(card => update(card, event.detail?.providers));
|
|
60
|
+
});
|
|
61
|
+
})();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Settings keeps the current page alive beneath a native modal dialog. */
|
|
2
|
+
.settings-modal { width: min(1160px, calc(100vw - 64px)); height: min(840px, calc(100dvh - 64px)); max-width: none; max-height: none; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--text); box-shadow: 0 24px 80px #0006; }
|
|
3
|
+
.settings-modal[open] { display: flex; flex-direction: column; }
|
|
4
|
+
.settings-modal::backdrop { background: #0008; backdrop-filter: blur(3px); }
|
|
5
|
+
.settings-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-bottom: 1px solid var(--border-soft); }
|
|
6
|
+
.settings-modal-head h2 { margin: 0; font: 500 16px var(--sans); color: var(--text); text-transform: none; letter-spacing: normal; }
|
|
7
|
+
.settings-modal-head [data-settings-close] { font-size: 24px; width: 40px; height: 40px; }
|
|
8
|
+
.settings-modal iframe { border: 0; width: 100%; flex: 1; min-height: 0; background: var(--bg); }
|
|
9
|
+
/* The initial iframe document can paint white before its stylesheet arrives. */
|
|
10
|
+
.settings-modal iframe:not([data-ready]) { visibility: hidden; }
|
|
11
|
+
body:has(.settings-modal[open]) { overflow: hidden; }
|
|
12
|
+
.settings-embedded .side, .settings-embedded .topbar, .settings-embedded .skip-link { display: none; }
|
|
13
|
+
.settings-embedded { height: 100dvh; overflow: hidden; }
|
|
14
|
+
.settings-embedded .shell, :root[data-rail] .settings-embedded .shell { display: block; height: 100%; min-height: 0; }
|
|
15
|
+
.settings-embedded main { height: 100dvh; min-height: 0; padding: 24px; box-sizing: border-box; }
|
|
16
|
+
.settings-embedded .st-page { height: 100%; min-height: 0; }
|
|
17
|
+
.settings-embedded .st-head { display: none; }
|
|
18
|
+
.settings-embedded .st-layout { flex: 1; min-height: 0; flex-wrap: nowrap; gap: 24px; align-items: stretch; }
|
|
19
|
+
.settings-embedded .st-index { flex: 0 0 190px; position: static; min-height: 0; overflow-y: auto; border: 0; background: transparent; padding: 0; }
|
|
20
|
+
.settings-embedded .st-main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 0 8px 16px 4px; }
|
|
21
|
+
@media (max-width: 760px) {
|
|
22
|
+
.settings-modal { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
|
|
23
|
+
.settings-embedded main { padding: 16px; }
|
|
24
|
+
.settings-embedded .st-layout { flex-direction: column; }
|
|
25
|
+
.settings-embedded .st-index { flex: 0 1 auto; max-height: 38%; width: 100%; box-sizing: border-box; }
|
|
26
|
+
.settings-embedded .st-main { width: 100%; flex: 1 1 0; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.settings-modal-head h2:focus { outline: none; }
|
|
30
|
+
|
|
31
|
+
/* Document containers are not controls; keep focus rings on their controls. */
|
|
32
|
+
.settings-modal iframe:focus, .settings-embedded #main-content:focus { outline: none; }
|