Settings Tools tab (screen only, mock-up state), Time-skip trial runs on the chat's API model too

This commit is contained in:
Niko1221 committed 2026-10-16 10:22:09 +02:00
1 parent db9c322bce
commit 0d4e0dde8c
5 files changed
+282 -6

No files matched your search

+81
View File
@@ -0,0 +1,81 @@
/**
* Settings -> Tools screenshots from the real UI. The host's /api/agent/tools answer is replaced by a fixture (page.route) so every state can be
* shown without a model or a Harness.
*
* STRATA_URL=http://127.0.0.1:8899 SHOTS=./tools-shots node scripts/tools-shots.mjs
*/
import { chromium } from 'playwright-core';
import { existsSync, mkdirSync } from 'node:fs';
import { join, resolve } from 'node:path';
const BASE = process.env.STRATA_URL;
if (!BASE) { console.error('STRATA_URL is required'); process.exit(2); }
const SHOTS = resolve(process.env.SHOTS ?? 'tools-shots');
mkdirSync(SHOTS, { recursive: true });
const CHROME = process.env.CHROME ?? ['C:/Program Files/Google/Chrome/Application/chrome.exe', '/usr/bin/google-chrome'].find(existsSync);
const group = (id, name, about, area, asks = false, enabled = true) => ({ id, name, about, area, asks, enabled });
const GROUPS = [
group('shell', 'Run commands', 'Lets the assistant run commands, for example to open a folder or start a program.', 'computer', true),
group('files', 'Read and change files', 'Lets the assistant read, create and edit files in your chat folder.', 'computer', true),
group('find', 'Find files and text', 'Lets the assistant look for files by name and search inside them. It only reads.', 'computer'),
group('jobs', 'Long-running jobs', 'Lets the assistant start a slow command in the background and check on it later.', 'computer', true),
group('fetch', 'Open web pages', 'Lets the assistant read a web page you point it to.', 'web'),
group('search', 'Search the web', 'Lets the assistant search the web when it needs fresh information.', 'web'),
group('helpers', 'Helper assistants', 'Lets the assistant start helpers that work on parts of a task at the same time.', 'together'),
group('goals', 'Goals', 'Lets you give a goal with /goal. The assistant keeps working until it is done.', 'together'),
group('todo', 'To-do list', 'Lets the assistant keep a checklist while it works on a big task.', 'together'),
group('skills', 'Skills', 'Lets the assistant use your saved skills when they fit the task.', 'together'),
group('present', 'Show results', 'Lets the assistant show a page or file in the preview next to the chat.', 'together'),
];
const base = () => ({ groups: GROUPS.map(g => ({ ...g })), search: { provider: 'builtin', keySet: false }, browser: { enabled: false, found: true, name: 'Google Chrome' }, custom: [] });
const STATES = {
fresh: base(),
busy: (() => { const s = base(); s.groups[3].enabled = false; s.groups[5].enabled = false; s.browser.enabled = true;
s.custom = [
{ id: 'c1', name: 'Release notes', about: 'Write release notes in our house style.', kind: 'instructions', enabled: true, summary: 'Start with a one-line summary…' },
{ id: 'c2', name: 'Check website', about: 'Check that our website answers.', kind: 'command', enabled: true, summary: 'curl -I https://example.com', command: 'curl -I https://example.com' },
{ id: 'c3', name: 'Issue tracker', about: 'Look up and update issues.', kind: 'server', enabled: false, summary: 'https://issues.example/mcp', address: 'https://issues.example/mcp' },
]; return s; })(),
key: (() => { const s = base(); s.search = { provider: 'exa', keySet: false }; return s; })(),
nobrowser: (() => { const s = base(); s.browser = { enabled: false, found: false, name: null }; return s; })(),
};
const browser = await chromium.launch({ executablePath: CHROME, headless: true });
let page = null, context = null;
let current = 'fresh';
const shot = async name => { await page.waitForTimeout(500); await page.screenshot({ path: join(SHOTS, `${name}.png`) }); console.log(`shot ${name}.png`); };
const open = async state => {
current = state;
if (!page) {
context = await browser.newContext({ viewport: { width: 1360, height: 980 } });
page = await context.newPage();
page.on('pageerror', e => console.log('pageerror', e.message.slice(0, 300)));
page.on('console', m => { if (m.type() === 'error') console.log('console', m.text().slice(0, 300)); });
await page.route('**/api/agent/tools**', route => route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify(STATES[current]) }));
await page.goto(`${BASE}/`);
const skip = page.getByText('Go straight to the app');
await skip.waitFor({ timeout: 8000 }).then(() => skip.click()).catch(() => {});
await page.goto(`${BASE}/#/settings`);
await page.waitForSelector('#settings-tab-Tools', { timeout: 20000 });
await page.locator('#settings-tab-Tools').evaluate(el => el.click());
} else {
// The Tools panel loads its list when it is shown: leave it and come back to load the next fixture.
await page.locator('#settings-tab-Appearance').evaluate(el => el.click());
await page.waitForTimeout(300);
}
await page.locator('#settings-tab-Tools').evaluate(el => el.click());
await page.waitForSelector('.settings-tools', { timeout: 10000 });
};
await open('fresh'); await shot('01-tools-top');
await page.getByRole('heading', { name: 'Web search' }).evaluate(el => el.scrollIntoView({ block: 'start' })); await shot('02-tools-web-and-browser');
await open('busy'); await page.getByRole('heading', { name: 'Your own tools' }).evaluate(el => el.scrollIntoView({ block: 'start' })); await shot('03-your-own-tools');
await open('key'); await page.getByRole('heading', { name: 'Web search' }).evaluate(el => el.scrollIntoView({ block: 'start' })); await shot('04-search-with-key');
await open('nobrowser'); await page.getByRole('heading', { name: 'Web browser' }).evaluate(el => el.scrollIntoView({ block: 'start' })); await shot('05-no-browser-found');
await open('fresh');
await page.getByRole('button', { name: 'Add a tool' }).click(); await shot('06-add-tool-instructions');
await page.getByRole('dialog').getByLabel('How it works').click();
await page.getByRole('option', { name: 'Run a command' }).click(); await shot('07-add-tool-command');
await page.getByRole('dialog').getByLabel('How it works').click();
await page.getByRole('option', { name: 'Connect a tool server (MCP)' }).click(); await shot('08-add-tool-server');
await browser.close();
+5 -1
View File
@@ -625,6 +625,8 @@ const TIMESKIP_REVISE = process.env.STRATA_TIMESKIP_REVISE
?? `"${process.execPath}" "${REVISE_NODE_SCRIPT}"`;
/** Proves a revision request comes from a job this host started, not from some other program on this PC. */
const INTERNAL_SECRET = randomBytes(24).toString('hex');
/** The model a trial runs on, by run id: the chat's saved API model when it uses one, else the loaded local model. */
const timeskipChoices = new Map();
/**
* Tuning, from the App Host.
*
@@ -931,6 +933,7 @@ async function api(req, res, path, method, url) {
extraEnv: { STRATA_HOST_URL: `http://127.0.0.1:${PORT}`, STRATA_INTERNAL_SECRET: INTERNAL_SECRET },
});
if (!result.ok) return error(res, result.code === 2 ? 400 : 502, result.error);
if (body.remoteModel?.connectionId && body.remoteModel?.modelId) timeskipChoices.set(result.run.id, { connectionId: String(body.remoteModel.connectionId), modelId: String(body.remoteModel.modelId) });
return json(res, 200, { run: result.run, simulated: false });
}
if (path === '/api/timeskip/files' && method === 'GET') {
@@ -952,7 +955,8 @@ async function api(req, res, path, method, url) {
// Only the job's own candidate folders may be worked in.
const root = resolve(timeskip.stateDir());
if (!cwd || !resolve(cwd).startsWith(root + sep)) return error(res, 400, 'That folder is not part of a Time-skip run.');
const chosen = (() => { try { return { instanceId: native.resolveInstance(native.state().defaultId).id }; } catch { return null; } })();
const runId = resolve(cwd).slice(root.length + 1).split(sep)[0];
const chosen = timeskipChoices.get(runId) ?? (() => { try { return { instanceId: native.resolveInstance(native.state().defaultId).id }; } catch { return null; } })();
if (!chosen) return error(res, 503, 'Load a model first, then try Time-skip again.');
const chatId = `timeskip:${randomBytes(6).toString('hex')}`;
let text = '', failure = null;
+190
View File
@@ -0,0 +1,190 @@
import { tr } from '../lib/i18n';
/**
* Settings -> Tools: what the assistant may use in chats, in plain words.
*
* Every row is a switch in the existing Field pattern. Nothing here is a new component: switches, selects, dialogs and buttons are
* the ones the other Settings panels use. The host owns the truth (GET/PUT /api/agent/tools); a change applies from the next message.
*/
import { useEffect, useState } from 'react';
import { api } from '../lib/client';
import { pushToast } from '../lib/store';
import { Btn, Dialog, ErrorNotice, Field, Icon, Select } from './ui';
export interface ToolGroup {
id: string;
name: string;
about: string;
area: 'computer' | 'web' | 'together';
enabled: boolean;
/** Manual mode asks before this tool changes anything. */
asks: boolean;
}
export interface CustomTool {
id: string;
name: string;
about: string;
kind: 'instructions' | 'command' | 'server';
enabled: boolean;
/** Shown in the list: the command, the server address or the first words of the instructions. */
summary: string;
instructions?: string;
command?: string;
address?: string;
args?: string[];
}
export interface ToolsState {
groups: ToolGroup[];
search: { provider: 'builtin' | 'exa' | 'perplexity' | 'deepseek'; keySet: boolean };
browser: { enabled: boolean; found: boolean; name: string | null };
custom: CustomTool[];
}
const AREAS: { id: ToolGroup['area']; title: string }[] = [
{ id: 'computer', title: 'On this computer' },
{ id: 'web', title: 'On the web' },
{ id: 'together', title: 'Working on bigger jobs' },
];
const SEARCH_CHOICES = [
{ value: 'builtin', label: 'DuckDuckGo (no key)' },
{ value: 'exa', label: 'Exa (your own key)' },
{ value: 'perplexity', label: 'Perplexity (your own key)' },
{ value: 'deepseek', label: 'DeepSeek (your own key)' },
];
const KIND_CHOICES = [
{ value: 'instructions', label: 'Follow my instructions' },
{ value: 'command', label: 'Run a command' },
{ value: 'server', label: 'Connect a tool server (MCP)' },
];
const KIND_NAMES: Record<CustomTool['kind'], string> = { instructions: 'Instructions', command: 'Command', server: 'Tool server' };
interface Draft {
id?: string;
name: string;
about: string;
kind: CustomTool['kind'];
instructions: string;
command: string;
address: string;
args: string;
}
const blank = (): Draft => ({ name: '', about: '', kind: 'instructions', instructions: '', command: '', address: '', args: '' });
export function SettingsTools({ preview }: { preview?: ToolsState }) {
const [state, setState] = useState<ToolsState | null>(preview ?? null);
const [error, setError] = useState('');
const [key, setKey] = useState('');
const [draft, setDraft] = useState<Draft | null>(null);
const [formError, setFormError] = useState('');
const [remove, setRemove] = useState<CustomTool | null>(null);
const [busy, setBusy] = useState(false);
async function load() {
try { setState(await api.get<ToolsState>('/api/agent/tools')); setError(''); }
catch (e) { setError(e instanceof Error ? e.message : 'The tool list could not be loaded.'); }
}
useEffect(() => { if (!preview) void load(); }, []);
async function save(change: Record<string, unknown>) {
if (preview) return;
setBusy(true);
try { setState(await api.put<ToolsState>('/api/agent/tools', change)); setError(''); }
catch (e) { setError(e instanceof Error ? e.message : 'The change could not be saved.'); void load(); }
finally { setBusy(false); }
}
const toggle = (id: string, on: boolean) => {
setState(s => s && { ...s, groups: s.groups.map(g => g.id === id ? { ...g, enabled: on } : g) });
void save({ groups: { [id]: on } });
};
async function submit() {
if (!draft) return;
if (!/^[A-Za-z][A-Za-z0-9 _-]{0,39}$/.test(draft.name.trim())) { setFormError('Give the tool a short name: letters, numbers, spaces or hyphens.'); return; }
if (!draft.about.trim()) { setFormError('Say what the tool does, in a sentence. The assistant reads this to decide when to use it.'); return; }
if (draft.kind === 'instructions' && !draft.instructions.trim()) { setFormError('Write the instructions the assistant should follow when it uses this tool.'); return; }
if (draft.kind === 'command' && !draft.command.trim()) { setFormError('Enter the command to run.'); return; }
if (draft.kind === 'server' && !draft.address.trim()) { setFormError('Enter the tool server’s web address, or the program that starts it.'); return; }
setBusy(true);
try {
const body = { name: draft.name.trim(), about: draft.about.trim(), kind: draft.kind, instructions: draft.instructions, command: draft.command.trim(), address: draft.address.trim(), args: draft.args.split('\n').map(a => a.trim()).filter(Boolean) };
setState(draft.id ? await api.patch<ToolsState>(`/api/agent/tools/custom/${encodeURIComponent(draft.id)}`, body) : await api.post<ToolsState>('/api/agent/tools/custom', body));
setDraft(null); setFormError('');
} catch (e) { setFormError(e instanceof Error ? e.message : 'The tool could not be saved.'); }
finally { setBusy(false); }
}
if (!state) return <div className="stack stack--lg settings-models">{error ? <ErrorNotice message={tr(error)} onRetry={() => void load()} /> : <p className="small muted">{tr('Loading the tool list…')}</p>}</div>;
const keyed = state.search.provider !== 'builtin';
return <div className="stack stack--lg settings-tools">
<div><h2 className="h3">{tr('Tools')}</h2><p className="small muted settings-models__intro">{tr('Choose what the assistant may use in your chats. A change applies from your next message. In Manual mode, anything that changes your computer still asks you first.')}</p></div>
{error ? <ErrorNotice message={tr(error)} onRetry={() => void load()} /> : null}
{AREAS.map(area => <section className="settings-section" key={area.id}>
<h2 className="h4" style={{ marginBottom: 10 }}>{tr(area.title)}</h2>
<div className="st-card st-card--flush">
{state.groups.filter(g => g.area === area.id).map(g => <Field key={g.id} label={tr(g.name)} hint={tr(g.about)}>
<button className="st-toggle" role="switch" aria-checked={g.enabled} aria-label={tr(g.name)} disabled={busy} onClick={() => toggle(g.id, !g.enabled)} />
</Field>)}
</div>
</section>)}
<section className="settings-section">
<h2 className="h4" style={{ marginBottom: 10 }}>{tr('Web search')}</h2>
<div className="st-card st-card--flush">
<Field label={tr('Where results come from')} hint={tr(keyed ? 'Searches use your own account with this service.' : 'Results come from DuckDuckGo. You do not need an account or a key.')}>
<Select ariaLabel={tr('Where results come from')} value={state.search.provider} options={SEARCH_CHOICES} onChange={value => { setKey(''); void save({ search: { provider: value } }); }} />
</Field>
{keyed ? <Field label={tr('Your key')} hint={tr(state.search.keySet ? 'A key is saved on this computer. Enter a new one to replace it.' : 'Saved on this computer only. Strata never shows it again.')}>
<div className="row">
<input className="st-input" style={{ width: 190 }} type="password" aria-label={tr('Your key')} autoComplete="new-password" spellCheck={false} placeholder={tr(state.search.keySet ? 'Leave blank to keep the saved key' : 'Paste your key')} value={key} onChange={e => setKey(e.target.value)} />
<Btn size="sm" disabled={busy || !key.trim()} onClick={() => { void save({ search: { provider: state.search.provider, key: key.trim() } }); setKey(''); pushToast('success', tr('Key saved')); }}>{tr('Save key')}</Btn>
</div>
</Field> : null}
</div>
</section>
<section className="settings-section">
<h2 className="h4" style={{ marginBottom: 10 }}>{tr('Web browser')}</h2>
<div className="st-card st-card--flush">
<Field label={tr('Use a web browser')} hint={tr(state.browser.found ? `The assistant can open pages, click and type in ${state.browser.name ?? 'your browser'}. In Manual mode every action asks first.` : 'Chrome or Edge was not found on this computer. Install one, then come back and turn this on.')}>
<button className="st-toggle" role="switch" aria-checked={state.browser.enabled && state.browser.found} aria-label={tr('Use a web browser')} disabled={busy || !state.browser.found} onClick={() => void save({ browser: { enabled: !state.browser.enabled } })} />
</Field>
</div>
</section>
<section className="settings-section">
<h2 className="h4" style={{ marginBottom: 10 }}>{tr('Your own tools')}</h2>
<p className="small muted" style={{ marginBottom: 10 }}>{tr('Teach the assistant something new: give it instructions to follow, a command to run, or connect a tool server. Commands and servers ask first in Manual mode.')}</p>
{state.custom.length ? <div className="st-card st-card--flush">
{state.custom.map(t => <Field key={t.id} label={tr(t.name)} hint={<>{tr(t.about)} <span className="muted">· {tr(KIND_NAMES[t.kind])}</span></>}>
<div className="row">
<Btn size="sm" disabled={busy} onClick={() => { setFormError(''); setDraft({ id: t.id, name: t.name, about: t.about, kind: t.kind, instructions: t.instructions ?? '', command: t.command ?? '', address: t.address ?? '', args: (t.args ?? []).join('\n') }); }}>{tr('Edit')}</Btn>
<Btn size="sm" disabled={busy} onClick={() => setRemove(t)}>{tr('Remove')}</Btn>
<button className="st-toggle" role="switch" aria-checked={t.enabled} aria-label={tr(t.name)} disabled={busy} onClick={() => void save({ custom: { [t.id]: !t.enabled } })} />
</div>
</Field>)}
</div> : <div className="provider-empty"><Icon name="tool" size={26} /><strong>{tr('No tools of your own yet')}</strong><p className="small muted">{tr('For example: “Write release notes in our house style”, or a command that checks your website is up.')}</p></div>}
<div style={{ marginTop: 12 }}><Btn icon="plus" block onClick={() => { setFormError(''); setDraft(blank()); }}>{tr('Add a tool')}</Btn></div>
</section>
<Dialog open={draft !== null} title={tr(draft?.id ? 'Edit tool' : 'Add a tool')} compact onClose={() => setDraft(null)} actions={<><Btn onClick={() => setDraft(null)}>{tr('Cancel')}</Btn><Btn variant="primary" disabled={busy} onClick={() => void submit()}>{tr('Save tool')}</Btn></>}>
{draft ? <div className="stack">
<label className="input-field"><span>{tr('Name')}</span><input className="st-input" aria-label={tr('Name')} value={draft.name} placeholder={tr('For example: Release notes')} spellCheck={false} onChange={e => setDraft({ ...draft, name: e.target.value })} /></label>
<label className="input-field"><span>{tr('What it does')}</span><input className="st-input" aria-label={tr('What it does')} value={draft.about} placeholder={tr('One sentence. The assistant reads it to decide when to use the tool.')} onChange={e => setDraft({ ...draft, about: e.target.value })} /></label>
<div className="input-field"><span>{tr('How it works')}</span><Select ariaLabel={tr('How it works')} value={draft.kind} options={KIND_CHOICES} onChange={value => setDraft({ ...draft, kind: value as Draft['kind'] })} /></div>
{draft.kind === 'instructions' ? <label className="input-field"><span>{tr('Instructions')}</span><textarea className="st-input" rows={6} aria-label={tr('Instructions')} value={draft.instructions} placeholder={tr('Write what the assistant should do when it uses this tool.')} onChange={e => setDraft({ ...draft, instructions: e.target.value })} /></label> : null}
{draft.kind === 'command' ? <>
<label className="input-field"><span>{tr('Command to run')}</span><input className="st-input" aria-label={tr('Command to run')} value={draft.command} placeholder={tr('For example: curl -I https://example.com')} spellCheck={false} onChange={e => setDraft({ ...draft, command: e.target.value })} /></label>
<p className="small muted">{tr('The assistant can pass text to the command. The command reads it from the STRATA_INPUT setting. Its printed output goes back to the assistant.')}</p>
</> : null}
{draft.kind === 'server' ? <>
<label className="input-field"><span>{tr('Web address or program')}</span><input className="st-input" aria-label={tr('Web address or program')} value={draft.address} placeholder={tr('https://… or the program that starts the server')} spellCheck={false} onChange={e => setDraft({ ...draft, address: e.target.value })} /></label>
<label className="input-field"><span>{tr('Extra settings for the program ')}<span className="muted">{tr('(optional, one per line)')}</span></span><textarea className="st-input" rows={3} aria-label={tr('Extra settings for the program')} value={draft.args} spellCheck={false} onChange={e => setDraft({ ...draft, args: e.target.value })} /></label>
</> : null}
{formError ? <p className="small" role="alert" style={{ color: 'var(--danger, #b3261e)' }}>{tr(formError)}</p> : null}
</div> : null}
</Dialog>
<Dialog open={remove !== null} title={tr('Remove this tool?')} compact onClose={() => setRemove(null)} actions={<><Btn onClick={() => setRemove(null)}>{tr('Keep it')}</Btn><Btn variant="primary" onClick={() => { const id = remove!.id; setRemove(null); void (async () => { try { setState(await api.del<ToolsState>(`/api/agent/tools/custom/${encodeURIComponent(id)}`)); } catch (e) { setError(e instanceof Error ? e.message : 'The tool could not be removed.'); } })(); }}>{tr('Remove')}</Btn></>}>
<p>{tr(remove ? `“${remove.name}” will no longer be available to the assistant.` : '')}</p>
</Dialog>
</div>;
}
+3 -3
View File
@@ -74,7 +74,7 @@ export interface AppState {
shareTelemetry: boolean;
paletteOpen: boolean;
shortcutsOpen: boolean;
settingsSection: 'Appearance' | 'Models' | 'Storage' | 'Engine' | 'About';
settingsSection: 'Appearance' | 'Models' | 'Tools' | 'Storage' | 'Engine' | 'About';
hardware: Hardware | null;
library: ModelLibrary | null;
imageModels: ImageModelLibrary | null;
@@ -1159,7 +1159,7 @@ async function startTimeSkipReal(prompt: string) {
}));
go('chat', sessionId);
try {
const started = await api.post<{ run: TimeSkipJob }>('/api/timeskip/start', { prompt, workspaceId: state.activeWorkspace, attempts: 1 });
const started = await api.post<{ run: TimeSkipJob }>('/api/timeskip/start', { prompt, workspaceId: state.activeWorkspace, attempts: 1, ...(state.remoteModel ? { remoteModel: state.remoteModel } : {}) });
patchRun(sessionId, run.id, r => ({ ...r, job: started.run }));
void followTimeSkip(sessionId, run.id);
} catch (e) {
@@ -1435,7 +1435,7 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean }
if (loopCommand) { await runLoopCommand(loopCommand); return; }
const demoPrompt = timeSkipPrompt(text.trim());
if (demoPrompt !== null) {
if (demoPrompt && nativeState()?.instances.some(i => i.status === 'ready') && !state.remoteModel) void startTimeSkipReal(demoPrompt); else startTimeSkipDemo(demoPrompt);
if (demoPrompt && (state.remoteModel || nativeState()?.instances.some(i => i.status === 'ready'))) void startTimeSkipReal(demoPrompt); else startTimeSkipDemo(demoPrompt);
return;
}
const imageTarget=nativeState()?.instances.find(i=>i.id===nativeState()?.defaultId);const canSendPictures=!state.remoteModel&&imageTarget?.status==='ready'&&imageTarget.vision;
+3 -2
View File
@@ -4,6 +4,7 @@ import { useRef, type ReactNode } from 'react';
import { Btn, Field, Icon, Select, type IconName } from '../components/ui';
import { Brand } from '../components/Brand';
import { SettingsModels } from '../components/SettingsModels';
import { SettingsTools } from '../components/SettingsTools';
import { SettingsStorage } from '../components/SettingsStorage';
import { SettingsUpdates } from '../components/SettingsUpdates';
import { NativeOperations } from '../components/NativeOperations';
@@ -11,7 +12,7 @@ import { FontChoice } from '../components/FontChoice';
import { LANGUAGES } from '../lib/i18n';
import { setLanguage } from '../lib/store';
import { CONTENT_FONT_RANGE, setContentFontSize, setDensity, setFocus, setMotion, setShortcuts, setTheme, setTransparency, setUiScale, UI_SCALES, useStore, setSettingsSection } from '../lib/store';
const PANELS = [{ name: 'Appearance', icon: 'sun', sections: ['General', 'Reading & focus'] }, { name: 'Models', icon: 'models', sections: [] }, { name: 'Storage', icon: 'disk', sections: ['Storage'] }, { name: 'Engine', icon: 'engine', sections: [] }, { name: 'About', icon: 'info', sections: ['About', 'Update', 'Privacy'] }] as const;
const PANELS = [{ name: 'Appearance', icon: 'sun', sections: ['General', 'Reading & focus'] }, { name: 'Models', icon: 'models', sections: [] }, { name: 'Tools', icon: 'tool', sections: [] }, { name: 'Storage', icon: 'disk', sections: ['Storage'] }, { name: 'Engine', icon: 'engine', sections: [] }, { name: 'About', icon: 'info', sections: ['About', 'Update', 'Privacy'] }] as const;
export function SettingsScreen() {
const prefs = useStore(s => s);
const active = prefs.settingsSection;
@@ -53,7 +54,7 @@ export function SettingsScreen() {
</nav>
<div className="settings-pane" ref={scrollRef}>
{tr(PANELS.map(panel => <div key={panel.name} role="tabpanel" tabIndex={0} id={`settings-panel-${panel.name}`} aria-labelledby={`settings-tab-${panel.name}`} hidden={active !== panel.name}>
{tr(panel.name === 'Models' ? <SettingsModels /> : panel.name === 'Engine' && active === panel.name ? <NativeOperations /> : active === panel.name ? <div className="stack stack--lg settings-body">
{tr(panel.name === 'Models' ? <SettingsModels /> : panel.name === 'Tools' ? (active === panel.name ? <SettingsTools /> : null) : panel.name === 'Engine' && active === panel.name ? <NativeOperations /> : active === panel.name ? <div className="stack stack--lg settings-body">
{tr(panel.sections.map(section => <section className="settings-section" key={section}>
<h2 className="h3" style={{ marginBottom: 14 }}>{tr(section)}</h2>
<div className="st-card st-card--flush">