diff --git a/docs/decisions/2026-11-17-open-dashboard-from-terminal-onboarding.md b/docs/decisions/2026-11-17-open-dashboard-from-terminal-onboarding.md new file mode 100644 index 00000000..d101f760 --- /dev/null +++ b/docs/decisions/2026-11-17-open-dashboard-from-terminal-onboarding.md @@ -0,0 +1,13 @@ +--- +date: 2026-11-17 +title: "Open the dashboard from terminal onboarding" +--- + +# Open the dashboard from terminal onboarding + +- **Context:** The terminal's final Skip setup action could open the download waiting screen or wait for manual setup to load the selected model and start the API. +- **Decision:** Label the final action Go to dashboard and use `setup.manual` with `restore_selected: false`. Keep any active model preparation attached to the dashboard and retire its terminal setup view when the download finishes. +- **Consequences:** The dashboard opens after the completion record is saved, even while model preparation runs. Loading a model remains an explicit action on the dashboard or in the connection guide. +- **Alternatives:** Automatically loading when the download finishes would still start inference or the API after choosing a navigation-only action. +- **Owner:** team. +- **Links:** [Save dashboard exit without starting a model](2026-11-17-save-dashboard-exit-without-starting-model.md). diff --git a/docs/decisions/2026-11-17-open-dashboard-from-web-onboarding.md b/docs/decisions/2026-11-17-open-dashboard-from-web-onboarding.md new file mode 100644 index 00000000..20e806fd --- /dev/null +++ b/docs/decisions/2026-11-17-open-dashboard-from-web-onboarding.md @@ -0,0 +1,10 @@ +--- +date: 2026-11-17 +title: "Open the dashboard from the final web onboarding step" +--- + +# Open the dashboard from the final web onboarding step + +- **Context:** The final step used the same Skip setup action as earlier steps. With a pending model, it showed the waiting screen even when the user wanted to leave setup. +- **Decision:** Offer Go to dashboard on the final step and finish manual setup through the existing operation. Downloads continue while the dashboard is open. The endpoint and agent choices still show the waiting screen when the chosen model is pending. +- **Owner:** team. diff --git a/docs/decisions/2026-11-17-open-web-onboarding-at-the-first-action.md b/docs/decisions/2026-11-17-open-web-onboarding-at-the-first-action.md new file mode 100644 index 00000000..5c3a2d3f --- /dev/null +++ b/docs/decisions/2026-11-17-open-web-onboarding-at-the-first-action.md @@ -0,0 +1,11 @@ +--- +date: 2026-11-17 +title: "Open web onboarding at the first action" +--- + +# Open web onboarding at the first action + +- **Context:** The welcome page required a click after the startup check had already determined which setup step was needed. +- **Decision:** Open the model step when an engine is active and the engine chooser otherwise. Show a status while checking setup and keep the connection retry on failure. +- **Consequences:** The initial chooser has no Back action. The chooser opened from model selection still returns there. Existing setup and download records still determine where to resume. +- **Owner:** team. diff --git a/docs/decisions/2026-11-17-pair-terminal-connection-engines-with-models.md b/docs/decisions/2026-11-17-pair-terminal-connection-engines-with-models.md new file mode 100644 index 00000000..e738307e --- /dev/null +++ b/docs/decisions/2026-11-17-pair-terminal-connection-engines-with-models.md @@ -0,0 +1,12 @@ +--- +date: 2026-11-17 +title: "Pair terminal connection engines with models" +--- + +# Pair terminal connection engines with models + +- **Context:** The terminal connection guide listed compatibility for one model in the engine field and every downloaded model in the model field. The two fields could describe different runtime choices. +- **Decision:** Offer engines reported active by the server that have a compatible downloaded model. Filter the model field by the chosen engine, clear a model that no longer fits, and recheck the engine before loading the chosen pair. +- **Consequences:** A downloaded FastFlowLM model appears under FastFlowLM when that engine is installed. Model downloads already selected in onboarding can still show their progress in the guide. +- **Alternatives:** Deriving both fields from a single model would hide installed engines for other formats. Treating compatibility as installation would expose engines that cannot load the model yet. +- **Owner:** team. diff --git a/docs/decisions/2026-11-17-save-dashboard-exit-without-starting-model.md b/docs/decisions/2026-11-17-save-dashboard-exit-without-starting-model.md new file mode 100644 index 00000000..c87f6c19 --- /dev/null +++ b/docs/decisions/2026-11-17-save-dashboard-exit-without-starting-model.md @@ -0,0 +1,11 @@ +--- +date: 2026-11-17 +title: "Save dashboard exit without starting a model" +--- + +# Save dashboard exit without starting a model + +- **Context:** Go to dashboard awaited the manual setup operation. When the selected model became available that operation could load the model and start the API before returning. +- **Decision:** Let manual setup callers pass `restore_selected: false` to record completion only. Use that option for the final web dashboard action. Callers that omit the option retain the existing restoration behavior. +- **Consequences:** Opening the dashboard waits for the setup record to be saved. Model downloads continue and the selected model is available for an explicit start from the dashboard. +- **Owner:** team. diff --git a/docs/decisions/2026-11-17-separate-web-onboarding-engine-and-model-actions.md b/docs/decisions/2026-11-17-separate-web-onboarding-engine-and-model-actions.md new file mode 100644 index 00000000..39a5e2f5 --- /dev/null +++ b/docs/decisions/2026-11-17-separate-web-onboarding-engine-and-model-actions.md @@ -0,0 +1,12 @@ +--- +date: 2026-11-17 +title: "Give web onboarding one active engine or model step" +--- + +# 2026-11-17 — Give web onboarding one active engine or model step + +- **Context:** Returning from first-model selection showed the engine chooser over a still-visible catalog. FastFlowLM and GenieX shared the Catalog's inline download view, so their review appeared below the wizard's forward action. Closing engine settings left the model review with the compatibility verdict it had read before setup. +- **Decision:** Show the engine chooser as a full-page step and retain the model view in memory so dismissing the chooser restores the selection. Open FastFlowLM and GenieX reviews with the same dialog frame as other variant engines. After engine settings close, re-read the selected model's compatibility and keep the chosen variant if still available. +- **Consequences:** The engine chooser reports an active FastFlowLM build as installed. The model review uses the core's variant verdict to decide whether to offer setup or download. Catalog rows keep their inline controls. +- **Alternatives:** Keeping the runtime model review inline would require integrating variant selection, setup and download into the first-model footer and displacing the catalog on short windows. +- **Owner:** team. diff --git a/docs/decisions/2026-11-17-share-workspace-ui-with-web-onboarding.md b/docs/decisions/2026-11-17-share-workspace-ui-with-web-onboarding.md new file mode 100644 index 00000000..73748a67 --- /dev/null +++ b/docs/decisions/2026-11-17-share-workspace-ui-with-web-onboarding.md @@ -0,0 +1,12 @@ +--- +date: 2026-11-17 +title: "Use the workspace UI for web onboarding" +--- + +# 2026-11-17 — Use the workspace UI for web onboarding + +- **Context:** The intro and wizard came from separate desktop previews. They used their own colors, competing scroll regions and a second provider editor. The optional browser notification step added confirmation dialogs to both choices. +- **Decision:** Build the wizard on the workspace theme, header, settings fields and action buttons. Share directory rows with the engine catalog and open credentials in the Catalog's provider dialog. Give each step one scrolling body and a fixed footer. A dedicated Continue action advances optional steps. The explicit notification action calls the browser directly and shows its result inline. +- **Consequences:** Desktop shows the current step in a rail. Narrow windows reserve the width for the active step. Provider credentials are entered only after selecting a provider. The download reminder, download controls, model compatibility, and server and agent handoffs keep their existing operations. +- **Alternatives:** Restyling the inline provider editor would preserve a second focus and credential flow with a toolbar inside a scrolling grid. Reusing the Catalog dialog makes cancellation and error handling the same in both places. +- **Owner:** team. diff --git a/docs/decisions/INDEX.md b/docs/decisions/INDEX.md index c0feaa3d..44381685 100644 --- a/docs/decisions/INDEX.md +++ b/docs/decisions/INDEX.md @@ -11,6 +11,20 @@ add a new one that says which record it supersedes. ## Records +- **2026-11-17** — [Pair terminal connection engines with models](2026-11-17-pair-terminal-connection-engines-with-models.md) — filter the connection guide by active engines and compatible downloads. + +- **2026-11-17** — [Open the dashboard from terminal onboarding](2026-11-17-open-dashboard-from-terminal-onboarding.md) — save completion and let downloads continue without loading the selected model. + +- **2026-11-17** — [Save dashboard exit without starting a model](2026-11-17-save-dashboard-exit-without-starting-model.md) — record completion before navigating without loading the selected model. + +- **2026-11-17** — [Open the dashboard from the final web onboarding step](2026-11-17-open-dashboard-from-web-onboarding.md) — offer direct dashboard access while downloads continue. + +- **2026-11-17** — [Open web onboarding at the first action](2026-11-17-open-web-onboarding-at-the-first-action.md) — start on model selection or engine selection based on the server's active builds. + +- **2026-11-17** — [Use the workspace UI for web onboarding](2026-11-17-share-workspace-ui-with-web-onboarding.md) — shared theme, directory rows and provider dialogs with one scroll area and stable navigation. + +- **2026-11-17** — [Give web onboarding one active engine or model step](2026-11-17-separate-web-onboarding-engine-and-model-actions.md) — full-page engine choice, dismissible FastFlowLM and GenieX review and refreshed model compatibility. + - **2026-11-12** — [Preserve Foundry Local tool markers](2026-11-12-preserve-foundry-tool-markers.md) — save the resolver's pair in new installations and use core 0.23.4 for the Foundry host and existing models. - **2026-11-11** — [Check Foundry Local runtime requirements before transferring models](2026-11-11-check-foundry-runtime-before-transferring-models.md) — check the planned revision and preserve its minimum and partial bytes across retries. diff --git a/docs/desktop-flow-parity.md b/docs/desktop-flow-parity.md index c4126254..79be8450 100644 --- a/docs/desktop-flow-parity.md +++ b/docs/desktop-flow-parity.md @@ -7,9 +7,9 @@ Reference: the owner-selected `atomic-chat-ui` redesign at **5043013**, inspecte | Reference | Atomic Server web | Atomic Server terminal | | --- | --- | --- | | `preview/onboarding/Onboarding.tsx`: model-first setup | Installed models and model choices; selection starts the checked download without a confirmation screen | Installed choices scroll with focus; model cards start the recommended download; Versions is a control on each card | -| Onboarding download strip above the heading/content | Live model/status/progress/ETA strip at the top | ASCII download frame above the heading/content on cloud and media steps; direct pause/resume and removal remain clickable | -| Onboarding fixed footer | Back and Skip setup; forward Skip/Continue above the footer | Bottom Back and Skip setup, with a larger inverted Skip/Continue action above them | -| Cloud step | Scrollable provider cards with marks; selected provider form; key-first connection check; muted Connected state | Scrollable ASCII provider cards; masked key editor; checking animation; muted Connected tag; optional Connection options | +| Onboarding download strip above the heading/content | Model and transfer status in the shared workspace header, with progress and controls in Downloads | ASCII download frame above the heading/content on cloud and media steps; direct pause/resume and removal remain clickable | +| Onboarding fixed footer | Back, Skip setup and Continue stay in the same footer. The waiting screen offers Open control panel. | Bottom Back and Skip setup, with a larger inverted Skip/Continue action above them | +| Cloud step | Catalog provider cards share the step's scroll area and open the Catalog credential dialog on selection | Scrollable ASCII provider cards; masked key editor; checking animation; muted Connected tag; optional Connection options | | Optional image/video step | Image/video cards with model selection and Add to queue; confirmed queue removal | Two image/video cards with ASCII animation, model dropdowns and Add to queue; confirmed queue removal. Side by side when wide; stacked or scrollable when compact | | Purpose/handoff | Configure an agent, configure an endpoint, or manual setup | Agent and endpoint ASCII choice cards, manual setup action, and agent marks | | `containers/server-concept/Setup.tsx`: agent/model/endpoint configuration | Supported agent catalog, model and engine selection, port, configure/retry/success | Scrollable agent cards and model/engine dropdowns; download frame above the content; changing a model returns to the preserved connection step | @@ -28,7 +28,7 @@ Reference: the owner-selected `atomic-chat-ui` redesign at **5043013**, inspecte ## Server-specific behavior -- First use starts with Choose engine. Installation shows real transfer progress; Press any key becomes available after installation. Returning or resumable profiles go directly to the saved workspace. +- Web first use opens the model catalog when an engine is active and the engine chooser otherwise. The terminal retains its keyboard intro. Returning or resumable profiles go directly to the saved workspace. - The server owns downloads. Switching screens or closing a client does not cancel them. Pause retains partial files; Remove requests confirmation and discards that download's unshared partial assets. Delete is distinct and requires confirmation. - Provider connection is checked before a Connected state appears. Model IDs can be discovered from the provider's compatible model-list endpoint; endpoint/model overrides are optional. Native-only provider APIs need a compatible gateway. - Agent/endpoint preparation loads the model, prepares credentials, starts the API and tests inference. Failures remain on the same flow with a retry. A new model selection preserves the agent, endpoint and connection step. @@ -62,9 +62,9 @@ The real macOS arm64 PTY test covers a fresh profile's engine gate, returning-pr ## Control parity follow-up -The current pass also uses the reference Inter/Studio fonts, rich model/engine -identity menus, paired connection fields and summary, inline onboarding provider -credentials, responsive tile grids, and desktop-width sidebar collapse. HTTPS +The web workspace and its first-run screens use the reference Inter/Studio fonts, shared provider forms, +rich model/engine identity menus, paired connection fields and summary, responsive tile grids, and +desktop-width sidebar collapse. HTTPS proxy stays within the Server context and edits the supported outgoing-download proxy settings. It does not imply that the server has the prototype's proxy-test or separate password APIs. diff --git a/packages/admin-ui/LIFTED.md b/packages/admin-ui/LIFTED.md index efac8963..3d3ae5f1 100644 --- a/packages/admin-ui/LIFTED.md +++ b/packages/admin-ui/LIFTED.md @@ -36,7 +36,7 @@ The following flow adaptations use the owner's local `atomic-chat-ui` redesign ( | `src/workspace/WorkspaceNavigation.tsx` | `web-app/src/components/left-sidebar/NavigationRail.tsx`, `containers/ServerSidebar.tsx`, `SettingsMenu.tsx` | Server sections and a secondary Playground | | `../../src/contract/desktop-flows.ts` | `Atomic-Chat/web-app/src/constants/integrations.ts` @ `5043013` | Agent names/order shared with TUI; existing Claude wire ID retained | -The intro logo `src/workspace/intro/atomic-logo.png` is copied from the selected desktop redesign's `web-app/public/images/transparent-logo.png` at `c9fa1e66` plus local preview changes. `IntroScreen.tsx` itself is local: its animation and layout are this package's CSS. +The intro logo `src/workspace/intro/atomic-logo.png` is copied from the selected desktop redesign's `web-app/public/images/transparent-logo.png` at `c9fa1e66` plus local preview changes. Cloud connection cards and their editor in `src/workspace/library/cloud/CloudProviders.tsx` follow `web-app/src/preview/onboarding/Onboarding.tsx` at `1c01e2a`, with real server validation replacing the @@ -98,7 +98,7 @@ at `5043013`. They are bundled locally and declared in `desktop-parity.css` so t Server control-panel tint, running-border animation, agent-card rhythm and settings/connection composition follow `containers/server-control-panel.css` and `containers/server-concept/{desktop,setup-details}.css` at the same revision. -- `workspace/library/cloud/CloudProviderEditor.tsx`, `CloudProviderDialog.tsx`, `onboarding-providers.css`, `workspace/setup/OptionalMediaDownload.tsx`: desktop `preview/onboarding/Onboarding.tsx` and `onboarding.css` @ `5043013`; inline onboarding credentials, scrollable provider tiles, live validation and separate media pause/remove actions. `workspace/library/catalog/catalog-table.css` follows `containers/hub/LocalModelTable.tsx` at the same revision; native responsive table styling split from `catalog-desktop.css`. +- `workspace/library/cloud/CloudProviderEditor.tsx`, `CloudProviderDialog.tsx`, `workspace/setup/OptionalMediaDownload.tsx`: desktop `preview/onboarding/Onboarding.tsx` and `onboarding.css` @ `5043013`; shared provider dialogs, live validation and separate media pause/remove actions. `workspace/library/catalog/catalog-table.css` follows `containers/hub/LocalModelTable.tsx` at the same revision; native responsive table styling split from `catalog-desktop.css`. `workspace/styles/desktop-controls.css` adapts the native control geometry in `web-app/src/containers/server-concept/desktop.css` @ `5043013`: pill actions, diff --git a/packages/admin-ui/src/workspace/DirectoryRow.tsx b/packages/admin-ui/src/workspace/DirectoryRow.tsx new file mode 100644 index 00000000..adaaff89 --- /dev/null +++ b/packages/admin-ui/src/workspace/DirectoryRow.tsx @@ -0,0 +1,27 @@ +import type { ComponentProps, ReactNode } from 'react' +import './styles/directory.css' + +export function DirectoryRow({ + title, + detail, + leading, + trailing, + className = '', + ...button +}: Omit, 'title' | 'children'> & { + title: ReactNode + detail?: ReactNode + leading?: ReactNode + trailing?: ReactNode +}) { + return ( + + ) +} diff --git a/packages/admin-ui/src/workspace/WorkspaceApp.tsx b/packages/admin-ui/src/workspace/WorkspaceApp.tsx index 3250632c..53cccd93 100644 --- a/packages/admin-ui/src/workspace/WorkspaceApp.tsx +++ b/packages/admin-ui/src/workspace/WorkspaceApp.tsx @@ -40,7 +40,14 @@ import './styles/secondary-forms.css' export function WorkspaceApp() { const [intro, setIntro] = useState(true) - return intro ? setIntro(false)} /> : + const theme = useThemeStore((state) => state.theme) + return intro ? ( +
+ setIntro(false)} /> +
+ ) : ( + + ) } function WorkspaceContent() { const theme = useThemeStore((state) => state.theme) diff --git a/packages/admin-ui/src/workspace/bug-hunt.test.tsx b/packages/admin-ui/src/workspace/bug-hunt.test.tsx index be7f5197..f81cefa5 100644 --- a/packages/admin-ui/src/workspace/bug-hunt.test.tsx +++ b/packages/admin-ui/src/workspace/bug-hunt.test.tsx @@ -142,10 +142,9 @@ it('keeps the server on the network the person chose when an agent connection is } render() await userEvent.click(await screen.findByRole('button', { name: 'Continue' })) - await userEvent.click(screen.getByRole('button', { name: 'Skip', exact: true })) - await userEvent.click(screen.getByRole('button', { name: 'Continue without permissions' })) - await userEvent.click(screen.getByRole('button', { name: 'Skip', exact: true })) - await userEvent.click(screen.getByRole('button', { name: 'Skip', exact: true })) + await userEvent.click(screen.getByRole('button', { name: 'Continue', exact: true })) + await userEvent.click(screen.getByRole('button', { name: 'Continue', exact: true })) + await userEvent.click(screen.getByRole('button', { name: 'Continue', exact: true })) await userEvent.click(screen.getByRole('button', { name: /Connect an agent/ })) await userEvent.click( within(screen.getByRole('heading', { name: 'Codex CLI' }).closest('article')!).getByRole('button', { diff --git a/packages/admin-ui/src/workspace/intro/EngineChooser.tsx b/packages/admin-ui/src/workspace/intro/EngineChooser.tsx index 58246812..f6391f4a 100644 --- a/packages/admin-ui/src/workspace/intro/EngineChooser.tsx +++ b/packages/admin-ui/src/workspace/intro/EngineChooser.tsx @@ -6,6 +6,12 @@ import { record, rows, text } from '../types' import type { RecordValue } from '../types' import { useDialog } from '../useDialog' import { EngineSetup } from '../library/engines/EngineSetup' +import { ChevronRight } from 'lucide-react' +import { Action, Empty } from '../Controls' +import { DirectoryRow } from '../DirectoryRow' +import { WorkspaceBrand } from '../WorkspaceBrand' +import { FloatingDownloads } from '../library/downloads/FloatingDownloads' +import '../setup/onboarding.css' /** Managed engines explain prerequisites in their plan, even before a runtime is installed. */ const offered = (e: RecordValue) => @@ -25,7 +31,7 @@ export function EngineChooser({ }: { workspace: Workspace onContinue: () => void - onBack: () => void + onBack?: () => void onLater?: () => void }) { const [engines, setEngines] = useState([]) @@ -37,7 +43,7 @@ export function EngineChooser({ const { execute } = w const dialog = useDialog( () => { - if (!busy) onBack() + if (!busy) onBack?.() }, true, { dismissOnOutside: false } @@ -85,41 +91,75 @@ export function EngineChooser({ } } return ( -
+
-

Choose your engine

-
- {engines.map((e) => ( - - ))} -
- {loading &&

Finding compatible engines…

} - {!loading && !engines.length && !error &&

No compatible engines available.

} - {busy &&

Preparing your engine…

} - {error && ( - <> -

{error}

- - - )} - - {onLater && ( - - )} +
+ + +
+
+

Choose your engine

+

+ The engine determines which local models you can run. +

+ {loading && Finding compatible engines…} + {!loading && !engines.length && !error && No compatible engines available.} + {busy &&

Preparing your engine…

} + {error && ( +
+

+ {error} +

+ setRetry((v) => v + 1)}>Retry +
+ )} + {engines.length > 0 && ( +
    + {engines.map((e) => { + const engine = text(e.engine) + const status = e.active + ? engine === 'fastflowlm' + ? 'Build installed' + : 'Installed' + : engineFamily(engine) === 'managed' + ? 'Review requirements' + : 'Available to install' + return ( +
  • + {status}} + disabled={busy || loading} + onClick={() => choose(e)} + trailing={
  • + ) + })} +
+ )} +
+
+ {onBack && ( + + Back + + )} + {onLater && ( + + Set up later + + )} +
{panel && ( ) - fireEvent.click(await screen.findByRole('button', { name: 'Choose engine' })) fireEvent.click(await screen.findByRole('button', { name, exact: true })) await waitFor(() => expect(next).toHaveBeenCalledOnce()) expect(fixture.execute).toHaveBeenCalledWith('engines.enqueue', { engine, select: true }) @@ -28,7 +27,6 @@ it('does not offer FastFlowLM when the core has no compatible build', async () = { setup: null } ).workspace render() - fireEvent.click(await screen.findByRole('button', { name: 'Choose engine' })) await screen.findByText('No compatible engines available.') expect(screen.queryByRole('button', { name: 'FastFlowLM' })).not.toBeInTheDocument() }) @@ -48,10 +46,6 @@ it('queues the chosen engine and proceeds before the background installation com workspace = fixture.workspace const next = vi.fn() const view = render() - const choose = await screen.findByRole('button', { name: 'Choose engine' }) - fireEvent.keyDown(window, { key: 'Enter', repeat: true }) - expect(screen.queryByRole('heading', { name: 'Choose your engine' })).not.toBeInTheDocument() - fireEvent.click(choose) fireEvent.click(await screen.findByRole('button', { name: 'llama.cpp', exact: true })) expect(next).not.toHaveBeenCalled() await act(async () => accept()) @@ -78,10 +72,9 @@ it('keeps a rejected queue request in the chooser and permits retry', async () = workspace = fixture.workspace const next = vi.fn() render() - fireEvent.click(await screen.findByRole('button', { name: 'Choose engine' })) fireEvent.click(await screen.findByRole('button', { name: 'llama.cpp', exact: true })) expect(await screen.findByRole('alert')).toHaveTextContent('Download unavailable') - expect(screen.queryByRole('button', { name: 'Press any key' })).not.toBeInTheDocument() + expect(screen.queryByRole('button', { name: 'Continue', exact: true })).not.toBeInTheDocument() failed = false fireEvent.click(screen.getByRole('button', { name: 'llama.cpp', exact: true })) await waitFor(() => expect(next).toHaveBeenCalledOnce()) @@ -91,19 +84,18 @@ it('opens a returning user directly without replaying the intro', async () => { const next = vi.fn() render() await waitFor(() => expect(next).toHaveBeenCalledOnce()) - expect(screen.queryByRole('button', { name: 'Press any key' })).not.toBeInTheDocument() + expect(screen.queryByRole('button', { name: 'Continue', exact: true })).not.toBeInTheDocument() }) -it('waits at the intro when an engine exists but onboarding has not started', async () => { +it('goes straight to model setup when an engine is already active', async () => { workspace = workspaceFixture( { 'engines.list': enginesList(['llamacpp-upstream']) }, { setup: null } ).workspace const next = vi.fn() render() - await screen.findByRole('button', { name: 'Press any key' }) - expect(next).not.toHaveBeenCalled() - fireEvent.keyDown(window, { key: 'x' }) - expect(next).toHaveBeenCalledOnce() + await waitFor(() => expect(next).toHaveBeenCalledOnce()) + expect(screen.queryByRole('button', { name: 'Continue', exact: true })).not.toBeInTheDocument() + expect(screen.queryByRole('dialog', { name: 'Choose your engine' })).not.toBeInTheDocument() }) it('resumes unfinished model setup directly', async () => { workspace = workspaceFixture({}, { setup: null, setups: [{ id: 'job', stage: 'paused' }] }).workspace @@ -119,7 +111,6 @@ it('leaves an open engine chooser when another client completes onboarding', asy ).workspace const next = vi.fn() const view = render() - fireEvent.click(await screen.findByRole('button', { name: 'Choose engine' })) await screen.findByRole('heading', { name: 'Choose your engine' }) workspace.snapshot = { ...workspace.snapshot!, setup: { mode: 'manual', complete: true, updated_at: 2 } } view.rerender() @@ -147,7 +138,7 @@ it('leaves checking immediately when setup completes during an engine-list reque expect(next).toHaveBeenCalledOnce() }) -it('returns from the engine picker to the focused intro without installing or skipping setup', async () => { +it('starts at the chooser and lets the user defer setup explicitly', async () => { const fixture = workspaceFixture( { 'engines.list': enginesList(['llamacpp-upstream'], []) }, { setup: null } @@ -155,19 +146,12 @@ it('returns from the engine picker to the focused intro without installing or sk workspace = fixture.workspace const next = vi.fn() render() - fireEvent.click(await screen.findByRole('button', { name: 'Choose engine' })) const engine = await screen.findByRole('button', { name: 'llama.cpp', exact: true }) - engine.focus() fireEvent.keyDown(engine, { key: 'Escape' }) - expect(screen.getByRole('heading', { name: 'Atomic Server' })).toBeVisible() - expect(screen.getByRole('button', { name: 'Choose engine' })).toHaveFocus() - expect(screen.queryByRole('heading', { name: 'Choose your engine' })).not.toBeInTheDocument() + expect(screen.getByRole('dialog', { name: 'Choose your engine' })).toBeVisible() + expect(screen.queryByRole('button', { name: 'Back', exact: true })).not.toBeInTheDocument() expect(next).not.toHaveBeenCalled() - expect(fixture.execute.mock.calls.some(([name]) => name === 'engines.enqueue')).toBe(false) - fireEvent.keyDown(window, { key: 'Escape', repeat: true }) - expect(screen.getByRole('button', { name: 'Choose engine' })).toHaveFocus() - fireEvent.click(screen.getByRole('button', { name: 'Choose engine' })) - await screen.findByRole('heading', { name: 'Choose your engine' }) fireEvent.click(screen.getByRole('button', { name: 'Set up later' })) - expect(next).toHaveBeenCalledOnce() + await waitFor(() => expect(next).toHaveBeenCalledOnce()) + expect(fixture.execute.mock.calls.some(([name]) => name === 'engines.enqueue')).toBe(false) }) diff --git a/packages/admin-ui/src/workspace/intro/EngineIntro.tsx b/packages/admin-ui/src/workspace/intro/EngineIntro.tsx index 28d76d42..37c82d50 100644 --- a/packages/admin-ui/src/workspace/intro/EngineIntro.tsx +++ b/packages/admin-ui/src/workspace/intro/EngineIntro.tsx @@ -1,63 +1,69 @@ -import { useEffect, useRef, useState } from 'react' +import { useCallback, useEffect, useRef, useState } from 'react' import { setupFinished } from '@view' import { useWorkspace } from '../useWorkspace' import { record, rows } from '../types' -import { IntroScreen } from './IntroScreen' +import { Action } from '../Controls' +import { WorkspaceBrand } from '../WorkspaceBrand' import { EngineChooser } from './EngineChooser' export function EngineIntro({ onContinue }: { onContinue: () => void }) { const w = useWorkspace() - const [stage, setStage] = useState<'checking' | 'choose' | 'engines' | 'ready'>('checking') + const [choosing, setChoosing] = useState(false) const { snapshot, execute } = w const checking = useRef(false) const completed = useRef(false) + const proceed = useCallback(() => { + if (completed.current) return + completed.current = true + onContinue() + }, [onContinue]) + useEffect(() => { - if (setupFinished(snapshot?.setup) && !completed.current) { - completed.current = true - onContinue() + if (!snapshot || completed.current) return + if (setupFinished(snapshot.setup)) { + proceed() + return } - }, [snapshot?.setup, stage, onContinue]) - useEffect(() => { - if (!snapshot || stage !== 'checking' || checking.current) return - checking.current = true - if (setupFinished(snapshot.setup)) return + if (choosing || checking.current) return if (snapshot.setups.length > 0 || snapshot.downloads.some((row) => record(row).kind === 'engine')) { - onContinue() + proceed() return } + checking.current = true void execute('engines.list') .then((result) => { if (completed.current) return - if (rows(record(result).engines).some((e) => e.active)) setStage('ready') - else { - setStage('choose') - } + if (rows(record(result).engines).some((e) => e.active)) proceed() + else setChoosing(true) + }) + .catch(() => { + if (!completed.current) setChoosing(true) }) - .catch(() => setStage('engines')) - }, [snapshot, stage, execute, onContinue]) - if (stage === 'engines') - return ( - setStage('choose')} - onLater={onContinue} - /> - ) + }, [snapshot, choosing, execute, proceed]) + + if (choosing) return + return ( - setStage('engines')} - disabled={stage === 'checking' && !w.error} - label={ - stage === 'ready' - ? 'Press any key' - : stage === 'checking' - ? w.error - ? 'Retry connection' - : 'Checking setup…' - : 'Choose engine' - } - /> +
+
+
+ +
+
+ {w.error ? ( +
+

+ {w.error} +

+ Retry connection +
+ ) : ( +

+ Checking setup… +

+ )} +
+
+
) } diff --git a/packages/admin-ui/src/workspace/intro/IntroScreen.test.tsx b/packages/admin-ui/src/workspace/intro/IntroScreen.test.tsx deleted file mode 100644 index ef943c92..00000000 --- a/packages/admin-ui/src/workspace/intro/IntroScreen.test.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { render, screen, fireEvent } from '@testing-library/react' -import { expect, it, vi } from 'vitest' -import { IntroScreen } from './IntroScreen' - -it('focuses the entry button and consumes the first key without forwarding it', () => { - const enter = vi.fn(), - leaked = vi.fn() - window.addEventListener('keydown', leaked) - const ui = render() - expect(screen.getByRole('main', { name: 'Atomic Server intro' })).toBeVisible() - expect(screen.getByRole('heading', { name: 'Atomic Server' })).toBeVisible() - expect(screen.getByRole('button', { name: 'Press any key' })).toHaveFocus() - fireEvent.keyDown(window, { key: 'x' }) - expect(enter).toHaveBeenCalledOnce() - expect(leaked).not.toHaveBeenCalled() - fireEvent.keyDown(window, { key: 'x' }) - expect(enter).toHaveBeenCalledOnce() - ui.unmount() - window.removeEventListener('keydown', leaked) -}) -it('supports clicking while leaving browser shortcuts and modifier keys alone', () => { - const enter = vi.fn() - render() - fireEvent.keyDown(window, { key: 'Shift' }) - fireEvent.keyDown(window, { key: 'r', ctrlKey: true }) - expect(enter).not.toHaveBeenCalled() - fireEvent.click(screen.getByRole('button', { name: 'Press any key' })) - expect(enter).toHaveBeenCalledOnce() -}) diff --git a/packages/admin-ui/src/workspace/intro/IntroScreen.tsx b/packages/admin-ui/src/workspace/intro/IntroScreen.tsx deleted file mode 100644 index 74731626..00000000 --- a/packages/admin-ui/src/workspace/intro/IntroScreen.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { useEffect, useRef } from 'react' -import type { ReactNode } from 'react' -import { AtomicMark } from '../AtomicMark' -import './intro.css' - -export function IntroScreen({ - onContinue, - label = 'Press any key', - disabled = false, - children, -}: { - onContinue: () => void - label?: string - disabled?: boolean - children?: ReactNode -}) { - const button = useRef(null) - const continued = useRef(false) - const enter = () => { - if (disabled || continued.current) return - continued.current = true - onContinue() - } - useEffect(() => { - button.current?.focus() - const onKey = (e: KeyboardEvent) => { - if (disabled || e.isComposing || e.repeat || e.metaKey || e.ctrlKey || e.altKey) return - if (['Shift', 'Control', 'Alt', 'Meta', 'CapsLock'].includes(e.key)) return - e.preventDefault() - e.stopImmediatePropagation() - if (!continued.current) { - continued.current = true - onContinue() - } - } - window.addEventListener('keydown', onKey, true) - return () => window.removeEventListener('keydown', onKey, true) - }, [onContinue, disabled]) - return ( -
-
- -

Atomic Server

-
- {children} - -
-
-
- ) -} diff --git a/packages/admin-ui/src/workspace/intro/intro.css b/packages/admin-ui/src/workspace/intro/intro.css deleted file mode 100644 index 38621a89..00000000 --- a/packages/admin-ui/src/workspace/intro/intro.css +++ /dev/null @@ -1,148 +0,0 @@ -.atomic-intro { - min-height: 100dvh; - width: 100%; - position: relative; - overflow: hidden; - isolation: isolate; - display: grid; - place-items: center; - background: radial-gradient(ellipse at 50% 40%, #18302c55, transparent 65%), #070b0c; - color: #fff; - font-family: - Inter, - -apple-system, - BlinkMacSystemFont, - 'Segoe UI', - sans-serif; -} -.atomic-intro-card { - position: relative; - width: 100%; - max-width: 1000px; - text-align: center; - padding: 40px 24px; -} -.atomic-intro-mark { - display: block; - width: clamp(140px, 21vw, 268px); - height: auto; - aspect-ratio: 1; - margin: 0 auto clamp(24px, 3vw, 38px); - color: #fff; - animation: atomic-breathe 6s ease-in-out infinite; -} -.atomic-intro h1 { - font-size: clamp(28px, 4vw, 42px); - font-weight: 650; - letter-spacing: -0.035em; - line-height: 1; - margin: 0 0 32px; -} -.atomic-intro-mark + h1 { - font-size: clamp(42px, 7vw, 90px); - letter-spacing: -0.052em; - margin: 0; -} -.atomic-intro-action { - margin-top: clamp(48px, 5vw, 64px); -} -.atomic-intro p { - margin: 20px 0; - font-size: 14px; - color: #a8b4ae; -} -.atomic-intro button { - font-family: ui-monospace, SFMono-Regular, Consolas, monospace; - font-size: 14px; - letter-spacing: 0.04em; - color: #0b241b; - border: 1px solid #b7dfd1; - border-radius: 7px; - background: #b7dfd1; - padding: 16px 32px; - min-height: 54px; - font-weight: 600; - cursor: pointer; - transition: background 0.2s; -} -.atomic-intro button:hover { - background: #fff; -} -.atomic-intro button:focus-visible { - outline: 2px solid #d7f1e6; - outline-offset: 6px; -} -.intro-cursor { - animation: atomic-blink 1.3s steps(2, start) infinite; -} -.atomic-intro button:disabled { - background: transparent; - border-color: #455b52; - color: #a8b4ae; - cursor: wait; -} -.atomic-intro .intent-grid { - display: flex; - justify-content: center; - flex-wrap: wrap; - gap: 16px; - margin: 0 0 32px; -} -.atomic-intro .intent-grid button { - width: min(260px, 100%); - min-height: 88px; - white-space: normal; -} -.engine-download { - display: grid; - grid-template-columns: 1fr auto; - gap: 12px; - text-align: left; - width: min(440px, 100%); - padding: 20px; - margin: 0 auto 24px; - border: 1px solid #455b52; - border-radius: 10px; - background: #101b17; -} -.engine-download progress { - grid-column: 1 / -1; - width: 100%; - height: 10px; - accent-color: #b7dfd1; -} -.engine-download small { - grid-column: 1 / -1; - color: #a8b4ae; -} -@keyframes atomic-breathe { - 50% { - transform: scale(1.035); - opacity: 0.85; - } -} -@keyframes atomic-blink { - to { - opacity: 0; - } -} -@media (prefers-reduced-motion: reduce) { - .atomic-intro *, - .atomic-intro *::before, - .atomic-intro *::after { - animation: none !important; - transition: none !important; - } -} -@media (max-height: 650px) { - .atomic-intro-card { - padding-block: 32px; - } - .atomic-intro-mark { - width: clamp(120px, 26dvh, 180px); - margin-bottom: 24px; - } - .atomic-intro-mark + h1 { - font-size: clamp(42px, 9dvh, 60px); - } -} diff --git a/packages/admin-ui/src/workspace/library/cloud/CloudProviderDialog.tsx b/packages/admin-ui/src/workspace/library/cloud/CloudProviderDialog.tsx index e66f0442..053b9d75 100644 --- a/packages/admin-ui/src/workspace/library/cloud/CloudProviderDialog.tsx +++ b/packages/admin-ui/src/workspace/library/cloud/CloudProviderDialog.tsx @@ -1,5 +1,5 @@ -// Lifted from Atomic-Chat/web-app/src/preview/onboarding/Onboarding.tsx @ 5043013; adapted: inline onboarding credentials and compact library dialogs. -import { useEffect, useRef, type ReactNode } from 'react' +// Lifted from Atomic-Chat/web-app/src/preview/onboarding/Onboarding.tsx @ 5043013; adapted: shared provider dialog for the catalog and first run. +import type { ReactNode } from 'react' import { useDialog } from '../../useDialog' type ProviderPanelProps = { @@ -9,34 +9,12 @@ type ProviderPanelProps = { children: ReactNode } -export function CloudProviderDialog(props: ProviderPanelProps & { inline?: boolean }) { - return props.inline ? : -} - -function InlineProviderPanel({ name, children }: ProviderPanelProps) { - const ref = useRef(null) - useEffect(() => { - if (document.activeElement?.closest('.cloud-provider-card')) - ref.current?.querySelector('input')?.focus() - }, [name]) - return ( -
- {children} -
- ) -} - -function ProviderModal({ name, checking, onClose, children }: ProviderPanelProps) { +export function CloudProviderDialog({ name, checking, onClose, children }: ProviderPanelProps) { const ref = useDialog(() => { if (!checking) onClose() }) return ( -
{ - if (event.target === event.currentTarget && !checking) onClose() - }} - > +
void disconnect: () => Promise }) { - const Field = onboarding ? CompactField : SettingsField const form = useRef(null) const submitted = useRef<{ moved: boolean } | null>(null) useEffect(() => { @@ -77,7 +74,7 @@ export function CloudProviderEditor({ return (
{ event.preventDefault() submitted.current = { moved: false } @@ -106,7 +103,6 @@ export function CloudProviderEditor({ onChange={(event) => change('key', event.target.value)} /> - {onboarding && connectButton}
Connection options @@ -140,9 +136,9 @@ export function CloudProviderEditor({
- {!onboarding && saved && Disconnect} - {!onboarding && Cancel} - {!onboarding && connectButton} + {saved && Disconnect} + Cancel + {connectButton}
diff --git a/packages/admin-ui/src/workspace/library/cloud/CloudProviders.tsx b/packages/admin-ui/src/workspace/library/cloud/CloudProviders.tsx index 6a65594b..a5a42f96 100644 --- a/packages/admin-ui/src/workspace/library/cloud/CloudProviders.tsx +++ b/packages/admin-ui/src/workspace/library/cloud/CloudProviders.tsx @@ -9,32 +9,21 @@ import { CloudProviderEditor } from './CloudProviderEditor' import { record, text } from '../../types' import type { RecordValue } from '../../types' import './cloud-providers.css' -import './onboarding-providers.css' import { CloudProviderMark } from './CloudProviderMark' import { CustomProviderSummary } from './CustomProviderSummary' import { CloudProviderDialog } from './CloudProviderDialog' import { describeError } from '@/services/admin-api' -export function CloudProviders({ - workspace: w, - onboarding = false, - onConnected, - custom = false, -}: { - workspace: Workspace - onboarding?: boolean - onConnected?: () => void - custom?: boolean -}) { +export function CloudProviders({ workspace: w, custom = false }: { workspace: Workspace; custom?: boolean }) { const editorSession = useRef(0) const initialProviders = useRef(false) const [providers, setProviders] = useState([]) - const [provider, setProvider] = useState(onboarding ? 'openrouter' : '') - const [url, setUrl] = useState(onboarding ? 'https://openrouter.ai/api/v1' : '') + const [provider, setProvider] = useState('') + const [url, setUrl] = useState('') const [key, setKey] = useState('') const [models, setModels] = useState('') const [error, setError] = useState('') const [revision, setRevision] = useState(0) - const [editing, setEditing] = useState(onboarding) + const [editing, setEditing] = useState(false) const [checking, setChecking] = useState(false) const { execute } = w useEffect( @@ -93,7 +82,6 @@ export function CloudProviders({ setError('Enter a provider name and a valid HTTP or HTTPS endpoint.') return } - editorSession.current += 1 setChecking(true) setError('') try { @@ -110,19 +98,7 @@ export function CloudProviders({ ) setProviders((p) => [...p.filter((v) => v.provider !== provider.trim()), result]) setProvider(provider.trim()) - onConnected?.() - setKey('') - if (onboarding) { - const currentIndex = choices.findIndex((p) => p.id === provider) - const next = [...choices.slice(currentIndex + 1), ...choices.slice(0, currentIndex)].find( - (p) => p.id && !providers.some((saved) => saved.provider === p.id && saved.connected) - ) - if (next) { - setProvider(next.id) - setUrl(next.url) - setModels('') - } - } else setEditing(false) + closeEditor() setRevision((v) => v + 1) } catch (e) { setError(describeError(e)) @@ -131,10 +107,7 @@ export function CloudProviders({ } } return ( -
+
{custom && ( { const config = providers.find((v) => v.provider === p.id) setProvider(p.id) @@ -217,14 +191,12 @@ export function CloudProviders({ )} {editing && ( p.id === provider)?.name ?? 'Custom provider'} checking={checking} onClose={closeEditor} > p.id === provider)?.name ?? 'Custom provider'} - onboarding={onboarding} checking={checking} error={error} validUrl={validUrl} diff --git a/packages/admin-ui/src/workspace/library/cloud/cloud-provider-focus.test.tsx b/packages/admin-ui/src/workspace/library/cloud/cloud-provider-focus.test.tsx index 0820ef54..08953e26 100644 --- a/packages/admin-ui/src/workspace/library/cloud/cloud-provider-focus.test.tsx +++ b/packages/admin-ui/src/workspace/library/cloud/cloud-provider-focus.test.tsx @@ -17,7 +17,7 @@ it.each([false, true])( }) render( <> - + ) @@ -25,7 +25,7 @@ it.each([false, true])( const key = screen.getByLabelText('API key', { exact: false }) await userEvent.type(key, 'invalid-key') await userEvent.click(screen.getByRole('button', { name: 'Connect', exact: true })) - if (moved) await userEvent.click(screen.getByRole('button', { name: 'Other control' })) + if (moved) screen.getByRole('button', { name: 'Other control' }).focus() else (document.activeElement as HTMLElement).blur() await act(async () => reject(new Error('The provider rejected this API key.'))) expect(screen.getByRole('alert')).toHaveTextContent('rejected this API key') diff --git a/packages/admin-ui/src/workspace/library/cloud/cloud-providers.css b/packages/admin-ui/src/workspace/library/cloud/cloud-providers.css index 5ad79c91..24aa06f8 100644 --- a/packages/admin-ui/src/workspace/library/cloud/cloud-providers.css +++ b/packages/admin-ui/src/workspace/library/cloud/cloud-providers.css @@ -26,9 +26,11 @@ outline: 1px solid var(--ew-teal); } .cloud-provider-card.connected { - background: #27292b; - color: #aeb5b4; - border-color: #454b4a; + background: var(--ew-panel); + color: var(--ew-text); +} +.cloud-provider-card:enabled:hover { + background: var(--ew-raised); } .cloud-provider-card.connected .cloud-provider-icon { opacity: 0.5; diff --git a/packages/admin-ui/src/workspace/library/cloud/onboarding-providers.css b/packages/admin-ui/src/workspace/library/cloud/onboarding-providers.css deleted file mode 100644 index fd999836..00000000 --- a/packages/admin-ui/src/workspace/library/cloud/onboarding-providers.css +++ /dev/null @@ -1,82 +0,0 @@ -/* Lifted from Atomic-Chat preview/onboarding/onboarding.css @ 5043013; adapted: inline provider validation. */ -/* Match the desktop provider catalog and inline key panel during first run. */ -.desktop-workspace .first-run .onboarding-providers .cloud-provider-grid { - grid-auto-rows: minmax(108px, auto); - max-height: clamp(100px, 24dvh, 240px); - padding: 4px; - overscroll-behavior: contain; -} -.first-run .onboarding-providers .cloud-provider-card { - position: relative; - min-width: 0; - gap: 8px; - background: #20292e; - border-color: #425058; - text-align: center; -} -.first-run .onboarding-providers .cloud-provider-card.selected { - background: #2b4441; - border-color: #acdbc0; -} -.first-run .onboarding-providers .cloud-provider-card.connected { - background: #232626; - border-color: #3d4342; - color: #9baba5; -} -.first-run .onboarding-providers .cloud-provider-card > span:nth-child(2) { - display: block; - width: 100%; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - font-size: 12px; -} -.first-run .onboarding-providers .cloud-provider-tag { - margin-left: 0; -} -.first-run .cloud-provider-inline .cloud-provider-editor { - margin-top: 14px; - padding: 18px; - background: #19221c; - border: 1px solid #45594c; - border-radius: 13px; -} -.first-run .cloud-provider-inline legend { - font-size: 18px; - margin-bottom: 12px; -} -.first-run .cloud-key-row { - display: flex; - align-items: flex-end; - gap: 10px; -} -.first-run .cloud-key-row .ew-field { - flex: 1; - min-width: 0; -} -.desktop-workspace .first-run .cloud-key-row > .ew-button { - min-height: 42px; - margin-bottom: 0; - border-radius: 8px; - padding: 10px 18px; -} -.first-run .cloud-provider-inline .ew-actions { - justify-content: flex-end; - margin-top: 12px; -} -@media (max-width: 420px) { - .first-run .cloud-key-row { - align-items: stretch; - flex-direction: column; - } -} - -.desktop-workspace .first-run .onboarding-providers:not(.has-provider-editor) .cloud-provider-grid { - max-height: min(50dvh, 420px); -} - -/* Connected cards stay readable when they no longer need an onboarding action. */ -.first-run .onboarding-providers .cloud-provider-card.connected:disabled { - opacity: 1; - cursor: default; -} diff --git a/packages/admin-ui/src/workspace/library/cloud/provider-dismissal.test.tsx b/packages/admin-ui/src/workspace/library/cloud/provider-dismissal.test.tsx index 63d4bb81..687ab2bb 100644 --- a/packages/admin-ui/src/workspace/library/cloud/provider-dismissal.test.tsx +++ b/packages/admin-ui/src/workspace/library/cloud/provider-dismissal.test.tsx @@ -1,4 +1,4 @@ -import { useState } from 'react' +import { useEffect, useState } from 'react' import { act, render, screen, waitFor, within } from '@testing-library/react' import userEvent from '@testing-library/user-event' import { expect, it, vi } from 'vitest' @@ -7,27 +7,33 @@ import { CloudProviders } from './CloudProviders' import { SetupWizard } from '../../setup/SetupWizard' import { DeleteConfirmation } from '../DeleteConfirmation' -it('Escape returns the inline provider step to permissions without an intermediate provider list', async () => { - const close = vi.fn() - const { workspace } = workspaceFixture( +it('onboarding opens the shared provider dialog on demand and Escape returns to the provider list', async () => { + const { workspace, execute } = workspaceFixture( { 'cloud.list': { providers: [] } }, { setups: [{ id: 'job', stage: 'downloading' }] as never } ) - render() - await userEvent.click(screen.getByRole('button', { name: 'Skip', exact: true })) - await userEvent.click(screen.getByRole('button', { name: 'Continue without permissions' })) + render() + await userEvent.click(screen.getByRole('button', { name: 'Continue', exact: true })) + expect(screen.getByRole('heading', { name: 'Remote providers' })).toBeInTheDocument() + expect(screen.queryByLabelText('API key', { exact: false })).not.toBeInTheDocument() const provider = screen.getByRole('button', { name: 'OpenAI', exact: true }) await userEvent.click(provider) - const dialog = screen.getByRole('region', { name: 'Connect OpenAI' }) + const dialog = screen.getByRole('dialog', { name: 'Connect OpenAI' }) await userEvent.type(within(dialog).getByLabelText('API key', { exact: false }), 'private-value') await userEvent.keyboard('{Escape}') - expect(screen.queryByRole('region', { name: 'Connect OpenAI' })).not.toBeInTheDocument() + expect(screen.queryByRole('dialog', { name: 'Connect OpenAI' })).not.toBeInTheDocument() + expect(provider).toHaveFocus() + expect(screen.getByRole('heading', { name: 'Remote providers' })).toBeInTheDocument() + expect(execute).not.toHaveBeenCalledWith('cloud.connect', expect.anything()) + await userEvent.click(screen.getByRole('button', { name: 'Anthropic', exact: true })) + expect( + within(screen.getByRole('dialog', { name: 'Connect Anthropic' })).getByLabelText('API key', { + exact: false, + }) + ).toHaveValue('') + await userEvent.keyboard('{Escape}') + await userEvent.keyboard('{Escape}') expect(screen.getByRole('heading', { name: 'Permissions' })).toBeInTheDocument() - expect(close).not.toHaveBeenCalled() - await userEvent.click(screen.getByRole('button', { name: 'Skip', exact: true })) - await userEvent.click(screen.getByRole('button', { name: 'Continue without permissions' })) - await userEvent.click(screen.getByRole('button', { name: 'OpenAI', exact: true })) - expect(screen.getByLabelText('API key', { exact: false })).toHaveValue('') }) it('Escape closes the library provider form and returns focus to its card', async () => { const { workspace } = workspaceFixture({ 'cloud.list': { providers: [] } }) @@ -46,7 +52,7 @@ it('Escape on Custom Endpoint shows its page with an Add endpoint action', async expect(screen.queryByRole('dialog')).not.toBeInTheDocument() expect(screen.getByRole('button', { name: 'Add endpoint' })).toBeInTheDocument() }) -it('keeps Skip setup directly before Skip in the same footer action group', async () => { +it('keeps Skip setup directly before Continue in the same footer action group', async () => { const { workspace } = workspaceFixture({}, { setups: [{ id: 'job', stage: 'downloading' }] as never }) render() await act(async () => {}) @@ -56,33 +62,23 @@ it('keeps Skip setup directly before Skip in the same footer action group', asyn within(group as HTMLElement) .getAllByRole('button') .map((button) => button.textContent) - ).toEqual(['Skip setup', 'Skip']) + ).toEqual(['Skip setup', 'Continue']) expect(skip.closest('.first-run-skip')).not.toBeNull() expect(screen.getByRole('button', { name: 'Back', exact: true })).toBeInTheDocument() }) -it('keeps onboarding provider selection inline and allows switching without an intermediate dialog', async () => { - const { workspace } = workspaceFixture({ 'cloud.list': { providers: [] } }) - render() - await userEvent.click(screen.getByRole('button', { name: 'OpenAI', exact: true })) - expect(screen.queryByRole('dialog')).not.toBeInTheDocument() - expect(screen.getByRole('region', { name: 'Connect OpenAI' })).toBeInTheDocument() - expect(screen.getByLabelText('API key', { exact: false })).toHaveFocus() - await userEvent.type(screen.getByLabelText('API key', { exact: false }), 'previous-key') - await userEvent.click(screen.getByRole('button', { name: 'Anthropic', exact: true })) - expect(screen.getByRole('region', { name: 'Connect Anthropic' })).toBeInTheDocument() - expect(screen.getByLabelText('API key', { exact: false })).toHaveValue('') - expect(screen.getByLabelText('API key', { exact: false })).toHaveFocus() -}) - -it('lets a download confirmation handle Escape before the inline provider editor', async () => { +it('lets a download confirmation handle Escape before the provider dialog', async () => { const { workspace } = workspaceFixture({ 'cloud.list': { providers: [] } }) const closed = vi.fn() function Example() { const [removing, setRemoving] = useState(false) + useEffect(() => { + const open = () => setRemoving(true) + window.addEventListener('open-download-confirmation', open) + return () => window.removeEventListener('open-download-confirmation', open) + }, []) return ( <> - - + {removing && ( ) await userEvent.click(screen.getByRole('button', { name: 'OpenAI', exact: true })) await userEvent.type(screen.getByLabelText('API key', { exact: false }), 'draft-key') - await userEvent.click(screen.getByRole('button', { name: 'Remove Qwen' })) + await act(async () => window.dispatchEvent(new Event('open-download-confirmation'))) await userEvent.keyboard('{Escape}') expect(closed).toHaveBeenCalledOnce() - expect(screen.queryByRole('dialog')).not.toBeInTheDocument() - expect(screen.getByRole('region', { name: 'Connect OpenAI' })).toBeInTheDocument() + expect(screen.queryByRole('dialog', { name: 'Remove download?' })).not.toBeInTheDocument() + expect(screen.getByRole('dialog', { name: 'Connect OpenAI' })).toBeInTheDocument() expect(screen.getByLabelText('API key', { exact: false })).toHaveValue('draft-key') }) diff --git a/packages/admin-ui/src/workspace/library/downloads/FloatingDownloads.tsx b/packages/admin-ui/src/workspace/library/downloads/FloatingDownloads.tsx index 52b4dda0..127d9cb8 100644 --- a/packages/admin-ui/src/workspace/library/downloads/FloatingDownloads.tsx +++ b/packages/admin-ui/src/workspace/library/downloads/FloatingDownloads.tsx @@ -8,13 +8,7 @@ import { useDownloadEstimate } from './useDownloadEstimate' import { useDownloadAttention } from './download-attention' import './floating-downloads.css' -export function FloatingDownloads({ - workspace, - onboarding = false, -}: { - workspace: Workspace - onboarding?: boolean -}) { +export function FloatingDownloads({ workspace }: { workspace: Workspace }) { const [open, setOpen] = useState(false) const attention = useDownloadAttention() const rows = prioritizeDownloads( @@ -29,7 +23,7 @@ export function FloatingDownloads({ {first && (
-
    +
      {group.map((entry) => (
    • - + trailing={ + <> + + {entry.status} + {entry.build && · {entry.build}} + +