Something went wrong. Try again.
small gleam coding and (not yet) persistent agent daemon with a detachable cli forked from okami.mom/albedo
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536<script lang="ts"> import BrowserSettings from './settings/BrowserSettings.svelte'; import ProvidersSettings from './settings/ProvidersSettings.svelte'; import ConfigurationSettings from './settings/ConfigurationSettings.svelte'; import McpSettings from './settings/McpSettings.svelte'; import { mcp } from './settings/mcp.svelte'; import { settingsNav } from './settingsNav.svelte'; import ExtensionsView from './views/ExtensionsView.svelte'; import { sessions } from './sessions.svelte'; import WebSearchSettings from './settings/WebSearchSettings.svelte'; import WebhooksSettings from './settings/WebhooksSettings.svelte'; import DiscordSettings from './settings/DiscordSettings.svelte';
let { onclose, showHeader = false, }: { onclose: () => void; showHeader?: boolean } = $props(); const sections = [ { id: 'appearance', label: 'appearance', detail: 'Colours, fonts and text size', scope: 'this browser', }, { id: 'layout', label: 'layout', detail: 'Make room for the way you work', scope: 'this browser', }, { id: 'notifications', label: 'notifications', detail: 'Know when your sessions need you', scope: 'this browser', }, { id: 'discord', label: 'discord', detail: 'Bring Discord channels into a session', scope: 'shared daemon', }, { id: 'configuration', label: 'extension config', detail: 'Tools, context and agent limits', scope: 'shared daemon', }, { id: 'extensions', label: 'extensions', detail: 'Enable or disable extensions globally', scope: 'shared daemon', }, { id: 'providers', label: 'providers', detail: 'Who answers, with which account and model', scope: 'shared daemon', }, { id: 'mcp', label: 'MCP servers', detail: 'Tools and services your sessions reach', scope: 'shared daemon', }, { id: 'web-search', label: 'web search', detail: 'Which providers search, and in what order', scope: 'shared daemon', }, { id: 'webhooks', label: 'webhooks', detail: 'Let outside services wake a session', scope: 'shared daemon', }, ] as const; type Section = (typeof sections)[number]['id']; let selected = $state<Section>('appearance'); let visited = $state<Section[]>(['appearance']); let content = $state<HTMLElement>(); let configurationSaving = $state(false); let extensionsSaving = $state(false); /** The session whose own extension choices the extensions tab shows too; none shows the global defaults alone. */ let extensionsSession = $state(''); const pickedSession = $derived( sessions.byId.has(extensionsSession) ? extensionsSession : undefined, ); const saving = $derived(configurationSaving || extensionsSaving); let configurationDirty = $state(false); let confirming = $state(false); let confirmation = $state<HTMLElement>(); const current = $derived( sections.find((section) => section.id === selected)!, ); const dirty = $derived(configurationDirty);
function choose(id: Section) { selected = id; if (!visited.includes(id)) visited = [...visited, id]; confirming = false; content?.scrollTo({ top: 0 }); }
// Another surface (the palette) can ask to open Settings on a section. $effect(() => { if (settingsNav.request) { choose(settingsNav.request as Section); settingsNav.request = null; } });
export function canClose(): boolean { if (saving) return false; if (dirty || mcp.formDirty) { confirming = true; content?.scrollTo({ top: 0 }); return false; } return true; }
export function requestClose() { if (canClose()) onclose(); }
$effect(() => { if (confirming) confirmation?.querySelector<HTMLElement>('button')?.focus(); });
// Editing a field or using section controls must not run canvas shortcuts. function keydown(event: KeyboardEvent) { if (event.ctrlKey || event.metaKey) return; if (event.key === 'Escape' && !confirming) return; event.stopPropagation(); if (event.key === 'Escape') confirming = false; }</script>
{#snippet sessionPicker()} <label class="session-pick"> <span>session</span> <select bind:value={extensionsSession} disabled={extensionsSaving}> <option value="">none</option> {#each sessions.list as session (session.id)}<option value={session.id} >{session.name || 'untitled session'}</option >{/each} </select> </label>{/snippet}
<!-- svelte-ignore a11y_no_noninteractive_element_interactions (only prevents canvas shortcuts while editing) --><section class="settings" aria-label="Settings" onkeydown={keydown}> <div class="page" class:with-header={showHeader}> {#if showHeader}<header> <div class="identity"> <span class="spark" aria-hidden="true">✦</span> <h1 id="settings-title">settings</h1> </div> {#if saving}<span class="saving" role="status">saving settings…</span >{/if} <button class="close" disabled={saving} onclick={requestClose} aria-label="Close settings" title="Close settings (Esc)">×</button > </header>{/if} <nav class="nowheel holds-wheel" aria-label="Settings sections"> <p class="nav-label">your workspace</p> {#each sections as section, index (section.id)} {#if index === 3}<p class="nav-label shared">albedo</p>{/if} <button aria-current={selected === section.id ? 'page' : undefined} onclick={() => choose(section.id)} > {section.label} {#if section.id === 'mcp' && mcp.attention.length}<span class="count" aria-hidden="true">{mcp.attention.length}</span ><span class="visually-hidden" >, {mcp.attention.length} need sign-in</span >{/if} {#if section.id === 'configuration' && configurationDirty}<span class="draft" aria-label="unsaved changes">●</span >{/if} </button> {/each} </nav> <div class="content nowheel" class:fill={selected === 'extensions'} bind:this={content} > <div class="section-heading"> <span class="scope">{current.scope}</span> <h2>{current.label}</h2> </div> {#if confirming} <div class="confirmation" role="alert" bind:this={confirmation}> <strong>leave unsaved changes behind?</strong> <p> Your unsaved edits will be lost. Browser preferences are already kept. </p> <div class="confirmation-actions"> <button onclick={() => (confirming = false)}>keep editing</button> <button class="discard" onclick={onclose} >discard changes and close</button > </div> </div> {/if} {#if selected === 'appearance' || selected === 'layout' || selected === 'notifications'} <BrowserSettings section={selected} /> {/if} {#if visited.includes('extensions')} <section class="fill" hidden={selected !== 'extensions'} aria-label="Extension selection" > <ExtensionsView sessionId={pickedSession} onbusy={(value) => (extensionsSaving = value)} below={sessionPicker} /> </section> {/if} {#if visited.includes('providers')} <section hidden={selected !== 'providers'} aria-label="Providers"> <ProvidersSettings active={selected === 'providers'} /> </section> {/if} {#if visited.includes('web-search')} <section hidden={selected !== 'web-search'} aria-label="Web search providers" > <WebSearchSettings active={selected === 'web-search'} onopen={choose} /> </section> {/if} {#if visited.includes('configuration')} <section hidden={selected !== 'configuration'} aria-label="Daemon extension config" > <ConfigurationSettings scrollRoot={content} ondirty={(value) => (configurationDirty = value)} onbusy={(value) => (configurationSaving = value)} /> </section> {/if} {#if visited.includes('webhooks')} <section hidden={selected !== 'webhooks'} aria-label="Webhooks"> <WebhooksSettings active={selected === 'webhooks'} onopen={choose} /> </section> {/if} {#if visited.includes('discord')} <section hidden={selected !== 'discord'} aria-label="Discord bots"> <DiscordSettings active={selected === 'discord'} onopen={choose} /> </section> {/if} {#if visited.includes('mcp')} <section hidden={selected !== 'mcp'} aria-label="MCP servers"> <McpSettings active={selected === 'mcp'} onopen={choose} /> </section> {/if} </div> </div></section>
<style> .settings { height: 100%; min-height: 0; container: settings / inline-size; color: var(--text); background: var(--surface); } .page { display: grid; grid-template: minmax(0, 1fr) / 180px minmax(0, 1fr); height: 100%; } .page.with-header { grid-template-rows: 66px minmax(0, 1fr); } header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; border-bottom: 1px solid var(--selected); } .identity { display: flex; align-items: center; gap: 10px; } .spark { color: var(--accent); font-size: 22px; } h1 { font-size: calc(16px * var(--ui-scale)); font-weight: 620; margin: 0; letter-spacing: -0.03em; } button { color: inherit; font: inherit; font-size: calc(13px * var(--ui-scale)); cursor: pointer; border: 0; } button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .close { width: 34px; height: 34px; border-radius: 9px; background: var(--field); font-size: 24px; line-height: 1; } .saving { margin-left: auto; margin-right: 12px; color: var(--muted); font-size: calc(12px * var(--ui-scale)); } .close:disabled { opacity: 0.4; cursor: default; } .close:hover { background: var(--selected); } nav { display: flex; flex-direction: column; padding: 26px 14px 20px; background: var(--rail); overflow-y: auto; } .nav-label { margin: 0 12px 10px; color: var(--faint); font-size: calc(11px * var(--ui-scale)); letter-spacing: 0.04em; } .nav-label.shared { margin-top: 28px; } nav button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 12px; text-align: left; border-radius: 8px; background: transparent; } nav button:hover { background: var(--hover); } nav button[aria-current='page'] { color: var(--accent); background: var(--open-tint); font-weight: 600; } .draft { margin-left: auto; color: var(--accent); font-size: 8px; } .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } .count { margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: var(--surface); font-size: calc(11px * var(--ui-scale)); text-align: center; } /* Sections' sticky footers (Save/Revert) span this padding, so they read it. */ .content { --content-pad-x: 40px; --content-pad-bottom: 48px; min-width: 0; padding: 34px var(--content-pad-x) var(--content-pad-bottom); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; } /* The extensions list scrolls inside itself (sticky shelf headings), so the page gives it the height left under the section heading. */ .content.fill { display: flex; flex-direction: column; overflow: hidden; padding-top: 22px; padding-bottom: 0; } .content.fill .section-heading { margin-bottom: 4px; } /* The list pads itself by 18px; pull it out so its rows line up with the heading. */ section.fill:not([hidden]) { flex: 1; min-height: 0; margin: 0 -18px; } .session-pick { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: calc(12px * var(--ui-scale)); } .session-pick select { flex: 1; min-width: 0; font: inherit; color: var(--text); background: var(--field); border: 0; border-radius: 8px; padding: 8px 10px; } .session-pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } .scope { display: inline-block; padding: 4px 7px; border-radius: 5px; background: var(--field); color: var(--muted); font-size: calc(10px * var(--ui-scale)); } h2 { margin: 14px 0 6px; font-size: calc(25px * var(--ui-scale)); font-weight: 600; letter-spacing: -0.035em; } .section-heading { margin-bottom: 26px; }
.confirmation { margin-bottom: 24px; padding: 16px; border: 1px solid var(--danger); border-radius: 10px; font-size: calc(13px * var(--ui-scale)); } .confirmation p { color: var(--muted); line-height: 1.5; } .confirmation-actions { display: flex; flex-wrap: wrap; gap: 8px; } .confirmation button { padding: 8px 12px; background: var(--field); border-radius: 7px; } .confirmation .discard { color: var(--danger); } @container settings (max-width: 700px) { .page { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr); } .page.with-header { grid-template-rows: auto auto minmax(0, 1fr); } header { padding: max(14px, env(safe-area-inset-top)) 18px 14px; } nav { flex-direction: row; gap: 4px; overflow-x: auto; padding: 10px 14px; border-bottom: 1px solid var(--selected); } nav button { width: auto; flex: none; white-space: nowrap; padding: 10px 12px; } .nav-label { display: none; } .content { --content-pad-x: 22px; --content-pad-bottom: max(32px, env(safe-area-inset-bottom)); padding-top: 24px; } h2 { font-size: calc(23px * var(--ui-scale)); } }</style>