diff --git a/robot-docs/web.md b/robot-docs/web.md index 147f726bc..ac37861aa 100644 --- a/robot-docs/web.md +++ b/robot-docs/web.md @@ -84,6 +84,10 @@ The **artifact** (`nodes/ArtifactNode.svelte`, `views/ArtifactView.svelte`, `art A loaded skill (robot-docs/skills.md, loaded skills) shows as a muted `skill · ` line: under the summary of the work stretch whose cell loaded it (`loadedIn` in `transcript.svelte.ts`, drawn by `WorkSteps.svelte`; a cell that did nothing else reads as its python cell in the summary), and in the foot of the user's message for a slash activation (the entry's `skill` JSON part). `SkillsButton.svelte`, a book icon with a count in the title bar, lists the session's loads from `GET /extensions/skills/loads` with each one's scope and when it was last loaded, read again when the session's work stops and when the list opens; it shows nothing until the session has loaded one. +The **extensions** window (`nodes/ExtensionsNode.svelte`, `views/ExtensionsView.svelte`) opens from a session window's menu or the command palette's "session: extensions" action. On the phone, the chat's session menu opens the same view as a page; browser back returns to the chat. The installed catalog supplies five shelves: memory, reach, channels, providers and builtins. Providers and builtins start folded; search includes their contents. Each shelf repeats the all-sessions and this-session column labels, with sticky headings. Own choices tint their rows. Memory strategies use radios, notes remains a separate switch, and "follow all sessions" clears the session's memory overrides. The desktop this-session column uses follow/on/off segments; at phone width it becomes a select and each row stacks its two controls below its name and summary. Clicking a name reveals its description, dependencies, tools, python modules and quarantine reason. + +Choices are confirmed inline. `api.ts` reads the catalog plus the configuration and extension-settings ETags, then conditionally patches the corresponding resource without retrying stale writes. A 412 refreshes the choices and asks the reader to review them. Session writes reload that session and show the applied, skipped or failed result, warnings and any required kernel restart; a saved choice whose reload fails remains visibly saved. Global writes leave open sessions' loaded compositions alone and say to reload them. Loading, saving and errors remain inside the view. + Design rules the client keeps (from the design pass): surfaces separate by a step in tone, not by lines; only what floats (windows, the palette, the view controls, the overview map) casts a shadow; one accent, albedo's mauve by default and editable, used for focus and selection; no status dots; monospace only for code and tool commands. The client shares the terminal's voice. `moods.ts` is a port of `cli/internal/tui/moods.go` (its pools, their order and the seeded FNV-1a pick), so a finished turn signs off with the same kaomoji in both clients: its seed is the turn's last entry time in milliseconds, and its class comes from how long it took. A busy session shows an animated face for what it is doing, read from its phase (`preparing`, `generating`, `running` a tool, `compacting`, `interrupting`; only `idle` is at rest) and the tail of its activity, on one shared 500 ms clock for every face on the page (`live.svelte.ts`). Every frame of the animation sits invisibly under the current one, so a face keeps its width and nothing beside it moves. `burst.ts` writes a turn's thinking and tool calls as the terminal's one past-tense line (`thought 12s · read tui/{chat,moods}.go · ran go test ×2 +12 −3`), from each call's trace, fetched when the line scrolls into view. The browser-local “collapse traces” setting (`prefs.collapseTraces`, off by default) starts every work stretch folded, including live thinking, tools and mid-turn prose. A row the daemon labels `final` (its history `phase`) stays outside the fold and one labelled `commentary` folds into it. An unlabelled row (an older one, or text still streaming) stays outside while it is a turn's newest prose, so a final answer streams in the open; once thinking or a tool call follows, it folds into the work. A folded live line keeps the busy face and newest step’s label; clicking it or revealing a call from the trace opens it and keeps that choice. Speakers are named as in the terminal: "albedo" in mauve, "you" in teal, with "2h later" after a pause of 30 minutes or more. Copy is lowercase, and empty and error states carry a face. The canvas has sparse dots (3 px every 36 px, about 1.8:1 on the ground in both themes) that merge rather than fade as the view zooms out (`Dots.svelte`): between 100% and 50% every other dot dissolves into its neighbours, leaving the grid as it looked at 100%, and so on a level up, so the dots on screen stay 18 to 36 px apart and 3 px across at any zoom. diff --git a/web/src/App.svelte b/web/src/App.svelte index 8b36901dc..e1c62d2b0 100644 --- a/web/src/App.svelte +++ b/web/src/App.svelte @@ -184,6 +184,7 @@ { category: 'canvas', label: 'toggle overview map', hint: 'M', canvas: true, run: () => boards.board?.toggleMap() }, { category: 'session', label: 'toggle sidebar', hint: '[', run: () => (railOpen = !railOpen) }, { category: 'session', label: 'filter', hint: '/', run: () => focusFilter() }, + { category: 'session', label: 'extensions', run: openExtensions }, { category: 'session', label: 'refresh', hint: 'R', run: () => sessions.refresh() }, { category: 'settings', label: 'open', hint: shortcut(','), run: () => (settingsOpen = true) }, { category: 'theme', label: 'follow the system', run: () => (prefs.theme = 'system') }, @@ -247,6 +248,14 @@ return query ? [...found, ...artifactItems(query).slice(0, 20), ...actions] : [...found, ...actions]; } + function openExtensions() { + const board = boards.board; + const parent = board?.selected; + const session = parent && board?.sessionOf(parent); + if (session) board?.openExtensions(session, parent); + else say('select a session first'); + } + /** The palette's search: everything, or after `>` only commands, after `@` only sessions, as in VS Code's quick open. */ function searchPalette(query: string): Item[] { const [mark, rest] = [query[0], query.slice(1).trimStart()]; diff --git a/web/src/lib/api.ts b/web/src/lib/api.ts index 07ca97076..f17637e77 100644 --- a/web/src/lib/api.ts +++ b/web/src/lib/api.ts @@ -122,6 +122,38 @@ export async function listCompactionStrategies(sessionId: string, signal?: Abort return (catalog.discovery?.candidates ?? []).filter((c) => c.extension?.plugins.includes('compaction')); } +export interface ExtensionChoices { + candidates: CatalogCandidate[]; + sessionETag: string; + globalETag: string; +} + +/** The installed extensions and the validators for the two choice columns. */ +export async function extensionChoices(sessionId: string, signal?: AbortSignal): Promise { + const [configuration, settings] = await Promise.all([ + fetch(`/api/sessions/${sessionId}?view=configuration`, { signal }), + fetch('/api/settings?group=extensions', { signal }), + ]); + for (const response of [configuration, settings]) if (!response.ok) throw await failure(response); + const candidates: CatalogCandidate[] = []; + let next: string | null = null; + do { + const page: components['schemas']['Catalog'] = await get(`/sessions/${sessionId}/catalog?kind=extensions&limit=200${next ? `&next=${encodeURIComponent(next)}` : ''}`, signal); + if (page.discovery_failure) throw new Error(page.discovery_failure.detail); + candidates.push(...(page.discovery?.candidates ?? [])); + next = page.discovery?.next ?? null; + } while (next); + return { candidates, sessionETag: configuration.headers.get('etag') ?? '', globalETag: settings.headers.get('etag') ?? '' }; +} + +/** Saves against the choices on screen; stale choices are never retried. */ +export function selectExtensions(sessionId: string, scope: 'global' | 'session', choices: Record, etag: string): Promise { + return request('PATCH', scope === 'global' ? '/settings?group=extensions' : `/sessions/${sessionId}?view=configuration`, { + body: scope === 'global' ? { defaults: choices } : { selection: { extensions: choices } }, + headers: { 'content-type': 'application/merge-patch+json', 'if-match': etag }, + }); +} + /** The sessions a session started: its child agents, with their own status. */ export function listChildren(sessionId: string, signal?: AbortSignal): Promise { return get>(`/sessions?parent_id=${encodeURIComponent(sessionId)}&limit=200`, signal).then((page) => page.items); diff --git a/web/src/lib/board.svelte.ts b/web/src/lib/board.svelte.ts index c78870732..73cd29c4c 100644 --- a/web/src/lib/board.svelte.ts +++ b/web/src/lib/board.svelte.ts @@ -78,6 +78,8 @@ export type PtyWindow = Of<'pty', { terminalId: string; sessionId?: string; cwd? * types again, with `earlier` of the turns before it. */ export type TraceWindow = Of<'trace', { sessionId: string; from: number; earlier?: number; parent?: string; zoom?: number }>; +/** The installed extensions and this session's saved choices. */ +export type ExtensionsWindow = Of<'extensions', { sessionId: string; parent?: string; zoom?: number }>; /** The agents of the family whose root is `sessionId`, as a tree. */ export type AgentsWindow = Of<'agents', { sessionId: string; parent?: string; fit?: { width: number; height: number }; zoom?: number }>; /** @@ -109,7 +111,7 @@ export type Target = * its own button. */ export type NoteWindow = Of<'note', { text: string; target?: Target; sent?: boolean; alone?: boolean; zoom?: number }>; -export type Window = SessionWindow | ReviewWindow | TerminalWindow | ShellCommandWindow | TraceWindow | AgentsWindow | ArtifactWindow | ChipWindow | NoteWindow | PtyWindow; +export type Window = SessionWindow | ReviewWindow | TerminalWindow | ShellCommandWindow | TraceWindow | AgentsWindow | ExtensionsWindow | ArtifactWindow | ChipWindow | NoteWindow | PtyWindow; export type WindowType = Window['type']; type DataOf = Extract['data']; export type Place = 'canvas' | 'float' | 'tab' | 'group' | 'tile'; @@ -612,6 +614,10 @@ export class Board { this.#open({ id: `session:${sessionId}`, type: 'session', data: parent ? { sessionId, parent } : { sessionId } }); } + openExtensions(sessionId: string, parent?: string) { + this.#open({ id: `extensions:${sessionId}`, type: 'extensions', data: { sessionId, parent } }, 820); + } + /** Opens the tree of a family's agents beside the window it was asked from. */ openAgents(rootId: string, parent?: string) { const id = `agents:${rootId}`; diff --git a/web/src/lib/chat/Chat.svelte b/web/src/lib/chat/Chat.svelte index b2b698cdd..acfa1e58c 100644 --- a/web/src/lib/chat/Chat.svelte +++ b/web/src/lib/chat/Chat.svelte @@ -77,6 +77,8 @@ import SkillsButton from '../SkillsButton.svelte'; import JobsButton from '../JobsButton.svelte'; import { headline } from '../jobs.svelte'; + import ExtensionsView from '../views/ExtensionsView.svelte'; + import MenuButton from '../MenuButton.svelte'; import ContextChip from './ContextChip.svelte'; import ModelPicker from './ModelPicker.svelte'; import { catalogue, invoke, type Command } from '../commands'; @@ -114,6 +116,22 @@ onback?: () => void; } = $props(); + let extensionsBack = $state(); + let extensionsOpen = $state(false); + $effect(() => { + if (extensionsOpen) extensionsBack?.focus({ preventScroll: true }); + }); + let sessionMenu = $state(false); + function openExtensions() { + history.pushState({ ...history.state, sheet: 'extensions' }, ''); + extensionsOpen = true; + sessionMenu = false; + } + function closeExtensions() { + if (history.state?.sheet === 'extensions') history.back(); + else extensionsOpen = false; + } + /** The phone's diff client, open as a sheet over the chat. */ let shown = $state<{ at: string; turnId: string; from: number; scope: Scope; jump?: { path: string; at: number } } | null>(null); /** A job's output opened inside the phone's chat, where there is no canvas to put a window on. */ @@ -156,6 +174,7 @@ if (!inline) return; const back = () => { if (history.state?.sheet !== 'changes') shown = null; + if (history.state?.sheet !== 'extensions') extensionsOpen = false; }; addEventListener('popstate', back); return () => removeEventListener('popstate', back); @@ -519,7 +538,19 @@ } -
+{#if extensionsOpen} +
+
+ +

extensions

+
+ +
+{/if} + +
{#if inline && !full}
{#if onback} @@ -532,6 +563,10 @@ {/if} + + {#snippet icon()}{/snippet} +
  • +
    openArtifact({ id: found.id, version: found.version, title: found.title })} /> @@ -749,6 +784,38 @@ {/snippet}