Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
First screen for anyone: settings move, account card, Your team step (0.9.8) (#585)
Oleksandr Ivanchenko2ff0502b485e
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 616f5aab..92335b82 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -9,6 +9,7 @@ import { PHONE_QUERY } from './layout';import { useSettingsCover } from './settingsFocus';import { WhatsNewHost } from './components/WhatsNewSheet';import { GetStarted, GetStartedBanner } from './components/GetStarted';+import { markMovedSeen, movedPointerShows, movedSeen, ringDevSettings } from './firstScreen';import { dismiss as dismissGetStarted, isDismissed as getStartedDismissed, showCard as showGetStarted, wasStarted as getStartedWasStarted, whatsNewEstablished as decideWhatsNewEstablished } from './gettingStarted';import { useStartVersion } from './gettingStartedInstall';import { SpaceTile } from './components/Spaces';@@ -372,6 +373,17 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({setSpaceSettingsTab(tab);playSfx('click');};+ // First-screen A: the "moved" pointer under the space header, until Open or ✕ (0.9.8 and 0.9.9).+ const [movedHidden, setMovedHidden] = useState(movedSeen);+ const hideMoved = () => {+ markMovedSeen();+ setMovedHidden(true);+ };+ const openMoved = () => {+ openSpaceSettings('general');+ ringDevSettings();+ hideMoved();+ };// Settings › All spaces: what applies to every space and to the app.const openAppSettings = () => {setSettingsScope('app');@@ -3274,7 +3286,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({const chatSubtitle = !isChannel? currentKwant?.title || 'Kwant bot': isGeneral- ? `Laya picks who answers, from the ${kwants.length} ${kwants.length === 1 ? 'bot' : 'bots'} in ${space.name}`+ ? `The best fit of your ${kwants.length} ${kwants.length === 1 ? 'bot' : 'bots'} answers`: currentTeam?.description || currentChannel?.description || `A team in ${space.name}`;// "Suggested:" prompts from who is in this chat, so a kitchen team isn't offered developer prompts@@ -3808,10 +3820,12 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({bots={kwants}engines={engines.engines}reloadEngines={engines.reload}- onDismissed={() => undefined}+ // Someone who finishes Get started in 0.9.8 never saw the old sidebar controls: no "moved" pointer.+ onDismissed={hideMoved}spaceName={space.name}onImported={reloadAfterImport}mainSpace={space.is_default}+ teams={teams}/>) : null;const setupChecklist = (@@ -3957,6 +3971,9 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({playSfx('click');}}onConnectDevGitHub={connectDevGitHub}+ movedPointer={movedPointerShows({ established: whatsNewEstablished, seen: movedHidden })}+ onOpenMoved={openMoved}+ onHideMoved={hideMoved}ideaJarCount={ideaJarCount}ideaJarActive={page === 'jar'}onOpenIdeaJar={() => {diff --git a/frontend/src/botHome.ts b/frontend/src/botHome.tsindex da63c313..d1f11a94 100644--- a/frontend/src/botHome.ts+++ b/frontend/src/botHome.ts@@ -103,7 +103,7 @@ export function answerTarget(opts: {return { kind: 'bot', label: `@${opts.botName ?? 'bot'}`, detail: `${opts.botName ?? 'This bot'} answers in this chat.` };}if (opts.kind === 'general') {- return { kind: 'laya', label: 'Laya picks', detail: 'Laya picks the best bot to answer. Type @ and a name to choose one yourself.' };+ return { kind: 'laya', label: 'Best fit', detail: 'The best bot for each message answers. Type @ and a name to choose one yourself.' };}if (opts.kind === 'team') {const t = opts.teamName ? `@${opts.teamName} team` : 'The team';diff --git a/frontend/src/components/BotHome.tsx b/frontend/src/components/BotHome.tsxindex d054d494..63d5d51c 100644--- a/frontend/src/components/BotHome.tsx+++ b/frontend/src/components/BotHome.tsx@@ -1,10 +1,11 @@import React from 'react';-import { ArrowRight, AtSign, Clock, Lightbulb, ListChecks, MessageSquareText, Sparkles, Wand2 } from 'lucide-react';+import { ArrowRight, AtSign, Clock, Lightbulb, ListChecks, MessageSquareText, Plug, Sparkles, Wand2 } from 'lucide-react';import { ModernAvatar } from './ModernAvatar';import { useKwantMood } from './AvatarMood';import { NewTag } from './NewTag';import { markNewSeen } from '../whatsNew';import { ChatHome, ago, goodAt, starterCards } from '../botHome';+import { ACCOUNT_WAYS } from '../firstScreen';const ICONS = [Sparkles, ListChecks, Lightbulb, Wand2];@@ -17,14 +18,55 @@ interface BotHomeProps {/** false while no account can run a turn: the cards say so and stay still. */canRun?: boolean | null;onPick: (prompt: string) => void;+ /** Shows "Connect an AI account to start" in place of the asks (first-screen E); the caller decides when. */+ accountCard?: boolean;+ /** Space settings › Accounts. */+ onOpenAccounts?: () => void;}+/**+ * "Connect an AI account to start" (first-screen E): the first step, not an error, so violet and calm. Shown in+ * an empty chat while nothing can run and Get started isn't on screen.+ */+export const AccountCard: React.FC<{ onOpenAccounts?: () => void }> = ({ onOpenAccounts }) => (+ <div className="mt-8 w-full text-left" data-account-card>+ <div role="region" aria-label="Connect an AI account" className="grid grid-cols-[32px_1fr] gap-x-3 rounded-2xl border border-sky-400/35 bg-sky-400/[0.07] p-4">+ <span className="flex h-8 w-8 items-center justify-center rounded-xl bg-accent-soft text-sky-200" aria-hidden="true">+ <Plug size={16} />+ </span>+ <div className="min-w-0">+ <h3 className="text-[16px] font-semibold leading-[22px] text-zinc-50">Connect an AI account to start</h3>+ <p className="mt-1 text-[14px] leading-[21px] text-zinc-300">Your bots think with an AI account you already have. Any one of these works:</p>+ <ul className="mt-2.5 flex flex-wrap gap-1.5" aria-label="Accounts that work">+ {ACCOUNT_WAYS.map((w) => (+ <li key={w.name} className="rounded-full border border-white/[0.14] px-2.5 py-0.5 text-[12px] text-zinc-100">+ {w.name}+ {w.plan && <span className="text-zinc-400"> {w.plan}</span>}+ </li>+ ))}+ </ul>+ </div>+ <div className="col-span-2 mt-3 sm:col-span-1 sm:col-start-2">+ <button+ type="button"+ onClick={onOpenAccounts}+ data-connect-account+ className="inline-flex h-11 w-full items-center justify-center rounded-xl bg-gradient-to-b from-[#7a62f0] to-[#5b47d6] px-4 text-body font-semibold text-white hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:ring-offset-2 focus-visible:ring-offset-[#120e26] sm:h-9 sm:w-auto"+ >+ Connect an account+ </button>+ </div>+ </div>+ <p className="mt-2 text-center text-meta text-zinc-400">Nothing runs and nothing is made until one is connected.</p>+ </div>+);+/*** The empty chat. A bot's own chat opens on a big living avatar, what it's good at and four things to- * try; #general opens on "Laya picks" with the team's faces. Everything comes from what the client+ * try; #general opens on "What do you want done?" with the team's faces and three example asks. Everything comes from what the client* already has. It waits 220ms before showing (.kw-home) so a chat still loading its messages never flashes it.*/-export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], prompts, canRun, onPick }) => {+export const BotHome: React.FC<BotHomeProps> = ({ home, team = [], prompts, canRun, onPick, accountCard = false, onOpenAccounts }) => {const bot = home.kind === 'bot' ? home.bot : undefined;const cards = starterCards(prompts);const chips = bot ? goodAt(bot) : [];@@ -32,26 +74,29 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], prconst extra = team.length - shown.length;// Breathing is the working signal: only a working bot's glow moves (violet, like its dot).const working = useKwantMood(bot?.id) === 'working';+ // Nothing can run yet: the faces sleep (eyes shut) and the glow dims to 20 %.+ const asleep = accountCard && !working;+ const general = home.kind === 'general';return (<section className="kw-home mx-auto flex w-full max-w-3xl flex-col items-center px-1 pb-6 pt-4 text-center sm:pt-10" aria-label={bot ? `${bot.name}, home` : 'Start a conversation'} data-bot-home={home.kind}>{/* The hero: a soft glow behind the floating avatar. Static at .35; it breathes in violet only while the bot works. */}<div className="relative mb-4 flex h-36 w-36 items-center justify-center sm:h-44 sm:w-44"><span- className={`absolute inset-0 rounded-full blur-2xl ${working ? 'kw-glow bg-[#9d8fff] opacity-60 motion-reduce:opacity-50' : 'bg-accent-gradient opacity-35'}`}- data-glow={working ? 'working' : 'still'}+ className={`absolute inset-0 rounded-full blur-2xl ${working ? 'kw-glow bg-[#9d8fff] opacity-60 motion-reduce:opacity-50' : asleep ? 'bg-accent-gradient opacity-20' : 'bg-accent-gradient opacity-35'}`}+ data-glow={working ? 'working' : asleep ? 'asleep' : 'still'}aria-hidden="true"/>{bot ? (// 96 px with 4 px mood cells (spec.md §2); the mood badge is cut out of the main surface<span className="kw-float relative" style={{ '--kw-avatar-cut': 'var(--kw-surface-main, #120e26)' } as React.CSSProperties}>- <ModernAvatar role={bot.avatar_sprite} name={bot.name} size={96} kwantId={bot.id} className="rounded-2xl shadow-raised" />+ <ModernAvatar role={bot.avatar_sprite} name={bot.name} size={96} kwantId={bot.id} asleep={asleep} className="rounded-2xl shadow-raised" /></span>) : (<span className="relative flex -space-x-5" aria-hidden="true">{shown.slice(0, 3).map((k, i) => (<span key={k.id} className={`kw-float rounded-2xl ring-4 ring-[var(--kw-surface-main)] ${i === 1 ? 'z-10 scale-110' : ''}`} style={{ animationDelay: `${i * 300}ms` }}>- <ModernAvatar role={k.avatar_sprite} name={k.name} size={72} kwantId={k.id} />+ <ModernAvatar role={k.avatar_sprite} name={k.name} size={72} kwantId={k.id} asleep={asleep} /></span>))}{shown.length === 0 && <Sparkles size={56} className="text-sky-200" />}@@ -59,9 +104,9 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], pr)}</div>- <h2 className="text-display font-bold text-zinc-50">{bot ? bot.name : spaceName ? `Ask anything in ${spaceName}` : 'Ask anything'}</h2>+ <h2 className="text-display font-bold text-zinc-50">{bot ? bot.name : 'What do you want done?'}</h2><p className="mt-1 max-w-md text-body text-zinc-300">- {bot ? bot.title : 'Laya picks who answers. Or type @ and a name to choose a bot yourself.'}+ {bot ? bot.title : 'Say it in your own words. The bot that fits best picks it up, or type @ and a name to choose one.'}</p>{bot ? (@@ -77,7 +122,7 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], pr)) : (shown.length > 0 && (- <div className="mt-4 flex flex-wrap items-center justify-center gap-1.5" role="list" aria-label="Bots Laya can pick from">+ <div className="mt-4 flex flex-wrap items-center justify-center gap-1.5" role="list" aria-label="Bots that can answer here">{shown.map((k) => (<span key={k.id} role="listitem" className="kw-chip pl-1" title={k.title}><ModernAvatar role={k.avatar_sprite} name={k.name} size={18} />@@ -89,12 +134,14 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], pr))}- {cards.length > 0 && (+ {accountCard ? (+ <AccountCard onOpenAccounts={onOpenAccounts} />+ ) : cards.length > 0 && (<div className="mt-8 w-full text-left"><p className="mb-2 flex items-center gap-1.5 text-meta font-semibold uppercase tracking-wider text-zinc-400">- <MessageSquareText size={13} aria-hidden="true" /> Try asking <NewTag id="starters" className="ml-1.5 normal-case tracking-normal" />+ <MessageSquareText size={13} aria-hidden="true" /> {general ? 'For example' : 'Try asking'} <NewTag id="starters" className="ml-1.5 normal-case tracking-normal" /></p>- <div className="kw-stagger grid grid-cols-1 gap-2.5 sm:grid-cols-2" role="group" aria-label="Suggested prompts">+ <div className={`kw-stagger grid grid-cols-1 gap-2.5 ${cards.length === 3 ? 'sm:grid-cols-3' : 'sm:grid-cols-2'}`} role="group" aria-label="Suggested prompts">{cards.map((prompt, i) => {const Icon = ICONS[i % ICONS.length];return (@@ -108,7 +155,7 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], pr}}disabled={canRun === false}title={canRun === false ? 'Add an account first' : 'Fills the message box so you can edit it before sending'}- className="kw-card-interactive group flex min-h-[72px] items-start gap-3 p-3.5"+ className="kw-card-interactive group flex min-h-14 items-start gap-3 p-3.5 hover:border-white/[0.14] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400 focus-visible:ring-offset-2 focus-visible:ring-offset-[#120e26] sm:min-h-[72px]"><span className="mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-sky-200"><Icon size={16} aria-hidden="true" />@@ -140,10 +187,12 @@ export const BotHome: React.FC<BotHomeProps> = ({ home, spaceName, team = [], pr</div>)}- <p className="mt-8 flex items-center gap-1.5 text-meta text-zinc-400">- <AtSign size={13} aria-hidden="true" />- {home.kind === 'general' ? 'Type @ to ask a specific bot instead of letting Laya pick.' : 'Type @ to bring another bot into the conversation.'}- </p>+ {!accountCard && (+ <p className="mt-8 flex items-center gap-1.5 text-meta text-zinc-400">+ <AtSign size={13} aria-hidden="true" />+ {general ? 'Type @ to ask one bot yourself.' : 'Type @ to bring another bot into the conversation.'}+ </p>+ )}</section>);};diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex e619fce0..4cddab01 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -12,7 +12,8 @@ import { agentSenderLabel } from '../agentConnections';import { ArrowDown, ArrowUp, AtSign, Paperclip, Sparkles, ChevronDown, ChevronRight, Copy, Check, ChevronLeft, Users, Square, Settings2, Folder, GitBranch, Pencil, Pin, Monitor, CircleSlash } from 'lucide-react';import { ModernAvatar } from './ModernAvatar';import { WorkingAvatar } from './WorkingAvatar';-import { BotHome } from './BotHome';+import { AccountCard, BotHome } from './BotHome';+import { accountCardShows } from '../firstScreen';import { ChatHome, answerTarget, goodAt, recipientsOf } from '../botHome';import { moodNoticed } from '../kwantMood';import { NewTag } from './NewTag';@@ -1700,6 +1701,11 @@ export const ChatView: React.FC<ChatViewProps> = ({// The empty chat shows the bot home (a bot's own chat, or #general) instead of a bare pane and a row of chipsconst showHome =!!home && (home.kind === 'bot' || home.kind === 'general') && !welcome && messages.length === 0 && !isStreaming && !queued && !deciding && pendingApprovals.length === 0;+ // first-screen E: nothing can run and Get started (the welcome) isn't on screen. A bot's chat and #general+ // show it inside the home; an empty team chat shows it on its own.+ const accountCard = accountCardShows({ canRun, getStartedShowing: !!welcome });+ const teamAccountCard =+ accountCard && home?.kind === 'team' && messages.length === 0 && !isStreaming && !queued && !deciding && pendingApprovals.length === 0;// Who answers what's typed: the chat decides, an @mention overridesconst target = answerTarget({kind: home?.kind ?? 'channel',@@ -2083,7 +2089,21 @@ export const ChatView: React.FC<ChatViewProps> = ({{welcome && messages.length === 0 && welcome}{showHome && home && (<div className="flex min-h-full items-center justify-center">- <BotHome home={home} spaceName={spaceName} team={activeKwants} prompts={suggestions} canRun={canRun} onPick={handlePromptSuggestion} />+ <BotHome+ home={home}+ spaceName={spaceName}+ team={activeKwants}+ prompts={suggestions}+ canRun={canRun}+ onPick={handlePromptSuggestion}+ accountCard={accountCard}+ onOpenAccounts={onOpenAccounts}+ />+ </div>+ )}+ {teamAccountCard && (+ <div className="mx-auto flex w-full max-w-3xl px-1">+ <AccountCard onOpenAccounts={onOpenAccounts} /></div>)}{groupDiscussionThreads(arranged.messages).map((item, n, items) => {diff --git a/frontend/src/components/DevModeSettings.tsx b/frontend/src/components/DevModeSettings.tsxindex 82f1ff45..36965213 100644--- a/frontend/src/components/DevModeSettings.tsx+++ b/frontend/src/components/DevModeSettings.tsx@@ -3,7 +3,7 @@import React, { useEffect, useState } from 'react';import { Check, Code } from 'lucide-react';-import { DevModeState, DevTeamRef, approvalsWord, devApi, devStore, normaliseRepo } from '../devMode';+import { DevModeState, DevTeamRef, devApi, devStore, normaliseRepo } from '../devMode';import { JiraSettings } from './JiraSettings';import { useDevMode } from './DevModeSwitch';@@ -13,7 +13,7 @@ const rowBtn =const primaryBtn = 'flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-sky-600 hover:bg-sky-500 transition-colors disabled:opacity-50';const input = 'w-full bg-zinc-950 border rounded-lg px-3 py-2 text-sm font-mono text-zinc-100 focus:outline-none border-zinc-800 focus:border-sky-500';-export const DevModeSettings: React.FC<{ spaceId: string; spaceName: string; approvals?: string; save?: typeof devApi.put; teams?: DevTeamRef[] }> = ({ spaceId, spaceName, approvals, save = devApi.put, teams }) => {+export const DevModeSettings: React.FC<{ spaceId: string; spaceName: string; approvals?: string; save?: typeof devApi.put; teams?: DevTeamRef[] }> = ({ spaceId, spaceName, save = devApi.put, teams }) => {const state = useDevMode(spaceId);const [repo, setRepo] = useState('');const [branch, setBranch] = useState('');@@ -31,9 +31,9 @@ export const DevModeSettings: React.FC<{ spaceId: string; spaceName: string; appsetBackup(state?.backup_command ?? '');}, [state?.repo, state?.branch, state?.backup_command]);+ // 0.9.8 (first-screen A): the header switch is gone, so this card is where Dev mode is turned on, the+ // first time too. It shows as soon as the space's state has loaded.if (!state) return null;- // Before the first switch-on there's nothing to set: the switch in the header opens the setup.- if (!state.on && !state.last_seen_sha && !state.polled_at) return null;const normal = repo.trim() ? normaliseRepo(repo) : null;const repoErr = repo.trim() && !normal ? 'Paste a GitHub repo, like owner/name or its URL.' : null;@@ -74,7 +74,7 @@ export const DevModeSettings: React.FC<{ spaceId: string; spaceName: string; app<p className="text-[11px] text-zinc-500">{state.on? `${spaceName} reads this repo to show what landed, review PRs and guard deploys. Only you can change it.`- : `Off. Reviews, the ship gate and the production floor are stopped; approvals stay on ${approvalsWord(approvals)}. Turn it on with the switch next to the space’s name.`}+ : 'Off. Reviews, the ship gate and the production floor are stopped. Approvals stay as you set them above.'}</p><div><label htmlFor="dv-set-repo" className="block text-xs font-medium text-zinc-300 mb-1">@@ -116,10 +116,14 @@ export const DevModeSettings: React.FC<{ spaceId: string; spaceName: string; app</p>)}<div className="flex items-center gap-2">- {state.on && (+ {state.on ? (<button type="button" className={rowBtn} disabled={busy} onClick={() => put({ on: false })} data-dev-turn-off>Turn off Dev mode</button>+ ) : (+ <button type="button" className={rowBtn} disabled={busy} onClick={() => put({ on: true })} data-dev-turn-on>+ Turn on Dev mode+ </button>)}<span className="flex-1" />{saved && !dirty && (diff --git a/frontend/src/components/FirstRunWelcome.tsx b/frontend/src/components/FirstRunWelcome.tsxindex 3739881b..fbd461a3 100644--- a/frontend/src/components/FirstRunWelcome.tsx+++ b/frontend/src/components/FirstRunWelcome.tsx@@ -27,10 +27,10 @@ export const FirstRunWelcome: React.FC<Props> = ({ bots, actionLabel, onAction }))}</div><h2 id="kw-welcome-title" className="text-lg font-semibold text-zinc-100">- Welcome to kwant bots+ Welcome to kwant</h2><p className="mt-1.5 text-sm text-zinc-400">- These are your bots. Ask anything here and Laya picks who answers.+ These are your bots. Ask anything here and the best fit answers.</p>{bots.length > 0 && (<ul className="mt-4 flex flex-wrap justify-center gap-x-4 gap-y-1 text-xs text-zinc-400">diff --git a/frontend/src/components/FirstScreenBits.tsx b/frontend/src/components/FirstScreenBits.tsxnew file mode 100644index 00000000..658a661c--- /dev/null+++ b/frontend/src/components/FirstScreenBits.tsx@@ -0,0 +1,65 @@+import React from 'react';+import { Settings, X } from 'lucide-react';+import { spaceSublineParts, sublineText, type SpaceApprovals } from '../firstScreen';+import type { SpaceCounts } from '../spaces';++/**+ * The space header's sub-line (first-screen A): "3 bots · Dev mode · Approvals off · 1 account". The status+ * words are words, not controls; their settings live in Space settings › General.+ */+export function SpaceSubline({ counts, devOn, approvals }: { counts: SpaceCounts | undefined; devOn: boolean; approvals: SpaceApprovals }) {+ const parts = spaceSublineParts(counts, { devOn, approvals });+ if (!parts.length) return null;+ return (+ <span className="block text-meta text-zinc-400 truncate" title={sublineText(parts)} data-space-subline>+ {parts.map((p, i) => (+ <React.Fragment key={i}>+ {i > 0 && ' · '}+ {p.tone ? (+ <span className={p.tone === 'dev' ? 'text-sky-300' : 'text-warn'} data-subline-status={p.tone}>+ {p.text}+ </span>+ ) : (+ p.text+ )}+ </React.Fragment>+ ))}+ </span>+ );+}++/**+ * "Dev mode and Approvals moved to this space's settings." (0.9.8 and 0.9.9 only), where the controls block+ * used to sit. Remove with its key in 0.9.10.+ */+export function MovedPointer({ phone, onOpen, onHide }: { phone: boolean; onOpen: () => void; onHide: () => void }) {+ const hit = phone ? ' min-h-11 min-w-11 justify-center' : '';+ return (+ <div+ role="note"+ data-moved-pointer+ className="mt-1.5 flex items-center gap-2 rounded-xl border border-white/[0.07] bg-white/[0.025] py-2 pl-2.5 pr-1.5 text-[12px] leading-[18px] text-zinc-300"+ >+ <Settings size={14} className="shrink-0 text-zinc-400" aria-hidden="true" />+ <span className="flex-1 min-w-0">Dev mode and Approvals moved to this space's settings.</span>+ <button+ type="button"+ onClick={onOpen}+ data-moved-open+ className={`shrink-0 inline-flex items-center rounded-md px-1.5 text-sky-300 font-medium hover:text-sky-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400${hit}`}+ >+ Open+ </button>+ <button+ type="button"+ onClick={onHide}+ aria-label="Hide"+ title="Hide"+ data-moved-hide+ className={`shrink-0 inline-flex items-center justify-center rounded-md text-zinc-400 hover:text-zinc-100 hover:bg-zinc-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-sky-400 ${phone ? 'min-h-11 min-w-11' : 'h-6 w-6'}`}+ >+ <X size={14} aria-hidden="true" />+ </button>+ </div>+ );+}diff --git a/frontend/src/components/GetStarted.tsx b/frontend/src/components/GetStarted.tsxindex f17e5c44..064f90c5 100644--- a/frontend/src/components/GetStarted.tsx+++ b/frontend/src/components/GetStarted.tsx@@ -55,6 +55,7 @@ import {tileStatus,whereLabel,} from '../gettingStarted';+import { type StepTeam, type TeamStepView, teamDoneValue, teamStepView } from '../firstScreen';import { type InstallTrack, forgetInstall, installDetails, startInstall, useInstallTrack, useStartVersion } from '../gettingStartedInstall';const FOCUS = 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-400';@@ -459,7 +460,7 @@ const ClaudePaste: React.FC<{ api: LoginApi; phone: boolean; onDone: () => void;<li className="flex items-start gap-2.5">{dot(1, opened)}<div className="min-w-0 flex-1">- <p className="text-[13px] text-zinc-200">Open claude.ai and allow kwant bots.</p>+ <p className="text-[13px] text-zinc-200">Open claude.ai and allow kwant.</p><div className="mt-2"><Btn phone={phone} kind={opened ? 'secondary' : 'primary'} onClick={open} data-open-claude>{opened ? 'Open again' : 'Open claude.ai'}@@ -767,7 +768,9 @@ const TeamStep: React.FC<{onImported: () => void;/** Each Import or Undo inside the dialog, so the sidebar loads the new bots. */onImportChanged?: () => void;-}> = ({ phone, spaceName, mainSpace, botNames, onKeep, onPicked, onImported, onImportChanged }) => {+ /** First-screen D: what step 3 shows; a team here gives "Your team" and the Start tile. */+ view: TeamStepView;+}> = ({ phone, spaceName, mainSpace, botNames, onKeep, onPicked, onImported, onImportChanged, view }) => {const rt = useReadyTeams();const [importing, setImporting] = useState(false);const imported = useRef(false);@@ -782,11 +785,39 @@ const TeamStep: React.FC<{if (imported.current) onImported();else window.setTimeout(() => importTile.current?.focus(), 0);};- const templates = rt?.available ? (rt.templates ?? []) : [];+ const offered = new Set(view.templateIds);+ const templates = rt?.available ? (rt.templates ?? []).filter((t) => offered.has(t.id)) : [];+ const start = view.start;const tile = `w-full rounded-xl border text-left ${phone ? 'min-h-16 p-3' : 'p-3'} ${FOCUS}`;return (<div data-team-step>- <p className="text-xs text-zinc-400 mb-2.5">Each team has a lead, helpers and skills for one job. You can add more teams later.</p>+ <p className="text-xs text-zinc-400 mb-2.5">{view.intro}</p>+ {start && (+ <div+ data-start-team={start.handle}+ className={`mb-3 rounded-xl border border-sky-400/60 bg-sky-400/[0.08] p-3 flex gap-3 ${phone ? 'flex-col' : 'items-center'}`}+ >+ <span className="flex -space-x-2 shrink-0" aria-hidden="true">+ {start.members.slice(0, 3).map((b) => (+ <span key={b.id} className="flex rounded-[7px] ring-2 ring-[#16122b]">+ <ModernAvatar role={b.avatar_sprite} name={b.name} size={26} />+ </span>+ ))}+ </span>+ <span className="flex-1 min-w-0">+ <span className="block text-sm font-semibold text-zinc-50">Start with @{start.handle}</span>+ {start.line && <span className="block text-[12.5px] leading-[18px] text-zinc-300">{start.line}</span>}+ </span>+ <Btn kind="primary" phone={phone} data-start-button onClick={onKeep} className={`shrink-0 text-sm px-4${phone ? ' w-full' : ''}`}>+ Start+ </Btn>+ </div>+ )}+ {start && (+ <p className="text-2xs font-semibold uppercase tracking-wider text-zinc-400 mb-2" data-add-team-label>+ Or add a team for one job+ </p>+ )}<ul className={phone ? 'flex flex-col gap-2' : 'grid grid-cols-2 gap-2'}>{templates.map((t) => (<li key={t.id}>@@ -816,7 +847,7 @@ const TeamStep: React.FC<{</button></li>))}- <li>+ {!start && <li><button type="button" data-keep-starter onClick={onKeep} className={`${tile} h-full flex flex-col gap-1 border-dashed border-zinc-600 bg-transparent hover:border-zinc-500`}><span className="text-sm font-semibold text-zinc-100">{mainSpace ? 'Keep the starter bots' : 'Keep the bots you have'}</span><span className="text-[12.5px] leading-[18px] text-zinc-300">{mainSpace ? 'Architect, TechLead and DevOps, in #general.' : keepOwnBotsLine(botNames, spaceName)}</span>@@ -824,7 +855,7 @@ const TeamStep: React.FC<{Use ›</span></button>- </li>+ </li>}<li><buttonref={importTile}@@ -886,9 +917,13 @@ export interface GetStartedProps {onImported?: () => void;/** The space's `is_default`. Only the main space has the starter bots; left out counts as main. */mainSpace?: boolean;+ /** The space's teams: with one, step 3 is "Your team" with a Start tile (first-screen D). */+ teams?: StepTeam[];}-export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, reloadEngines, onDismissed, loginApiOverride, hostOverride, spaceName, onImported, mainSpace = true }) => {+const NO_TEAMS: StepTeam[] = [];++export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, reloadEngines, onDismissed, loginApiOverride, hostOverride, spaceName, onImported, mainSpace = true, teams = NO_TEAMS }) => {const api = loginApiOverride ?? defaultLoginApi;const phone = useMedia(PHONE_QUERY);useStartVersion();@@ -904,6 +939,8 @@ export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, reconst [resumed] = useState(() => !!chosen && !(engines && tileStatus(engines, chosen) === 'signed_in'));const v: StepsView = stepsView({ engines, chosen, teamEarly, changing });const kept = isKept(space);+ const rt = useReadyTeams();+ const teamView = teamStepView({ teams, bots, templates: rt?.templates ?? [], madeFrom: (id) => rt?.made(id)?.templateId });const importedHere = isImported(space);const titleId = useId();const stepIds = [useId(), useId(), useId()];@@ -966,6 +1003,11 @@ export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, reonDismissed();} else markStarted(space, 'kept');};+ // Start with @team: today's Keep, then the composer, so the next thing is the first ask.+ const startTeam = () => {+ keep();+ window.setTimeout(() => document.querySelector<HTMLTextAreaElement>('[data-composer-form] textarea')?.focus(), 0);+ };// "Bring your bots": like Keep, the card goes once step 2 is done; before that step 3 reads done.const importedBots = () => {if (v.done2) {@@ -1114,9 +1156,9 @@ export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, re<div className={`${row} border-t border-white/[.07]`} data-step="3">{head(3,- 'Pick a team',+ teamView.title,v.open === 3 && !done3 ? 'open' : done3 ? 'done' : 'todo',- done3 ? (importedHere ? 'Your imported bots' : mainSpace ? 'Starter bots' : 'Your bots') : undefined,+ done3 ? teamDoneValue({ imported: importedHere, mainSpace, startHandle: teamView.start?.handle ?? null }) : undefined,v.open === 2 && slow && !done3 ? (<Btn phone={phone} kind="link" className="ml-auto shrink-0" onClick={() => setTeamEarly(true)}>Open@@ -1130,7 +1172,8 @@ export const GetStarted: React.FC<GetStartedProps> = ({ space, bots, engines, respaceName={spaceName ?? 'this space'}mainSpace={mainSpace}botNames={bots.map((b) => b.name)}- onKeep={keep}+ onKeep={teamView.start ? startTeam : keep}+ view={teamView}onPicked={() => undefined}onImported={importedBots}onImportChanged={onImported}diff --git a/frontend/src/components/ModernAvatar.tsx b/frontend/src/components/ModernAvatar.tsxindex 6cfcb430..48b4d3bd 100644--- a/frontend/src/components/ModernAvatar.tsx+++ b/frontend/src/components/ModernAvatar.tsx@@ -21,6 +21,8 @@ interface ModernAvatarProps {kwantId?: string;/** The AI model badge (bottom-left) on avatars of 24 px and up; off for reply avatars in the chat. */modelBadge?: boolean;+ /** Eyes shut and still: the empty chat while nothing can run yet (first-screen E). */+ asleep?: boolean;}const noopUnsubscribe = () => undefined;@@ -433,6 +435,7 @@ export const ModernAvatar: React.FC<ModernAvatarProps> = ({className = '',kwantId,modelBadge = true,+ asleep = false,}) => {const working = useKwantWorking(kwantId);// Never green (or idle grey) while a turn runs: the turn stream wins over a stale status.@@ -480,7 +483,15 @@ export const ModernAvatar: React.FC<ModernAvatarProps> = ({<g className="kw-avatar-body">{renderCreature(creature).filter((r) => framed && !compact || r.key !== 'shadow')}{/* One blink when the person sends this bot a message: the eyes close for 160 ms. */}- {notices > 0 && (+ {asleep && (+ <g data-asleep>+ {px(10, 10, 2, 2, creature.body, 'sl1')}+ {px(14, 10, 2, 2, creature.body, 'sl2')}+ {px(10, 12, 2, 1, creature.shade, 'sl3')}+ {px(14, 12, 2, 1, creature.shade, 'sl4')}+ </g>+ )}+ {!asleep && notices > 0 && (<g key={notices} className="kw-avatar-blink">{px(10, 10, 2, 3, creature.body, 'bl1')}{px(14, 10, 2, 3, creature.body, 'bl2')}diff --git a/frontend/src/components/SetupNeededCard.tsx b/frontend/src/components/SetupNeededCard.tsxindex d4f1129d..0807c73f 100644--- a/frontend/src/components/SetupNeededCard.tsx+++ b/frontend/src/components/SetupNeededCard.tsx@@ -29,8 +29,8 @@ export const SetupNeededCard: React.FC<Props> = ({ meta, botName, spaceName, canconst detail = fixed? `An account works in ${spaceName} now. Send your message again to get a reply.`: meta.reason === 'host_off'- ? `This machine is off in ${spaceName} and no other account is on. Turn one on, or add an account.`- : `No account can run bots in ${spaceName} yet. Sign in with Claude, Codex or Grok, or add an API key.`;+ ? `This computer's AI accounts are off in ${spaceName} and no other account is on. Turn one on, or add an account.`+ : `No account can run bots in ${spaceName} yet. Sign in with Claude, ChatGPT or Grok, or add an API key.`;return (<div className={`flex items-start gap-3.5 w-full max-w-5xl rounded-xl ${flash ? 'kw-flash' : ''}`} data-setup-card={meta.reason}><divdiff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsxindex 05b3cdb8..829884d5 100644--- a/frontend/src/components/Sidebar.tsx+++ b/frontend/src/components/Sidebar.tsx@@ -7,7 +7,7 @@ import { canRunNow, engineTip, isUsable, pinnedCantRun, type RunsOn } from '../eimport { statusOf, statusText, type BotStatus } from '../botStatus';import { EnginesApi, useEngines } from '../useEngines';import { claudeNeedsSignIn } from '../claudeLogin';-import { Space, spaceSummary, spaceSummaryTitle } from '../spaces';+import { Space } from '../spaces';import { SpaceSwitcher, SpaceTile } from './Spaces';import { isMac } from './LayaStatus';import { ApprovalsOffBadge } from './ApprovalsSetting';@@ -18,10 +18,8 @@ import { InstallAppButton } from './InstallAppButton';import { trapFocusTarget } from '../imports';import { type AttentionRow, type NeedsYouRow, PINNED_RANK, workingIds, directIds, rollupLabel } from '../chatsTab';import type { InboxItem } from '../api/inbox';-import { DevFlipNote, useDevMode } from './DevModeSwitch';-import { SpaceControls } from './SpaceControls';-import { DevOnToast } from './DevOnToast';-import { type DevModeState, deskIntent, turnDevMode } from '../devMode';+import { useDevMode } from './DevModeSwitch';+import { MovedPointer, SpaceSubline } from './FirstScreenBits';import { DevDeskRow } from './DevDesk';import { GlobeSlot, WatchGlobe, useFadeOut, useLingeringIds } from './WatchLive';import type { Browsing } from '../watchLive';@@ -167,6 +165,10 @@ export interface SidebarProps {onOpenDevDesk?: () => void;/** Dev mode Connect (flow F5): opens Loose ends on the GitHub form; after connecting the app returns to the Dev desk. */onConnectDevGitHub?: () => void;+ /** First-screen A (0.9.8 and 0.9.9): "Dev mode and Approvals moved to this space's settings." for past users. */+ movedPointer?: boolean;+ onOpenMoved?: () => void;+ onHideMoved?: () => void;/** Idea jar (0.7): ready takes for the violet badge, whether its page is open, how to open it, and the quick-add. Hidden on phone, which has the Jar tab. */ideaJarCount?: number;ideaJarActive?: boolean;@@ -387,7 +389,9 @@ export const Sidebar: React.FC<SidebarProps> = ({missionsActive = false,devDeskActive = false,onOpenDevDesk,- onConnectDevGitHub,+ movedPointer = false,+ onOpenMoved,+ onHideMoved,onOpenMissions,ideaJarCount = 0,ideaJarActive = false,@@ -496,50 +500,9 @@ export const Sidebar: React.FC<SidebarProps> = ({return selectedId === c.id;};- // Dev mode and Approvals live in the space controls block under the header (explainer spec §1).+ // Dev mode and Approvals live in Space settings › General (first-screen A); the header names them.const dev = useDevMode(space.id);const devOn = !!dev?.on;- // The off note under the header (flow copy §7: HEAD → main, with Turn back on).- const [devOffNote, setDevOffNote] = useState(false);- const dismissDevOff = useCallback(() => setDevOffNote(false), []);- useEffect(() => setDevOffNote(false), [space.id]);- // Flow F3: switching on keeps the person where they are; a toast says what was found, with one next- // step and Undo. It replaces the HEAD → dev note. The toast reads the live store, so a "checking"- // toast updates in place when the status arrives.- const [devOnToast, setDevOnToast] = useState<DevModeState | null>(null);- const closeDevOnToast = useCallback(() => setDevOnToast(null), []);- useEffect(() => setDevOnToast(null), [space.id]);- const showOn = (s: DevModeState) => {- setDevOffNote(false);- setDevOnToast(s);- };- const focusDevSwitch = () => setTimeout(() => document.querySelector<HTMLElement>('[data-dev-switch]')?.focus(), 0);- const connectDev = onConnectDevGitHub ? () => onConnectDevGitHub() : undefined;- const typeDevRepo = () => {- deskIntent.set(space.id, 'type');- onOpenDevDesk?.();- };- const seeDevRepos = () => {- deskIntent.set(space.id, 'repos');- onOpenDevDesk?.();- };- const spaceControls = (- <SpaceControls- space={{ id: space.id, name: space.name, approvals: space.approvals }}- phone={phone}- bots={kwants}- onTurnedOn={showOn}- onTurnedOff={() => {- setDevOnToast(null);- setDevOffNote(true);- }}- onOpenDevDesk={onOpenDevDesk}- onSeeRepos={onOpenDevDesk ? seeDevRepos : undefined}- onLinkRepo={onOpenDevDesk ? typeDevRepo : undefined}- onConnect={connectDev}- onOpenSettings={onOpenSpaceSettings}- />- );// Phones: section titles stay pinned while their list scrolls, so they are never cut offconst sectionHead = `px-2 py-1 min-w-0 flex items-center justify-between gap-2 text-2xs font-semibold text-zinc-400 uppercase tracking-wider${phone ? ' kw-sticky-head sticky top-0 z-10' : ''@@ -939,7 +902,7 @@ export const Sidebar: React.FC<SidebarProps> = ({return (<asideref={asideRef}- aria-label={`${space.name} chats and kwant bots`}+ aria-label={`${space.name} chats and bots`}data-kw-sidebarclassName={`${phone ? 'w-full flex-1 min-h-0' : 'w-64 h-full border-r border-hairline'} bg-surface-side flex flex-col select-none flex-shrink-0`}>@@ -962,7 +925,7 @@ export const Sidebar: React.FC<SidebarProps> = ({<SpaceTile space={space} size={32} dev={false} /><span className="flex-1 min-w-0"><span className="block text-body font-semibold text-zinc-50 truncate">{space.name}</span>- <span className="block text-meta text-zinc-400 truncate" title={spaceSummaryTitle(space.counts)}>{spaceSummary(space.counts)}</span>+ <SpaceSubline counts={space.counts} devOn={devOn} approvals={space.approvals} /></span><ChevronDown size={14} className={`shrink-0 text-zinc-500 transition-transform ${switcherOpen ? 'rotate-180' : ''}`} aria-hidden="true" /></button>@@ -972,7 +935,7 @@ export const Sidebar: React.FC<SidebarProps> = ({<SpaceTile space={space} size={32} dev={false} /><span className="flex-1 min-w-0"><h1 className="text-body font-semibold text-zinc-50 truncate">{space.name}</h1>- <span className="block text-meta text-zinc-400 truncate" title={spaceSummaryTitle(space.counts)}>{spaceSummary(space.counts)}</span>+ <SpaceSubline counts={space.counts} devOn={devOn} approvals={space.approvals} /></span><buttontype="button"@@ -989,24 +952,7 @@ export const Sidebar: React.FC<SidebarProps> = ({</button></div>)}- {spaceControls}- {devOffNote && <DevFlipNote on={false} approvals={space.approvals} onDismiss={dismissDevOff} onTurnBackOn={() => turnDevMode(space.id, true).then(showOn)} />}- {devOnToast && devOn && (- <DevOnToast- state={dev ?? devOnToast}- phone={phone}- onOpenDesk={() => onOpenDevDesk?.()}- onConnect={connectDev}- onTypeRepo={typeDevRepo}- onUndo={() =>- turnDevMode(space.id, false).then(() => {- setDevOffNote(true);- focusDevSwitch();- })- }- onClose={closeDevOnToast}- />- )}+ {movedPointer && onOpenMoved && onHideMoved && <MovedPointer phone={phone} onOpen={onOpenMoved} onHide={onHideMoved} />}{phone && switcherOpen && (<SpaceSwitcherspaces={spaces}@@ -1121,7 +1067,7 @@ export const Sidebar: React.FC<SidebarProps> = ({key={c.id}onClick={() => onSelectChannel(c)}// The channel's header says it too; no pill on every row- title={layaRoutes(c, kwants.length) ? 'Laya picks who answers here' : undefined}+ title={layaRoutes(c, kwants.length) ? 'The best fit answers here' : undefined}className={`w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-xl text-body font-medium transition-colors text-left ${active? 'bg-zinc-800 text-zinc-100 shadow-sm border border-zinc-700/50'diff --git a/frontend/src/components/SpaceReadyCard.tsx b/frontend/src/components/SpaceReadyCard.tsxindex 81c35b4f..10ee679d 100644--- a/frontend/src/components/SpaceReadyCard.tsx+++ b/frontend/src/components/SpaceReadyCard.tsx@@ -83,7 +83,7 @@ export const SpaceReadyCard: React.FC<SpaceReadyCardProps> = ({ spaceName, tile,action: { label: 'Add an account', icon: <KeyRound size={13} />, onClick: onAddAccount },},botsStep,- { done: false, title: 'Message #general', detail: `Laya picks who answers, only from ${spaceName}'s bots.` },+ { done: false, title: 'Message #general', detail: `The best fit answers, only from ${spaceName}'s bots.` },];return (diff --git a/frontend/src/firstScreen.ts b/frontend/src/firstScreen.tsnew file mode 100644index 00000000..f4686abf--- /dev/null+++ b/frontend/src/firstScreen.ts@@ -0,0 +1,232 @@+// 0.9.8 first screen for anyone (autonomy/first-screen/design.md, Mira): the pure parts, so tests can+// check the words and the gating without a DOM. A: the space header's status words and the "moved"+// pointer. D: Get started step 3 when the space already has a team. E: the "Connect an AI account" card.++import type { SpaceCounts } from './spaces';+import { spaceSummary } from './spaces';++// ------------------------------------------------------------------ A: the header sub-line++export type SpaceApprovals = 'ask' | 'smart' | 'off' | string | null | undefined;++/** One run of the sub-line; `tone` colours a status word (Dev mode sky, Approvals off amber). */+export interface SublinePart {+ text: string;+ tone?: 'dev' | 'off';+}++/**+ * The space header's sub-line: the bot count, then the status words (Dev mode, then Approvals off), then+ * the rest of today's summary. Status sits right after the count so `truncate` cuts the accounts first.+ * Ask and When risky add nothing: only the settings that change how bots behave are named.+ */+export function spaceSublineParts(counts: SpaceCounts | undefined, s: { devOn?: boolean; approvals?: SpaceApprovals }): SublinePart[] {+ const summary = spaceSummary(counts);+ if (!summary) return [];+ const [count, ...rest] = summary.split(' · ');+ const out: SublinePart[] = [{ text: count }];+ if (s.devOn) out.push({ text: 'Dev mode', tone: 'dev' });+ if (s.approvals === 'off') out.push({ text: 'Approvals off', tone: 'off' });+ for (const r of rest) out.push({ text: r });+ return out;+}++/** The whole sub-line as one string, for its `title`. */+export const sublineText = (parts: SublinePart[]): string => parts.map((p) => p.text).join(' · ');++// ------------------------------------------------------------------ A: the "moved" pointer (0.9.8 and 0.9.9)++/** Set once Open or ✕ was pressed. Remove the pointer and this key in 0.9.10. */+export const MOVED_KEY = 'kwnt:moved-space-controls';++const store = (): Storage | null => {+ try {+ return typeof localStorage === 'undefined' ? null : localStorage;+ } catch {+ return null;+ }+};++export const movedSeen = (): boolean => {+ try {+ return !!store()?.getItem(MOVED_KEY);+ } catch {+ return false;+ }+};++export function markMovedSeen(): void {+ try {+ store()?.setItem(MOVED_KEY, '1');+ } catch {+ /* private mode: it shows again next time, which is harmless */+ }+}++/**+ * Only someone who used kwant before sees it: the same `established` What's new works out (true only, so a+ * brand-new person and "can't tell yet" both get nothing), and never again once Open or ✕ set the key.+ */+export const movedPointerShows = (opts: { established: boolean | null; seen: boolean }): boolean => opts.established === true && !opts.seen;++// ------------------------------------------------------------------ E: the account card++/**+ * "Connect an AI account to start": only when nothing can run (`canRun === false`; null is still checking),+ * and never while Get started is on screen, whose own steps already cover it.+ */+export const accountCardShows = (opts: { canRun: boolean | null | undefined; getStartedShowing: boolean }): boolean =>+ opts.canRun === false && !opts.getStartedShowing;++/** The four ways in, as static chips: the name and, for two of them, the plan it needs. */+export const ACCOUNT_WAYS: ReadonlyArray<{ name: string; plan?: string }> = [+ { name: 'Claude', plan: 'Pro or Max' },+ { name: 'ChatGPT', plan: 'plan' },+ { name: 'Grok' },+ { name: 'API key' },+];++// ------------------------------------------------------------------ D: Get started step 3++/** "A", "A and B", "A, B and C". */+export function namesLine(names: string[]): string {+ const n = names.filter((x) => x && x.trim());+ if (n.length <= 1) return n[0] ?? '';+ return `${n.slice(0, -1).join(', ')} and ${n[n.length - 1]}`;+}++export interface StepTeam {+ id: string;+ name: string;+ lead_kwant_id?: string | null;+ member_kwants?: string[] | string | null;+ created_at?: string | null;+ /** The server's record of which ready-made team made it, when it has one. */+ created_from_template?: string | null;+}+export interface StepBot {+ id: string;+ name: string;+ avatar_sprite?: string;+}+export interface StepTemplate {+ id: string;+ handle: string;+ card_line: string;+ used_in_space?: boolean;+}++export interface StartTile {+ handle: string;+ /** The members, lead first: their real names and faces. */+ members: StepBot[];+ /** "Assistant, Researcher and Writer." plus the template's card line when a template made the team. */+ line: string;+ /** The template this team came from, if any. */+ templateId: string | null;+}++export interface TeamStepView {+ title: string;+ intro: string;+ /** Null when the space has no team: no Start tile, the old step 3. */+ start: StartTile | null;+ /** The template tiles to offer, without any template a team here was already made from. */+ templateIds: string[];+}++const ids = (v: StepTeam['member_kwants']): string[] => {+ if (Array.isArray(v)) return v;+ if (typeof v !== 'string') return [];+ try {+ const p = JSON.parse(v);+ return Array.isArray(p) ? p.filter((x): x is string => typeof x === 'string') : [];+ } catch {+ return [];+ }+};++/**+ * Which template made a team. The server's catalogue says per template whether a live team in this space came+ * from it (`used_in_space`); a seeded team (the fresh install's @helpers) may not have that record, so a team+ * whose handle is a template's handle counts too.+ */+export function templateOfTeam(team: StepTeam, templates: StepTemplate[], madeFrom?: string | null): StepTemplate | null {+ if (madeFrom) return templates.find((t) => t.id === madeFrom) ?? null;+ return templates.find((t) => t.handle === team.name) ?? null;+}++export const PICK_TITLE = 'Pick a team';+export const PICK_INTRO = 'Each team has a lead, helpers and skills for one job. You can add more teams later.';+export const YOUR_TEAM_TITLE = 'Your team';+export const YOUR_TEAM_INTRO = 'Your space comes with a team for everyday asks. Start with it, or add a team made for one job.';++/**+ * Step 3: with a team in the space, "Your team" and a Start tile for its first (oldest) team; without one, the+ * old "Pick a team". Templates already used here are hidden, so Helpers never shows twice.+ */+export function teamStepView(opts: {+ teams: StepTeam[];+ bots: StepBot[];+ templates: StepTemplate[];+ /** What this browser or the server knows made a team: team id → template id. */+ madeFrom?: (teamId: string) => string | null | undefined;+}): TeamStepView {+ const { teams, bots, templates } = opts;+ const byId = new Map(bots.map((b) => [b.id, b]));+ const ordered = [...teams].sort((a, b) => (a.created_at ?? '').localeCompare(b.created_at ?? ''));+ const team = ordered.find((t) => byId.has(t.lead_kwant_id ?? '') || ids(t.member_kwants).some((id) => byId.has(id))) ?? null;+ const usedIds = new Set<string>();+ for (const t of templates) if (t.used_in_space) usedIds.add(t.id);+ for (const t of teams) {+ const tpl = templateOfTeam(t, templates, opts.madeFrom?.(t.id) ?? t.created_from_template ?? null);+ if (tpl) usedIds.add(tpl.id);+ }+ const templateIds = templates.filter((t) => !usedIds.has(t.id)).map((t) => t.id);+ if (!team) return { title: PICK_TITLE, intro: PICK_INTRO, start: null, templateIds };+ const order = [team.lead_kwant_id ?? '', ...ids(team.member_kwants)].filter((id, i, a) => id && a.indexOf(id) === i);+ const members = order.map((id) => byId.get(id)).filter((b): b is StepBot => !!b);+ const tpl = templateOfTeam(team, templates, opts.madeFrom?.(team.id) ?? team.created_from_template ?? null);+ const names = namesLine(members.map((m) => m.name));+ const line = [names ? `${names}.` : '', tpl?.card_line ?? ''].filter(Boolean).join(' ');+ return {+ title: YOUR_TEAM_TITLE,+ intro: YOUR_TEAM_INTRO,+ start: { handle: team.name, members, line, templateId: tpl?.id ?? null },+ templateIds,+ };+}++/** Step 3's done value: "@helpers" after Start, else what it said before. */+export function teamDoneValue(opts: { imported: boolean; mainSpace: boolean; startHandle: string | null }): string {+ if (opts.imported) return 'Your imported bots';+ if (opts.startHandle) return `@${opts.startHandle}`;+ return opts.mainSpace ? 'Starter bots' : 'Your bots';+}++/** Ring classes for the Dev mode card after Open; Tailwind sees them here. */+const RING_ON = ['ring-2', 'ring-sky-400/55', 'transition-[box-shadow]', 'duration-[160ms]', 'motion-reduce:transition-none'];++/**+ * After Open: find the Dev mode card in Space settings › General (it mounts a frame or two later), scroll it+ * into view and ring it once, 1.2 s, then a 160 ms fade (static and simply removed under reduced motion).+ */+export function ringDevSettings(doc: Document = document, tries = 20): void {+ const el = doc.querySelector<HTMLElement>('[data-dev-settings]');+ if (!el) {+ if (tries > 0) setTimeout(() => ringDevSettings(doc, tries - 1), 50);+ return;+ }+ const reduce = !!doc.defaultView?.matchMedia?.('(prefers-reduced-motion: reduce)').matches;+ el.scrollIntoView({ block: 'center', behavior: reduce ? 'auto' : 'smooth' });+ el.classList.add(...RING_ON);+ el.setAttribute('data-moved-ring', '');+ setTimeout(() => {+ el.classList.remove('ring-sky-400/55');+ el.classList.add('ring-transparent');+ setTimeout(() => {+ el.classList.remove(...RING_ON, 'ring-transparent');+ el.removeAttribute('data-moved-ring');+ }, reduce ? 0 : 160);+ }, 1200);+}diff --git a/frontend/src/gettingStarted.ts b/frontend/src/gettingStarted.tsindex e81f5b44..583c96e8 100644--- a/frontend/src/gettingStarted.ts+++ b/frontend/src/gettingStarted.ts@@ -128,11 +128,11 @@ export function heroText(v: StepsView, opts: { host?: string | null; mac?: booleif (v.open === 3 && v.done2 && v.foundReady)return {title: `${name} is ready ${opts.host ? `on ${opts.host}` : opts.mac ? 'on this Mac' : 'on this computer'}`,- sub: 'You were already signed in. Pick a team and say hello.',+ sub: 'You were already signed in. Meet your team and say hello.',};- if (v.open === 3 && v.done2) return { title: `${name} is ready`, sub: 'Last step: who should your bots be?' };+ if (v.open === 3 && v.done2) return { title: `${name} is ready`, sub: 'Last step: meet your team.' };return {- title: 'Welcome to kwant bots',+ title: 'Welcome to kwant',sub: opts.host? 'Choose your AI and sign in. It installs on your server, not on this phone.': 'Choose your AI and sign in. The rest installs by itself.',@@ -476,7 +476,7 @@ export function showCard(opts: { dismissed: boolean; canRun: boolean | null; genif (opts.mainSpace === false) return false;if (opts.started) return true;if (opts.canRun === null) return false;- // A fresh install comes with one starter team (core-engineering), so one team still counts as fresh.+ // A fresh install comes with one starter team (helpers), so one team still counts as fresh.return opts.generalMessages === 0 && opts.teams <= 1;}diff --git a/frontend/src/suggestedPrompts.ts b/frontend/src/suggestedPrompts.tsindex d5dc98fb..c787ca95 100644--- a/frontend/src/suggestedPrompts.ts+++ b/frontend/src/suggestedPrompts.ts@@ -12,7 +12,7 @@ export type PromptContext =| { kind: 'team'; members: PromptBot[]; lead?: string; purpose?: string }/** A chat with one bot. */| { kind: 'bot'; bot: PromptBot }- /** #general: Laya picks who answers, so prompts don't name anyone. */+ /** #general: the best fit answers, so prompts don't name anyone. */| { kind: 'general'; bots: PromptBot[] };/** Chips in a 1:1 chat and #general; a team gets one more so a third member has an ask too. */@@ -202,8 +202,9 @@ export function suggestedPrompts(ctx: PromptContext): string[] {if (ctx.kind === 'general') {const bots = (ctx.bots ?? []).filter(named);if (!bots.length) return [];- const asks = distinctAsks(bots, MAX_PROMPTS - 1).map(([, ask]) => capitalize(ask));- return [...asks, 'Who here can help me with what?'];+ // Up to three different roles' asks; the filler only takes a slot that no role fills.+ const asks = distinctAsks(bots, MAX_PROMPTS).map(([, ask]) => capitalize(ask));+ return asks.length < MAX_PROMPTS ? [...asks, 'Who here can help me with what?'] : asks;}const members = (ctx.members ?? []).filter(named);diff --git a/frontend/tests/approvalsOff.test.mjs b/frontend/tests/approvalsOff.test.mjsindex 8430f3a3..c879c16c 100644--- a/frontend/tests/approvalsOff.test.mjs+++ b/frontend/tests/approvalsOff.test.mjs@@ -215,27 +215,26 @@ test('the marker has an icon and words, not colour alone', () => {assert.match(m.badge({ onClick: () => {} }), /^<button type="button"/);});-test('sidebar: the bot list marks only bots that run without asking, and the Approvals row says so', () => {+test('sidebar: the bot list marks only bots that run without asking; the Approvals control lives in Space settings (first-screen A)', () => {const html = m.sidebar({ space: space('ask'), kwants: [bot('k1', 'Dev', 'off', 'off'), bot('k2', 'Writer', 'inherit', 'ask')] });const rows = html.split('group/fleet').slice(1);assert.equal(rows.length, 2);assert.match(rows[0], /Dev[\s\S]*sr-only">Approvals off/);assert.doesNotMatch(rows[1], /Approvals off/);- assert.match(html, /data-approvals-value="ask"/);- assert.match(html, /data-approvals-sub="true"><span[^>]*>Off for 1 bot</);+ assert.doesNotMatch(html, /data-approvals-value|data-space-controls/, 'no Approvals row under the header any more');+ assert.doesNotMatch(html, /data-subline-status="off"/, 'the space asks, so the header names nothing');assert.doesNotMatch(text(html), /Approvals off for/, 'the amber header pill is gone (spec §5)');});-test('sidebar: space off shows Off in the Approvals row; Ask with no sub-line while every bot asks; no row on an older server', () => {+test('sidebar: space off says "Approvals off" in the header sub-line; Ask and an older server say nothing (first-screen A)', () => {const off = m.sidebar({ space: space('off'), kwants: [bot('k1', 'Dev', 'inherit', 'off')] });- assert.match(off, /data-approvals-value="off"/);- assert.match(text(off), /Approvals Off Bots act without asking/);+ assert.match(off, /data-subline-status="off"[^>]*>Approvals off</);+ assert.doesNotMatch(off, /data-approvals-value/);const asking = m.sidebar({ space: space('ask'), kwants: [bot('k1', 'Dev', 'inherit', 'ask')] });- assert.match(asking, /data-approvals-value="ask"/);- assert.doesNotMatch(asking, /data-approvals-sub/);+ assert.doesNotMatch(asking, /data-subline-status/);assert.doesNotMatch(text(asking), /Approvals off/);const older = m.sidebar({ space: space(undefined), kwants: [bot('k1', 'Dev', undefined, undefined)] });- assert.doesNotMatch(older, /data-sc-row="approvals"/);+ assert.doesNotMatch(older, /data-sc-row="approvals"|data-subline-status/);assert.doesNotMatch(text(older), /Approvals off/);});@@ -243,7 +242,7 @@ test('every approvals-off hover hint says payments still ask: badge, sidebar rowassert.match(m.badge({}), /title="[^"]*Payments still ask you\.[^"]*"/);const html = m.sidebar({ space: space('off'), kwants: [bot('k1', 'Dev', 'inherit', 'off')] });const tips = [...html.matchAll(/title="([^"]*without asking[^"]*)"/g)].map((x) => x[1]);- assert.equal(tips.length, 1, 'said once, on the Approvals row value: a bot that matches the space adds no icon');+ assert.equal(tips.length, 0, 'a bot that matches the space adds no icon; the header only names the state, the settings card explains it');for (const t of tips) assert.match(t, /Payments still ask you\./);const differing = m.sidebar({ space: space('ask'), kwants: [bot('k1', 'Dev', 'off', 'off')] });const botTips = [...differing.matchAll(/title="([^"]*without asking[^"]*)"/g)].map((x) => x[1]);diff --git a/frontend/tests/devMode.test.mjs b/frontend/tests/devMode.test.mjsindex faf51a5a..e4c707a3 100644--- a/frontend/tests/devMode.test.mjs+++ b/frontend/tests/devMode.test.mjs@@ -619,10 +619,16 @@ test('DOM: a failed Turn on keeps the sheet open with the server’s reason', as// ---------------------------------------------------------------------------// Settings, Connections, the desk, the looks-test('Settings › Dev mode: hidden before the first switch-on; saves repo, branch, backup command; Turn off', async () => {+test('Settings › Dev mode: shown before the first switch-on with Turn on (0.9.8); saves repo, branch, backup command; Turn off', async () => {reset();let v = await mount(h(m.DevModeSettings, { spaceId: 'spc_demo', spaceName: 'Demo' }));- assert.equal(!!v.host.querySelector('[data-dev-settings]'), false);+ const first = v.host.querySelector('[data-dev-settings]');+ assert.ok(first, 'the header switch is gone, so the card must be there to turn it on the first time');+ assert.doesNotMatch(first.textContent, /switch next to/);+ assert.equal(first.querySelector('[data-dev-turn-off]'), null);+ await click(first.querySelector('[data-dev-turn-on]'));+ assert.deepEqual(server.calls.filter(([meth]) => meth === 'PUT').at(-1)[2], { on: true });+ assert.equal(m.devStore.isOn('spc_demo'), true);v.root.unmount();reset({ ...off, on: true, repo: 'demo-org/demo-app', branch: 'main', polled_at: 'x' });@@ -645,7 +651,8 @@ test('Settings › Dev mode: hidden before the first switch-on; saves repo, branawait click(form.querySelector('[data-dev-turn-off]'));assert.deepEqual(server.calls.filter(([meth]) => meth === 'PUT').at(-1)[2], { on: false });assert.equal(m.devStore.isOn('spc_demo'), false);- assert.match(form.textContent, /Off\. Reviews, the ship gate and the production floor are stopped/);+ assert.match(form.textContent, /Off\. Reviews, the ship gate and the production floor are stopped\. Approvals stay as you set them above\./);+ assert.doesNotMatch(form.textContent, /approvals stay on/);v.root.unmount();});diff --git a/frontend/tests/firstScreen.test.mjs b/frontend/tests/firstScreen.test.mjsnew file mode 100644index 00000000..14f18d4e--- /dev/null+++ b/frontend/tests/firstScreen.test.mjs@@ -0,0 +1,286 @@+// 0.9.8 first screen for anyone (autonomy/first-screen/design.md, Mira). A: Dev mode and Approvals leave the+// sidebar for Space settings, the header names them, and a one-time pointer says where they went. C: #general's+// three role asks. D: Get started step 3 when the space already has a team. E: the "Connect an AI account" card.+import assert from 'node:assert/strict';+import test from 'node:test';+import { readFileSync } from 'node:fs';+import { JSDOM } from 'jsdom';+import { loadBundled } from './bundle.mjs';++const dom = new JSDOM('<!doctype html><html><body></body></html>', { url: 'http://localhost/', pretendToBeVisual: true });+const g = globalThis;+for (const k of ['window', 'document', 'navigator', 'HTMLElement', 'Element', 'Node', 'Event', 'MouseEvent', 'KeyboardEvent', 'requestAnimationFrame', 'cancelAnimationFrame', 'getComputedStyle', 'localStorage', 'sessionStorage']) {+ if (!(k in dom.window)) continue;+ Object.defineProperty(g, k, { value: dom.window[k], configurable: true, writable: true });+}+g.window.matchMedia = g.window.matchMedia || ((q) => ({ matches: false, media: q, addEventListener() {}, removeEventListener() {} }));+g.fetch = g.window.fetch = async () => new Response('{}', { status: 404, headers: { 'Content-Type': 'application/json' } });++const m = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { Sidebar } from './src/components/Sidebar';+ import { SpaceSubline, MovedPointer } from './src/components/FirstScreenBits';+ import { BotHome, AccountCard } from './src/components/BotHome';+ export { React };+ export { createRoot } from 'react-dom/client';+ export { flushSync } from 'react-dom';+ export * from './src/firstScreen';+ export { suggestedPrompts } from './src/suggestedPrompts';+ export { GetStarted } from './src/components/GetStarted';+ export { MovedPointer, AccountCard };+ const r = (C, p) => renderToStaticMarkup(React.createElement(C, p));+ const engines = { engines: [], loading: false, error: null, refresh: () => {} };+ export const sidebar = (p) =>+ r(Sidebar, {+ spaces: [], onSwitchSpace() {}, onCreateSpace() {}, onOpenSpaceSettings() {}, onOpenArchived() {}, onOpenSearch() {}, onOpenRoutines() {},+ channels: [], teams: [], selectedId: '', isChannel: false, onSelectKwant() {}, onSelectChannel() {}, onSelectTeam() {}, onSummonKwant() {}, onCreateTeam() {},+ engines, kwants: [], ...p,+ });+ export const subline = (p) => r(SpaceSubline, p);+ export const pointer = (p) => r(MovedPointer, { phone: false, onOpen() {}, onHide() {}, ...p });+ export const botHome = (p) => r(BotHome, p);+`);+const { React, createRoot, flushSync } = m;+const h = React.createElement;+const text = (html) => html.replace(/<[^>]+>/g, ' ').replace(/'|'/g, "'").replace(/&/g, '&').replace(/\s+/g, ' ').trim();+const settle = async (n = 6) => {+ for (let i = 0; i < n; i++) await new Promise((r) => setTimeout(r, 0));+};+function mount(el) {+ const host = document.createElement('div');+ document.body.appendChild(host);+ const root = createRoot(host);+ flushSync(() => root.render(el));+ return { host, done: () => (root.unmount(), host.remove()) };+}+const src = (f) => readFileSync(new URL(`../src/${f}`, import.meta.url), 'utf8');+const space = (approvals, counts = { bots: 3, ready_accounts: 1, unread: 0 }) => ({ id: 'spc_1', name: 'Work', icon: 'W', color: null, sort: 0, is_default: true, archived_at: null, created_at: '', general_channel_id: null, counts, approvals });++// ------------------------------------------------------------------ A: the header sub-line++test('A: the header sub-line names Dev mode and Approvals off right after the bot count, in that order', () => {+ const c = { bots: 3, ready_accounts: 1, unread: 0 };+ const words = (s) => m.spaceSublineParts(c, s).map((p) => (p.tone ? `<${p.text}>` : p.text)).join(' · ');+ assert.equal(words({}), '3 bots · 1 account', 'default: unchanged');+ assert.equal(words({ approvals: 'ask' }), '3 bots · 1 account', 'Ask adds nothing');+ assert.equal(words({ approvals: 'smart' }), '3 bots · 1 account', 'When risky adds nothing');+ assert.equal(words({ devOn: true }), '3 bots · <Dev mode> · 1 account');+ assert.equal(words({ approvals: 'off' }), '3 bots · <Approvals off> · 1 account');+ assert.equal(words({ devOn: true, approvals: 'off' }), '3 bots · <Dev mode> · <Approvals off> · 1 account');+ assert.deepEqual(m.spaceSublineParts(undefined, { devOn: true }), [], 'no counts yet: nothing');+});++test('A: the sub-line colours the words (sky, amber) and its title has the whole line', () => {+ const html = m.subline({ counts: { bots: 5, ready_accounts: 2, unread: 0 }, devOn: true, approvals: 'off' });+ assert.match(html, /title="5 bots · Dev mode · Approvals off · 2 accounts"/);+ assert.match(html, /class="text-sky-300" data-subline-status="dev">Dev mode</);+ assert.match(html, /class="text-warn" data-subline-status="off">Approvals off</);+ assert.match(html, /truncate/);+ assert.equal(text(html), '5 bots · Dev mode · Approvals off · 2 accounts');+});++test('A: the sidebar has no Space controls block, Dev mode toast or flip note; the header says Approvals off (desktop and phone)', () => {+ for (const phone of [false, true]) {+ const html = m.sidebar({ space: space('off'), phone, section: phone ? 'chats' : undefined });+ assert.doesNotMatch(html, /data-space-controls|data-sc-row|data-dev-switch|data-dev-on-toast|data-dev-flip/);+ assert.match(html, /data-subline-status="off"[^>]*>Approvals off</);+ assert.match(html, /aria-label="Work chats and bots"/);+ }+ const app = src('components/Sidebar.tsx');+ assert.doesNotMatch(app, /<SpaceControls|<DevOnToast|<DevFlipNote/);+});++// ------------------------------------------------------------------ A: the "moved" pointer++test('A: the pointer shows only to someone who used kwant before, until Open or Hide sets the key', () => {+ assert.equal(m.movedPointerShows({ established: true, seen: false }), true);+ assert.equal(m.movedPointerShows({ established: false, seen: false }), false, 'a brand-new person');+ assert.equal(m.movedPointerShows({ established: null, seen: false }), false, 'still working it out');+ assert.equal(m.movedPointerShows({ established: true, seen: true }), false);+ localStorage.clear();+ assert.equal(m.movedSeen(), false);+ m.markMovedSeen();+ assert.equal(localStorage.getItem('kwnt:moved-space-controls'), '1');+ assert.equal(m.movedSeen(), true);+ localStorage.clear();+});++test('A: the pointer sits under the header with its copy, Open and Hide; nothing without the prop', () => {+ const on = m.sidebar({ space: space('ask'), movedPointer: true, onOpenMoved() {}, onHideMoved() {} });+ const header = on.indexOf('data-space-header');+ const ptr = on.indexOf('data-moved-pointer');+ assert.ok(header > -1 && ptr > header, 'right under the header');+ assert.match(text(on), /Dev mode and Approvals moved to this space's settings\. Open/);+ assert.match(on, /aria-label="Hide"/);+ assert.doesNotMatch(m.sidebar({ space: space('ask') }), /data-moved-pointer/);+});++test('A: Open and Hide call back; on a phone both have a 44 px hit area, 24 px Hide on desktop', () => {+ let opened = 0;+ let hidden = 0;+ const r = mount(h(m.MovedPointer, { phone: true, onOpen: () => opened++, onHide: () => hidden++ }));+ const open = r.host.querySelector('[data-moved-open]');+ const hide = r.host.querySelector('[data-moved-hide]');+ assert.match(open.className, /min-h-11 min-w-11/);+ assert.match(hide.className, /min-h-11 min-w-11/);+ open.click();+ hide.click();+ assert.deepEqual([opened, hidden], [1, 1]);+ r.done();+ assert.match(m.pointer({ phone: false }), /data-moved-hide="true" class="[^"]*h-6 w-6/);+});++test('A: Open goes to Space settings › General and rings the Dev mode card once; App gives the pointer What\'s new\'s "established"', async () => {+ const card = document.createElement('form');+ card.setAttribute('data-dev-settings', '');+ let scrolled = 0;+ card.scrollIntoView = () => scrolled++;+ document.body.appendChild(card);+ m.ringDevSettings(document);+ assert.equal(scrolled, 1);+ assert.ok(card.classList.contains('ring-2') && card.classList.contains('ring-sky-400/55'));+ await new Promise((r) => setTimeout(r, 1400));+ assert.ok(!card.classList.contains('ring-2') && !card.hasAttribute('data-moved-ring'), 'gone after 1.2 s and the fade');+ card.remove();+ const app = src('App.tsx');+ assert.match(app, /movedPointer=\{movedPointerShows\(\{ established: whatsNewEstablished, seen: movedHidden \}\)\}/);+ assert.match(app, /const openMoved = \(\) => \{\s*openSpaceSettings\('general'\);\s*ringDevSettings\(\);\s*hideMoved\(\);/);+ assert.match(app, /<GetStarted[\s\S]*?onDismissed=\{hideMoved\}/, 'finishing Get started (someone new) hides the pointer for good');+});++// ------------------------------------------------------------------ C: #general's three asks++test('C: #general with the Helpers team shows "What do you want done?" and its three role asks, no filler', () => {+ const bots = [+ { name: 'Assistant', title: 'Personal Assistant', avatar_sprite: 'assistant' },+ { name: 'Researcher', title: 'Researcher', avatar_sprite: 'researcher' },+ { name: 'Writer', title: 'Writer', avatar_sprite: 'writer' },+ ];+ const asks = m.suggestedPrompts({ kind: 'general', bots });+ assert.equal(asks.length, 3);+ assert.ok(!asks.includes('Who here can help me with what?'));+});++// ------------------------------------------------------------------ E: the account card++test('E: the account card shows only when nothing can run and Get started is not on screen', () => {+ assert.equal(m.accountCardShows({ canRun: false, getStartedShowing: false }), true);+ assert.equal(m.accountCardShows({ canRun: null, getStartedShowing: false }), false, 'still checking');+ assert.equal(m.accountCardShows({ canRun: undefined, getStartedShowing: false }), false);+ assert.equal(m.accountCardShows({ canRun: true, getStartedShowing: false }), false);+ assert.equal(m.accountCardShows({ canRun: false, getStartedShowing: true }), false, 'Get started covers it');+ const cv = src('components/ChatView.tsx');+ assert.match(cv, /accountCardShows\(\{ canRun, getStartedShowing: !!welcome \}\)/);+});++test('E: the card says what to connect, lists the four ways and opens Accounts; #general swaps its asks for it', () => {+ let opened = 0;+ const r = mount(h(m.AccountCard, { onOpenAccounts: () => opened++ }));+ const region = r.host.querySelector('[role="region"][aria-label="Connect an AI account"]');+ assert.ok(region);+ assert.equal(region.querySelector('h3').textContent, 'Connect an AI account to start');+ assert.deepEqual([...region.querySelectorAll('li')].map((li) => li.textContent), ['Claude Pro or Max', 'ChatGPT plan', 'Grok', 'API key']);+ const btn = r.host.querySelector('[data-connect-account]');+ assert.equal(btn.textContent, 'Connect an account');+ assert.match(btn.className, /h-11 w-full/, '44 px, full width on a phone');+ btn.click();+ assert.equal(opened, 1);+ assert.match(r.host.textContent, /Nothing runs and nothing is made until one is connected\./);+ r.done();+ const home = { kind: 'general' };+ const asleep = m.botHome({ home, team: [], prompts: ['Plan my week'], canRun: false, onPick() {}, accountCard: true });+ assert.match(asleep, /data-account-card/);+ assert.doesNotMatch(text(asleep), /Plan my week/, 'no asks to tap while nothing can run');+ assert.doesNotMatch(text(asleep), /Type @ to ask one bot yourself\./, 'no @ footer while nothing can run');+ const awake = m.botHome({ home, team: [], prompts: ['Plan my week'], canRun: true, onPick() {} });+ assert.doesNotMatch(awake, /data-account-card/);+ assert.match(text(awake), /What do you want done\?/);+ assert.match(text(awake), /Type @ to ask one bot yourself\./);+});++// ------------------------------------------------------------------ D: Get started step 3++const helpersTpl = { id: 'helpers', handle: 'helpers', card_line: 'Plans, research and drafts for everyday asks.' };+const inboxTpl = { id: 'inbox', handle: 'inbox', card_line: 'Sorts and answers your email.' };+const bots3 = [+ { id: 'w', name: 'Writer', avatar_sprite: 'writer' },+ { id: 'a', name: 'Assistant', avatar_sprite: 'assistant' },+ { id: 'r', name: 'Researcher', avatar_sprite: 'researcher' },+];+const helpers = { id: 't1', name: 'helpers', lead_kwant_id: 'a', member_kwants: ['r', 'w'], created_at: '2026-11-13T10:00:00Z' };++test('D: with a team, step 3 is "Your team" with a Start tile of its real names, and hides its template', () => {+ const v = m.teamStepView({ teams: [helpers], bots: bots3, templates: [helpersTpl, inboxTpl] });+ assert.equal(v.title, 'Your team');+ assert.equal(v.intro, 'Your space comes with a team for everyday asks. Start with it, or add a team made for one job.');+ assert.equal(v.start.handle, 'helpers');+ assert.deepEqual(v.start.members.map((b) => b.name), ['Assistant', 'Researcher', 'Writer'], 'lead first');+ assert.equal(v.start.line, 'Assistant, Researcher and Writer. Plans, research and drafts for everyday asks.');+ assert.deepEqual(v.templateIds, ['inbox'], 'Helpers does not show twice');+ // An upgraded space: core-engineering, made from no template; Helpers is offered to add.+ const core = { id: 't0', name: 'core-engineering', lead_kwant_id: 'x', member_kwants: '["y","z"]' };+ const cv = m.teamStepView({ teams: [core], bots: [{ id: 'x', name: 'Architect' }, { id: 'y', name: 'TechLead' }, { id: 'z', name: 'DevOps' }], templates: [helpersTpl, inboxTpl] });+ assert.equal(cv.start.handle, 'core-engineering');+ assert.equal(cv.start.line, 'Architect, TechLead and DevOps.');+ assert.deepEqual(cv.templateIds, ['helpers', 'inbox']);+ // used_in_space and this browser's record also hide a template.+ assert.deepEqual(m.teamStepView({ teams: [core], bots: [], templates: [{ ...inboxTpl, used_in_space: true }, helpersTpl] }).templateIds, ['helpers']);+ assert.deepEqual(m.teamStepView({ teams: [{ ...core, id: 'tx', name: 'mail' }], bots: [], templates: [inboxTpl], madeFrom: (id) => (id === 'tx' ? 'inbox' : null) }).templateIds, []);+});++test('D: with no team, step 3 stays "Pick a team" with no Start tile; the done value is @handle after Start', () => {+ const v = m.teamStepView({ teams: [], bots: bots3, templates: [helpersTpl] });+ assert.equal(v.title, 'Pick a team');+ assert.equal(v.intro, 'Each team has a lead, helpers and skills for one job. You can add more teams later.');+ assert.equal(v.start, null);+ assert.deepEqual(v.templateIds, ['helpers'], 'Helpers is the first template tile');+ assert.equal(m.teamDoneValue({ imported: false, mainSpace: true, startHandle: 'helpers' }), '@helpers');+ assert.equal(m.teamDoneValue({ imported: false, mainSpace: true, startHandle: null }), 'Starter bots');+ assert.equal(m.teamDoneValue({ imported: false, mainSpace: false, startHandle: null }), 'Your bots');+ assert.equal(m.teamDoneValue({ imported: true, mainSpace: true, startHandle: 'helpers' }), 'Your imported bots');+});++const ready = (id) => ({ id, name: id, kind: 'cli', status: 'ready', detail: null, version: null, models: [], checked_at: null, enabled: true, ready: true, uses: null });++test('D: Get started with a team renders the Start tile and "Or add a team for one job"; Start keeps the team and closes the card', async () => {+ localStorage.clear();+ let dismissed = 0;+ const r = mount(h(m.GetStarted, { space: 'fs1', bots: bots3, teams: [helpers], engines: [ready('claude')], reloadEngines() {}, onDismissed: () => dismissed++, hostOverride: null }));+ await settle();+ const heads = [...r.host.querySelectorAll('h3')].map((x) => x.textContent);+ assert.equal(heads[2], 'Step 3 of 3, Your team, open');+ const tile = r.host.querySelector('[data-start-team="helpers"]');+ assert.ok(tile);+ assert.match(tile.textContent, /Start with @helpersAssistant, Researcher and Writer\.Start$/);+ assert.equal(r.host.querySelector('[data-keep-starter]'), null, 'the Start tile replaces Keep');+ assert.equal(r.host.querySelector('[data-add-team-label]').textContent, 'Or add a team for one job');+ assert.match(r.host.textContent, /Your space comes with a team for everyday asks\./);+ r.host.querySelector('[data-start-button]').click();+ await settle();+ assert.equal(dismissed, 1);+ r.done();+ // No team: today's step.+ const r2 = mount(h(m.GetStarted, { space: 'fs2', bots: bots3, teams: [], engines: [ready('claude')], reloadEngines() {}, onDismissed() {}, hostOverride: null }));+ await settle();+ assert.equal([...r2.host.querySelectorAll('h3')][2].textContent, 'Step 3 of 3, Pick a team, open');+ assert.equal(r2.host.querySelector('[data-start-team]'), null);+ assert.ok(r2.host.querySelector('[data-keep-starter]'));+ r2.done();+});++// ------------------------------------------------------------------ F: words on these screens++test('F: "the best fit" replaces "Laya picks" on the first screens, and the welcome says "Welcome to kwant"', () => {+ assert.match(src('App.tsx'), /`The best fit of your \$\{kwants\.length\} \$\{kwants\.length === 1 \? 'bot' : 'bots'\} answers`/);+ assert.match(src('botHome.ts'), /label: 'Best fit', detail: 'The best bot for each message answers\. Type @ and a name to choose one yourself\.'/);+ assert.match(src('components/Sidebar.tsx'), /'The best fit answers here'/);+ assert.match(src('components/SpaceReadyCard.tsx'), /The best fit answers, only from/);+ assert.match(src('components/SetupNeededCard.tsx'), /Sign in with Claude, ChatGPT or Grok, or add an API key\./);+ assert.match(src('components/GetStarted.tsx'), /Open claude\.ai and allow kwant\./);+ assert.match(src('gettingStarted.ts'), /title: 'Welcome to kwant',/);+ assert.match(src('gettingStarted.ts'), /'Last step: meet your team\.'/);+ for (const f of ['App.tsx', 'botHome.ts', 'components/Sidebar.tsx', 'components/SpaceReadyCard.tsx', 'components/FirstRunWelcome.tsx']) {+ assert.doesNotMatch(src(f), /Laya picks who answers|label: 'Laya picks'/, f);+ }+});diff --git a/frontend/tests/gettingStarted.test.mjs b/frontend/tests/gettingStarted.test.mjsindex 2edfa9d3..8e602d32 100644--- a/frontend/tests/gettingStarted.test.mjs+++ b/frontend/tests/gettingStarted.test.mjs@@ -52,7 +52,7 @@ test('steps: already signed in → steps 1 and 2 done, step 3 open (D2)', () =>const v = m.stepsView({ engines: [ready('claude'), engine('codex')], chosen: null });assert.deepEqual(v, { open: 3, done1: true, done2: true, choice: 'claude', foundReady: true });assert.equal(m.step1Value(v, [ready('claude')], 'on this Mac'), 'Claude, already signed in on this Mac');- assert.deepEqual(m.heroText(v, { mac: true }), { title: 'Claude is ready on this Mac', sub: 'You were already signed in. Pick a team and say hello.' });+ assert.deepEqual(m.heroText(v, { mac: true }), { title: 'Claude is ready on this Mac', sub: 'You were already signed in. Meet your team and say hello.' });assert.equal(m.heroText(v, { host: 'vps.example.net' }).title, 'Claude is ready on vps.example.net');});diff --git a/frontend/tests/ia.test.mjs b/frontend/tests/ia.test.mjsindex 782d0d3b..381ff39b 100644--- a/frontend/tests/ia.test.mjs+++ b/frontend/tests/ia.test.mjs@@ -276,13 +276,9 @@ test('QA d: nothing tells the person to look in Settings → Profiles any more',}});-test('header (dev-mode-explainer §1): the name row holds no switch; the Space controls block under it holds Dev mode, on desktop and phone', () => {+test('header (first-screen A): no Dev mode switch or controls block in the sidebar, on desktop and phone; the subtitle stays the space summary', () => {for (const html of [ui.sidebar(base), ui.sidebar({ ...base, phone: true, section: 'chats' })]) {- const header = html.slice(0, html.indexOf('data-space-controls'));- assert.doesNotMatch(header, /data-dev-switch[ =>]/, 'no switch in the name row');- assert.doesNotMatch(html, /data-dev-switch-row|data-dev-meta/);- const block = html.slice(html.indexOf('data-space-controls'));- assert.match(block, /data-sc-row="dev"[\s\S]*data-dev-switch/);- assert.match(header, />0 bots · no account yet</, 'the subtitle stays the space summary');+ assert.doesNotMatch(html, /data-dev-switch[ =>]|data-dev-switch-row|data-dev-meta|data-space-controls/);+ assert.match(html, />0 bots · no account yet</, 'the subtitle stays the space summary');}});diff --git a/frontend/tests/quickWins.test.mjs b/frontend/tests/quickWins.test.mjsindex a80222f4..c281d683 100644--- a/frontend/tests/quickWins.test.mjs+++ b/frontend/tests/quickWins.test.mjs@@ -94,7 +94,7 @@ test('first-run welcome: what kwant bots are, the bots, one action', () => {onAction: () => clicked++,});assert.match(html, /data-first-run-welcome/);- assert.match(html, /Laya picks who answers/);+ assert.match(html, /the best fit answers/);assert.match(html, /Architect<\/span><span[^>]*> · Systems Architect/);assert.match(html, />TechLead</);assert.equal(html.split('<button').length, 2, 'exactly one button');diff --git a/frontend/tests/setupNotice.test.mjs b/frontend/tests/setupNotice.test.mjsindex 7aba2d27..03202417 100644--- a/frontend/tests/setupNotice.test.mjs+++ b/frontend/tests/setupNotice.test.mjs@@ -35,7 +35,7 @@ test('the card offers Add an account, and says where it is', () => {assert.doesNotMatch(html, /Settings → Engines/);const off = card({ meta: { reason: 'host_off' } });- assert.match(off, /This machine is off in Default/);+ assert.match(off, /This computer(’|'|')s AI accounts are off in Default/);assert.match(off, /Add an account/);});diff --git a/frontend/tests/suggestedPrompts.test.mjs b/frontend/tests/suggestedPrompts.test.mjsindex 79834766..6d24bbcc 100644--- a/frontend/tests/suggestedPrompts.test.mjs+++ b/frontend/tests/suggestedPrompts.test.mjs@@ -81,11 +81,44 @@ test("a one-to-one chat uses that bot's role, or its persona when the title saystest("#general draws on the space's bots without naming them, and is empty with no bots", () => {const out = suggestedPrompts({ kind: 'general', bots: [{ name: 'DevOps', title: 'Systems & Security Engineer' }, ...kitchen] });- assert.deepEqual(out, ["Check my server's security", "Plan this week's dinners", 'Who here can help me with what?']);+ assert.deepEqual(out, ["Check my server's security", "Plan this week's dinners", "Check this week's meals are balanced"]);assert.ok(out.every((p) => !p.includes('@')));assert.deepEqual(suggestedPrompts({ kind: 'general', bots: [] }), []);});+test('#general with the Helpers team gives its three role asks and no filler (first-screen C)', () => {+ const helpers = [+ { name: 'Assistant', title: 'Personal Assistant' },+ { name: 'Researcher', title: 'Research Analyst' },+ { name: 'Writer', title: 'Writer & Editor' },+ ];+ const out = suggestedPrompts({ kind: 'general', bots: helpers });+ assert.deepEqual(out, ['Plan my week', 'Research my top 3 competitors', 'Outline a blog post']);+ assert.equal(out.length, MAX_PROMPTS);+ assert.ok(!out.includes('Who here can help me with what?'));+});++test('#general only adds "Who here can help me with what?" when fewer than three roles answer', () => {+ assert.deepEqual(suggestedPrompts({ kind: 'general', bots: [{ name: 'A', title: 'Personal Assistant' }, { name: 'W', title: 'Writer' }] }), [+ 'Plan my week',+ 'Outline a blog post',+ 'Who here can help me with what?',+ ]);+ assert.deepEqual(suggestedPrompts({ kind: 'general', bots: [{ name: 'X', title: 'Wizard' }] }), ['Who here can help me with what?']);+ // The upgraded space's core-engineering starters: three distinct roles, so three asks.+ assert.deepEqual(+ suggestedPrompts({+ kind: 'general',+ bots: [+ { name: 'Architect', title: 'Systems Architect' },+ { name: 'TechLead', title: 'Staff Engineer & Prototyper' },+ { name: 'DevOps', title: 'Systems & Security Engineer' },+ ],+ }),+ ['Sketch the architecture for a new feature', 'Build a quick prototype', "Check my server's security"],+ );+});+test('never more than three (four in a team), each short enough for a phone chip', () => {const many = Array.from({ length: 30 }, (_, i) => ({ name: `B${i}`, title: ['Chef', 'Writer', 'Lawyer', 'Tutor', 'SEO lead'][i % 5] }));for (const ctx of [{ kind: 'team', members: many }, { kind: 'general', bots: many }, { kind: 'bot', bot: many[0] }]) {diff --git a/frontend/tests/wording.test.mjs b/frontend/tests/wording.test.mjsindex 229a40d8..598ebf73 100644--- a/frontend/tests/wording.test.mjs+++ b/frontend/tests/wording.test.mjs@@ -20,7 +20,8 @@ const BAD = /\b(kwants?|kwnt|agents?)\b/i;// The product term (headings, tagline), the CLI commands and token file shown on the sign-in screen, and// Agent Maestro, the VS Code extension's own name (a Custom API preset), and "coding agent", what// Claude Code, Codex and Cursor are called in Settings → Coding agents (0.7.4).-const ALLOWED = /\bkwant bots?\b|\bcoding agents?\b|\b(?:exec kwnt )?kwnt (?:token|signin-link)\b|~\/\.kwnt\/api-token/gi;+// 0.9.8 first screen (Mira, first-screen F): the product's own name in the welcome and the claude.ai step.+const ALLOWED = /\bWelcome to kwant\b|\ballow kwant\.|\bkwant bots?\b|\bcoding agents?\b|\b(?:exec kwnt )?kwnt (?:token|signin-link)\b|~\/\.kwnt\/api-token/gi;const MAESTRO = /\bAgent Maestro\b|\bHermes Agent\b/g;// T/D preview sheet (0.7.7): Mira's review-396-397 must-fix 7 and Ada's deviation-4 ruling keep "kwant"// as the subject in these three sentences only.