diff --git a/apps/desktop/e2e/app.spec.ts b/apps/desktop/e2e/app.spec.ts index 59bbd6a5..6bd333b0 100644 --- a/apps/desktop/e2e/app.spec.ts +++ b/apps/desktop/e2e/app.spec.ts @@ -1138,6 +1138,9 @@ test('the first start walks through SolidCraft, assistant, printer and project f await setup.getByTestId('first-start-next').click(); await expect(setup).toHaveAttribute('data-step', 'assistant'); await expect(setup.getByRole('radio', { name: /^Claude Code/ })).toBeChecked(); + // Signed in, the step says so; the model per step waits folded under "Advanced" (usability U-01). + await expect(setup.getByTestId('agent-detail')).toContainText('Signed in'); + await expect(setup.getByTestId('first-start-models')).not.toHaveAttribute('open'); await setup.getByTestId('first-start-next').click(); await expect(setup).toHaveAttribute('data-step', 'print'); await setup.getByTestId('printer-name').getByRole('textbox').fill('Werkstatt'); @@ -1472,7 +1475,7 @@ test('the assistant shows the signed-in plan and needs SolidCraft', async () => // The plan's default model with a named effort; the plan itself is in the menu. await expect(chip).toHaveText('Claude Code · Opus 9 · Medium'); await chip.click(); - await expect(page.getByTestId('agent-detail')).toHaveText('Claude Code 9.9.9 · Claude subscription'); + await expect(page.getByTestId('agent-detail')).toHaveText('Signed in · Claude Code 9.9.9 · Claude subscription'); await expect(page.getByRole('radio', { name: /^Claude Code/ })).toBeChecked(); await page.screenshot({ path: test.info().outputPath('agent-menu.png') }); await page.keyboard.press('Escape'); diff --git a/apps/desktop/e2e/solidcraft.contract.spec.ts b/apps/desktop/e2e/solidcraft.contract.spec.ts index b746cab7..2c53b413 100644 --- a/apps/desktop/e2e/solidcraft.contract.spec.ts +++ b/apps/desktop/e2e/solidcraft.contract.spec.ts @@ -1271,6 +1271,42 @@ test('a failed turn says why: the plan used up until a time, no connection, or t } }); +test('on an empty start page "Describe a part" opens a new project with the chat ready to type (usability U-06, U-11)', async () => { + const { mkdtempSync, rmSync } = await import('node:fs'); + const { tmpdir } = await import('node:os'); + const { join } = await import('node:path'); + const work = mkdtempSync(join(tmpdir(), 'partbuddy-describe-')); + const launched = await launchApp({ + isolated: false, + work, + env: { + SOLIDCRAFT_CONTROL_DIR: join(work, 'control'), + PARTBUDDY_SOLIDCRAFT_PORT: '7902', + PARTBUDDY_PROJECTS_DIR: join(work, 'projects'), + PARTBUDDY_START_PAGE: '1', + PARTBUDDY_KEYRING_SERVICE: 'PartBuddy-e2e', + PARTBUDDY_CLAUDE_COMMAND: JSON.stringify([process.execPath, join(__dirname, '..', 'test', 'fakeClaude.mjs')]), + }, + }); + const { page } = launched; + try { + await expect(page.getByTestId('connection-status')).toHaveAttribute('data-engine', 'headless', { timeout: 30_000 }); + const home = page.getByTestId('home-page'); + // The start page is no project: no name, no printer or print light in the bars. + await expect(page.getByTestId('project-menu')).toHaveCount(0); + await expect(page.getByTestId('material-chip')).toHaveCount(0); + await page.screenshot({ path: test.info().outputPath('home-empty.png') }); + await home.getByTestId('home-describe').click(); + await expect(home).toHaveCount(0); + await expect(page.getByTestId('design-name')).toHaveText('New part', { timeout: 30_000 }); + await expect(page.getByRole('textbox', { name: 'Message to the assistant' })).toBeFocused(); + await expect(page.getByTestId('material-chip')).toBeVisible(); + } finally { + await launched.close(); + rmSync(work, { recursive: true, force: true, maxRetries: 10, retryDelay: 500 }); + } +}); + test('PartBuddy starts on the start page with no project open; a saved part gets a preview, and tiles open and import projects (B3)', async () => { test.setTimeout(240_000); const { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync } = await import('node:fs'); diff --git a/apps/desktop/src/renderer/src/assistant/AgentChip.tsx b/apps/desktop/src/renderer/src/assistant/AgentChip.tsx index c22837f5..ef85e1a4 100644 --- a/apps/desktop/src/renderer/src/assistant/AgentChip.tsx +++ b/apps/desktop/src/renderer/src/assistant/AgentChip.tsx @@ -233,7 +233,8 @@ function ModelChoiceSection({ status }: { status: AgentStatus }) { * The assistant's route, model and effort, and its sign-in state (B1); in the chip's menu and in the * settings (B6). */ -export function AssistantChoice() { +/** `setup`: the first start, where the model choice waits folded under "Advanced" (usability U-01). */ +export function AssistantChoice({ setup = false }: { setup?: boolean }) { const { t } = useTranslation(); const state = useAssistant((s) => s.state); const status = selectedStatus(state); @@ -261,7 +262,16 @@ export function AssistantChoice() { ))} - + {setup ? ( + signedIn(status) && (status.models ?? []).length > 0 ? ( +
+ {t('firstStart.models')} + +
+ ) : null + ) : ( + + )}
diff --git a/apps/desktop/src/renderer/src/assistant/AssistantPanel.tsx b/apps/desktop/src/renderer/src/assistant/AssistantPanel.tsx index 69564e89..08f3a60f 100644 --- a/apps/desktop/src/renderer/src/assistant/AssistantPanel.tsx +++ b/apps/desktop/src/renderer/src/assistant/AssistantPanel.tsx @@ -91,7 +91,8 @@ function Working({ label }: { label: string }) { ); } -function Setup() { +/** Sign-in, install or wait notice of the chosen route; nothing once it is ready. Also on the first start (usability U-01). */ +export function AssistantSetup() { const { t } = useTranslation(); const status = selectedStatus(useAssistant((s) => s.state)); const api = platform().agent; @@ -561,11 +562,21 @@ export function AssistantPanel() { if (request && request.serial !== handled) { setHandled(request.serial); if (request.what === 'sketch') setSketching(true); - else setDraft((current) => current || t('parameters.askDraft')); + else if (request.what === 'parameters') setDraft((current) => current || t('parameters.askDraft')); } + // Once per request, as soon as the composer takes text: a new project's composer opens locked until its design is ready. + // The start page gives the focus back to its own button as it closes: only after that. + const homeOpen = useStudio((s) => s.homeOpen); + // A new project locks the composer once more while it loads, which drops the focus: within a few seconds of the + // request the focus comes back each time the composer takes text again. + const focusedFor = useRef<{ serial: number; at: number }>({ serial: 0, at: 0 }); useEffect(() => { - if (request?.what === 'parameters') composer.current?.focus(); - }, [request]); + if (!request || (request.what !== 'parameters' && request.what !== 'describe') || !writable || homeOpen) return; + const now = Date.now(); + if (focusedFor.current.serial === request.serial && now - focusedFor.current.at > 8000) return; + if (focusedFor.current.serial !== request.serial) focusedFor.current = { serial: request.serial, at: now }; + composer.current?.focus(); + }, [request, writable, homeOpen]); // Photos of a real object for the next message (F6), up to four; a sketch or a drawing goes alone. // Each keeps the file's own name and size for its chip, so two pictures can be told apart (audit C-12). const [photos, setPhotos] = useState<{ picture: SketchPicture; name: string }[]>([]); @@ -759,7 +770,7 @@ export function AssistantPanel() {
- + {items.length === 0 && (status.state === 'ready' || busy) ? ( // A way in for an empty chat (polish round 1): examples fill the input, they do not send.
diff --git a/apps/desktop/src/renderer/src/home/HomePage.tsx b/apps/desktop/src/renderer/src/home/HomePage.tsx index ab33f175..2200dc07 100644 --- a/apps/desktop/src/renderer/src/home/HomePage.tsx +++ b/apps/desktop/src/renderer/src/home/HomePage.tsx @@ -77,6 +77,7 @@ export function HomePage() { const { t, i18n } = useTranslation(); const connection = useStudio((s) => s.connection); const setHomeOpen = useStudio((s) => s.setHomeOpen); + const requestAssistant = useStudio((s) => s.requestAssistant); const run = useProjectSwitch(); // The template SolidCraft is building: its tile says so, and the others wait (audit P-02). const [building, setBuilding] = useState(null); @@ -265,6 +266,20 @@ export function HomePage() {

{t('home.emptyTitle')}

{t('home.emptyBody')}

+ {/* The way to a first part for someone new: a project, and the chat ready to type (usability U-06). */} +
) : shown.length === 0 ? (
diff --git a/apps/desktop/src/renderer/src/i18n/de.json b/apps/desktop/src/renderer/src/i18n/de.json index ad2b52ff..eaec09f3 100644 --- a/apps/desktop/src/renderer/src/i18n/de.json +++ b/apps/desktop/src/renderer/src/i18n/de.json @@ -181,7 +181,7 @@ "preview": "Vorschau", "plan": "Claude-Abo", "apiKey": "API-Key, getrennt abgerechnet", - "signedIn": "Claude Code {version} · {plan}", + "signedIn": "Angemeldet · Claude Code {version} · {plan}", "state": { "claude-code": { "checking": "Claude Code wird gesucht", @@ -1112,7 +1112,7 @@ "hint": "Spart Material und Druckzeit: lässt Volumen weg, das nichts trägt (offener Boden, Rahmen statt Platte), ohne geschlossene Körper auszuhöhlen, und hält die Bauhöhe gering. Funktion und Festigkeit gehen vor; Füllung und Geschwindigkeit bleiben Sache deines Slicers." } }, - "add": "Drucker hinzufügen", + "add": "Drucker aus der Liste …", "catalog": "Druckerkatalog", "catalogSearch": "Marke oder Modell suchen", "catalogEmpty": "Kein Drucker passt. Kopiere einen vorhandenen und trage die Werte von Hand ein.", @@ -1362,8 +1362,9 @@ "searchClear": "Suche leeren", "import": "Importieren …", "list": "{count, plural, one {# Projekt} other {# Projekte}}", - "emptyTitle": "Noch keine Projekte", - "emptyBody": "Starte ein neues Projekt, öffne eines oder importiere eine Datei (STEP, IGES, STL, 3MF, OBJ oder ein SolidCraft-Design), auch per Ziehen aufs Fenster. Jedes Projekt bekommt einen eigenen Ordner im Projektordner (Einstellungen › Allgemein).", + "emptyTitle": "Dein erstes Teil", + "emptyBody": "Beschreib, was du brauchst – der Assistent baut es Schritt für Schritt. Oder fang unten mit einer Vorlage an.", + "describe": "Teil beschreiben", "noMatch": "Kein Projekt passt zu „{query}“.", "openNow": "Gerade geöffnet", "justNow": "gerade eben", @@ -1515,8 +1516,9 @@ }, "solidcraft": "PartBuddy zeigt und ändert deine Teile über SolidCraft, ein freies CAD-Programm, das im Hintergrund läuft. PartBuddy sucht es selbst; ist es nicht installiert, lade es herunter und such erneut.", "download": "SolidCraft herunterladen (GitHub)", + "models": "Erweitert: Modell je Arbeitsschritt", "assistant": "Wähle den Assistenten, den du schon bezahlst: Claude über dein Claude Code oder ChatGPT mit deinem Abo. Anmelden geht auch später.", - "print": "Trag Drucker und Material einmal ein; der Assistent konstruiert passend dazu. Speichern oder diesen Schritt überspringen.", + "print": "Wähl deinen Drucker aus der Liste – Bauraum, Düse und Schichthöhe trägt PartBuddy dann selbst ein. Der Assistent konstruiert passend dazu.", "projects": "Jedes Projekt bekommt hier einen eigenen Ordner mit Design, Gespräch, Versionen und Exporten.", "skip": "Einrichtung überspringen", "back": "Zurück", diff --git a/apps/desktop/src/renderer/src/i18n/en.json b/apps/desktop/src/renderer/src/i18n/en.json index a3814a7e..64664f33 100644 --- a/apps/desktop/src/renderer/src/i18n/en.json +++ b/apps/desktop/src/renderer/src/i18n/en.json @@ -181,7 +181,7 @@ "preview": "Preview", "plan": "Claude subscription", "apiKey": "API key, billed separately", - "signedIn": "Claude Code {version} · {plan}", + "signedIn": "Signed in · Claude Code {version} · {plan}", "state": { "claude-code": { "checking": "Looking for Claude Code", @@ -1112,7 +1112,7 @@ "hint": "Saves material and print time: leaves out volume that does nothing (an open bottom, a frame instead of a plate) without hollowing closed bodies, and keeps the build height low. Function and strength come first; infill and speed stay with your slicer." } }, - "add": "Add printer", + "add": "Printer from the list …", "catalog": "Printer catalog", "catalogSearch": "Search brand or model", "catalogEmpty": "No printer matches. Copy an existing one and enter the values by hand.", @@ -1362,8 +1362,9 @@ "searchClear": "Clear search", "import": "Import …", "list": "{count, plural, one {# project} other {# projects}}", - "emptyTitle": "No projects yet", - "emptyBody": "Start a new project, open one or import a file (STEP, IGES, STL, 3MF, OBJ or a SolidCraft design), also by dropping it on the window. Every project gets a folder of its own in the projects folder (Settings › General).", + "emptyTitle": "Your first part", + "emptyBody": "Describe what you need – the assistant builds it step by step. Or start from a template below.", + "describe": "Describe a part", "noMatch": "No project matches “{query}”.", "openNow": "Open now", "justNow": "just now", @@ -1515,8 +1516,9 @@ }, "solidcraft": "PartBuddy shows and changes your parts through SolidCraft, a free CAD program that runs in the background. PartBuddy looks for it on its own; if it is not installed, download it and look again.", "download": "Download SolidCraft (GitHub)", + "models": "Advanced: model per step", "assistant": "Choose the assistant you already pay for: Claude through your Claude Code, or ChatGPT with your plan. You can sign in later as well.", - "print": "Enter your printer and material once; the assistant designs for them. Save or skip this step.", + "print": "Pick your printer from the list – PartBuddy fills in build volume, nozzle and layer height. The assistant designs for it.", "projects": "Every project gets a folder of its own here, with the design, the conversation, versions and exports.", "skip": "Skip setup", "back": "Back", diff --git a/apps/desktop/src/renderer/src/shell/FirstStart.tsx b/apps/desktop/src/renderer/src/shell/FirstStart.tsx index e3567311..490ee95c 100644 --- a/apps/desktop/src/renderer/src/shell/FirstStart.tsx +++ b/apps/desktop/src/renderer/src/shell/FirstStart.tsx @@ -5,6 +5,7 @@ import { Dialog, Heading, Modal, ModalOverlay } from 'react-aria-components'; import type { GeneralSettingsInfo } from '../../../shared/contract'; import { AssistantChoice } from '../assistant/AgentChip'; +import { AssistantSetup } from '../assistant/AssistantPanel'; import { PrintProfilesEditor } from '../print/PrintProfilesEditor'; import { platform } from '../platform'; import { Button, linkClass } from '../ui/Button'; @@ -108,7 +109,8 @@ export function FirstStart() { ) : step === 'assistant' ? (

{t('firstStart.assistant')}

- + +
) : step === 'print' ? (
diff --git a/apps/desktop/src/renderer/src/shell/StatusBar.tsx b/apps/desktop/src/renderer/src/shell/StatusBar.tsx index 0708adae..91f087dd 100644 --- a/apps/desktop/src/renderer/src/shell/StatusBar.tsx +++ b/apps/desktop/src/renderer/src/shell/StatusBar.tsx @@ -26,9 +26,13 @@ export function StatusBar() { return (