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
UX quick wins before launch: first run, Pick one to start, one-line reply meta
Pixel (kwant bot)4c94f769333c
diff --git a/docs/mission-control.md b/docs/mission-control.mdindex 25ae28cc..e29a587f 100644--- a/docs/mission-control.md+++ b/docs/mission-control.md@@ -14,7 +14,7 @@ with `?space=<id>` (default space when omitted), like the rest of the API.| key | type | default | notes ||---|---|---|---|-| `mission_board` | bool | `false` | Shows the board, gives bots the mission tools, auto-creates tasks from hand-offs, routine runs, Loose Ends and work-ahead runs, and runs active missions. Off: routes still answer (read and person actions), bots get no task tools, nothing is auto-created, the runner is idle. |+| `mission_board` | bool | `true` | On unless set to `false` (also `"0"`/`"off"`). Shows the board, gives bots the mission tools, auto-creates tasks from hand-offs, routine runs, Loose Ends and work-ahead runs, and runs active missions. Off: routes still answer (read and person actions), bots get no task tools, nothing is auto-created, the runner is idle. || `mission_lease_minutes` | int 5–240 | `30` | How long a claim lives without activity. || `mission_default_budget_tokens` | int 0 or 1 000–5 000 000 | `0` | A new mission's budget when none is given. 0 = no limit. || `mission_default_task_budget_tokens` | int 0–5 000 000 | `0` | A new task's budget when none is given (capped at a limited mission's budget). 0 = no limit. |diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex 9cfb116f..64728f7c 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -2,6 +2,7 @@ import React, { Suspense, lazy, useState, useEffect, useRef, useCallback, useMemimport { DecidingMap, applyDecideEvent, decisionsApi, hydrateDeciding } from './decideFirst';import { Sidebar, Kwant, Channel, Team, memberIdsOf } from './components/Sidebar';import { SpaceSettings, SpaceSettingsTab } from './components/SpaceSettings';+import { FirstRunWelcome } from './components/FirstRunWelcome';import { SpaceTile } from './components/Spaces';import { ChatView, ChatMessage, DiscussionState, RoutingState, QueuedState } from './components/ChatView';import { ThreadBar, ThreadHeader } from './components/ThreadBar';@@ -38,7 +39,7 @@ import { MISSION_BOARD_SETTING_EVENT, emitMission, parseMissionBoardSetting, souimport { type ChatTarget, planOpenTarget } from './chatTarget';import { ParallelPage } from './components/ParallelUniverseView';import { ConnectionsPage } from './components/ConnectionsView';-import { AlertTriangle, Bot, Check, HelpCircle, Inbox, KeyRound, ListChecks, Loader2, MessageSquare, Settings } from 'lucide-react';+import { Bot, Check, HelpCircle, Inbox, KeyRound, ListChecks, Loader2, MessageSquare, Settings, Sparkles } from 'lucide-react';import { ChatApproval, OpenChat, approvalFromEvent, lateAnswerText, approvalsForChat, approvalsFromAway, syncApprovals, upsertApproval, withoutApproval } from './approvals';import type { AgentFormData } from './components/NewAgentModal';import { NewTeamModal } from './components/NewTeamModal';@@ -416,7 +417,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({sw.addEventListener('message', onMessage);return () => sw.removeEventListener('message', onMessage);}, [space.id]);- // The Mission board is off unless the server says otherwise; Settings tells us when it changes.+ // The Mission board shows once the server says it is on (the default); Settings tells us when it changes.useEffect(() => {let live = true;fetch('/api/settings')@@ -2696,17 +2697,17 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({<divrole="status"data-setup-banner- className="shrink-0 px-3 sm:px-6 py-2.5 border-b border-amber-500/20 bg-amber-500/5 flex flex-wrap items-center gap-x-3 gap-y-2"+ className="shrink-0 px-3 sm:px-6 py-2.5 border-b border-violet-500/20 bg-violet-500/[0.06] flex flex-wrap items-center gap-x-3 gap-y-2">- <AlertTriangle size={15} className="shrink-0 text-amber-300" aria-hidden="true" />+ <Sparkles size={15} className="shrink-0 text-violet-300" aria-hidden="true" /><div className="flex-1 min-w-[12rem]">- <p className="text-xs font-medium text-zinc-100">Get {space.name} ready: add an account</p>- <p className="text-[11px] text-zinc-400">Bots here can't answer until one account works. Sign in with Claude, Codex or Grok, or add an API key.</p>+ <p className="text-xs font-medium text-zinc-100">One step left: add an account</p>+ <p className="text-[11px] text-zinc-400">Sign in with Claude or ChatGPT, or paste an API key, and your bots can start answering.</p></div><buttontype="button"onClick={offerClaude ? openClaudeSignIn : openSettings}- className="shrink-0 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 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-300"+ className="shrink-0 flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium text-white bg-violet-600 hover:bg-violet-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-300"><KeyRound size={13} aria-hidden="true" />{offerClaude ? 'Sign in with Claude' : 'Add an account'}@@ -3001,15 +3002,16 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({}highlightMessageId={highlightMessageId}onHighlightDone={() => setHighlightMessageId(null)}- subHeader={- setupBanner ? (- <>- {subHeader}- {setupBanner}- </>- ) : (- subHeader- )+ subHeader={subHeader}+ notice={setupBanner}+ welcome={+ setupBanner && isChannel ? (+ <FirstRunWelcome+ bots={kwants}+ actionLabel={offerClaude ? 'Sign in with Claude' : 'Add an account'}+ onAction={offerClaude ? openClaudeSignIn : openSettings}+ />+ ) : undefined}onOpenAccounts={openSettings}canRun={canRun}@@ -3055,7 +3057,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({return (<div className="flex-1 min-w-0 h-full flex flex-col bg-zinc-950 text-zinc-100 overflow-hidden" data-space={space.id}>{/* The open space's colour, so it's clear where a message goes */}- <div className="h-[3px] shrink-0" style={{ background: spaceColor(space) }} aria-hidden="true" />+ <div className="h-[3px] shrink-0 opacity-60" style={{ background: spaceColor(space) }} aria-hidden="true" />{isPhone ? (<>diff --git a/frontend/src/clock.ts b/frontend/src/clock.tsnew file mode 100644index 00000000..1570e5b6--- /dev/null+++ b/frontend/src/clock.ts@@ -0,0 +1,26 @@+// Times as people read them, in this device's time zone: "8:15 PM" today, "Nov 3, 8:15 PM" on+// another day this year, with the year when it isn't this year.++const sameDay = (a: Date, b: Date) => a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate();++/** "8:15 PM" when `at` is today, else the date too. Null for a missing or unreadable time. */+export function localClock(at: string | Date | null | undefined, now: number = Date.now(), locale?: string): string | null {+ if (!at) return null;+ const d = at instanceof Date ? at : new Date(at);+ if (Number.isNaN(d.getTime())) return null;+ const today = new Date(now);+ const time = d.toLocaleTimeString(locale, { hour: 'numeric', minute: '2-digit' });+ if (sameDay(d, today)) return time;+ const date = d.toLocaleDateString(locale, {+ month: 'short',+ day: 'numeric',+ ...(d.getFullYear() === today.getFullYear() ? {} : { year: 'numeric' }),+ });+ return `${date}, ${time}`;+}++/** A Connections line: "Out of quota until 8:15 PM", or the server's words when there's no time. */+export function quotaLine(statusDetail: string | null, limitedUntil: string | null | undefined, now: number = Date.now(), locale?: string): string | null {+ const until = limitedUntil && new Date(limitedUntil).getTime() > now ? localClock(limitedUntil, now, locale) : null;+ return until ? `Out of quota until ${until}` : statusDetail;+}diff --git a/frontend/src/components/ActivityList.tsx b/frontend/src/components/ActivityList.tsxindex 88c89c11..4d4c2960 100644--- a/frontend/src/components/ActivityList.tsx+++ b/frontend/src/components/ActivityList.tsx@@ -223,8 +223,6 @@ export const LiveActivityList: React.FC<{ live: LiveActivity; idBase: string }>export const SavedActivityList: React.FC<{ activity: SavedActivity; idBase: string; children?: React.ReactNode }> = ({ activity, idBase, children }) => {const [open, setOpen] = useState(false);const listId = `${idBase}-steps`;- // The engine's "no thinking shared" note stays in view while it explains a gap.- const note = activity.steps.some((s) => s.kind === 'thinking') ? undefined : activity.steps.find((s) => s.kind === 'note');const failed = activity.steps.some((s) => s.status === 'failed');return (<div className="mb-2 max-w-full">@@ -245,7 +243,6 @@ export const SavedActivityList: React.FC<{ activity: SavedActivity; idBase: stri{children}</div>)}- {!open && note && <p className="mt-1 px-1 text-[11px] text-zinc-400 break-words">{note.title}</p>}</div>);};diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex b8320638..917b2c01 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -1,5 +1,5 @@import React, { useState, useRef, useEffect } from 'react';-import { ArrowDown, ArrowUp, Paperclip, Sparkles, ChevronDown, ChevronRight, Copy, Check, ChevronLeft, Users, Square, Settings2, Folder, GitBranch, Pencil, Pin } from 'lucide-react';+import { ArrowDown, ArrowUp, Paperclip, Sparkles, ChevronDown, ChevronRight, Copy, Check, ChevronLeft, Users, Square, Settings2, Folder, GitBranch, Pencil, Pin, Monitor } from 'lucide-react';import { ModernAvatar } from './ModernAvatar';import { ModernApprovalCard, PendingApproval } from './ModernApprovalCard';import { MentionPopover, MentionItem } from './MentionPopover';@@ -14,6 +14,7 @@ import { QuestionMeta, parseQuestionMeta } from '../questions';import { HumanStep, HumanStepMeta, parseHumanStepMeta } from '../humanSteps';import { LiveActivity, hasThinkingText, parseActivityMeta } from '../activity';import { LiveActivityList, SavedActivityList } from './ActivityList';+import { ReplyMeta } from './ReplyMeta';import { SuggestionMeta, parseSuggestionMeta } from '../mcpSuggestions';import { BotActionMeta, HireMeta, parseBotActionMeta, parseHireMeta } from '../botActions';import {@@ -86,6 +87,7 @@ export interface ChatMessage {thread_id?: string | null;/** JSON string kwnt sets on messages it writes itself, e.g. delegation notes. */meta?: string | null;+ created_at?: string | null;}/** The open chat's turn is waiting for a free slot. */@@ -196,6 +198,10 @@ export interface ChatViewProps {onJumpToLatest?: () => void;/** Under the header: the bot's conversations and the open thread's controls. */subHeader?: React.ReactNode;+ /** A note under the sub-header (the setup banner); hidden while `welcome` fills an empty chat. */+ notice?: React.ReactNode;+ /** Drawn in place of an empty chat (the first-run welcome). */+ welcome?: React.ReactNode;/** Next to the title, e.g. "Working on …" while the bot has background turns. */titleExtra?: React.ReactNode;/** Set while the open chat's turn waits in the queue. */@@ -240,7 +246,7 @@ export const renderFormattedText = (text: string): React.ReactNode => {return (<spankey={index}- className="inline-flex items-center px-1.5 py-0.5 rounded text-sky-400 bg-sky-500/10 font-medium font-mono text-[11px] border border-sky-500/20"+ className="inline-flex items-center px-1.5 py-0.5 rounded text-sky-400 bg-sky-500/10 font-medium text-[11px] border border-sky-500/20">{part}</span>@@ -413,6 +419,8 @@ export const ChatView: React.FC<ChatViewProps> = ({viewingHistory,onJumpToLatest,subHeader,+ notice,+ welcome,titleExtra,queued,renderDelegation,@@ -914,63 +922,59 @@ export const ChatView: React.FC<ChatViewProps> = ({</span><div className={`flex flex-col min-w-0 ${isUser ? 'max-w-[85%] sm:max-w-2xl items-end' : 'flex-1 max-w-4xl items-start'}`}>- {/* Header info: one line on phones; the account and token count move under the reply there */}- <div className="flex items-center gap-2 mb-1.5 text-[11px] text-zinc-400 font-medium max-w-full min-w-0 whitespace-nowrap">- {!isUser && (- <span className="sm:hidden shrink-0 inline-flex">- <ModernAvatar role={title} name={displayName} size={20} />- </span>- )}- <span className="text-zinc-200 shrink-0">{displayName}</span>- {ranOn && (- <span className="text-zinc-500 font-mono text-[10px] truncate min-w-0" title={`Answered with ${ranOn}`}>- {ranOn}- </span>- )}- {account && <span className="hidden sm:inline text-zinc-500 text-[10px] truncate max-w-[12rem]">ran on {account}</span>}- {tokens && (- <span className="hidden sm:inline text-zinc-500 font-mono text-[10px] cursor-help" title={tokens.detail}>- ({tokens.label})<span className="sr-only">: {tokens.detail}</span>- </span>- )}- </div>-- {routed && <RoutingLine text={routingLine(routed, spaceName ?? 'this space')} fallback={!!routed.fallback} />}-- {/* What the reply did: "12 steps · 41s", opening to the steps (tool calls go inside) */}- {savedActivity && (- <SavedActivityList activity={savedActivity} idBase={`act-${msg.id}`}>- {msg.tool_calls && (- <div className="border-t border-zinc-800/60 p-2">- <ToolCallsList raw={msg.tool_calls} />- </div>+ {isUser ? (+ <div className="flex items-center gap-2 mb-1.5 text-[11px] text-zinc-400 font-medium max-w-full min-w-0 whitespace-nowrap">+ <span className="text-zinc-200 shrink-0">{displayName}</span>+ </div>+ ) : (+ // One line, "Name · 3:42 PM"; the model, account, tokens, steps and reasoning wait behind Details+ <ReplyMeta+ name={displayName}+ at={msg.created_at}+ avatar={<ModernAvatar role={title} name={displayName} size={20} />}+ ranOn={ranOn}+ account={account}+ tokens={tokens}+ failed={!!savedActivity?.steps.some((s) => s.status === 'failed')}+ >+ {/* What the reply did: "12 steps · 41s", opening to the steps (tool calls go inside) */}+ {savedActivity && (+ <SavedActivityList activity={savedActivity} idBase={`act-${msg.id}`}>+ {msg.tool_calls && (+ <div className="border-t border-zinc-800/60 p-2">+ <ToolCallsList raw={msg.tool_calls} />+ </div>+ )}+ </SavedActivityList>)}- </SavedActivityList>- )}- {/* Collapsible Reasoning Disclosure (the steps above already hold the thinking when they have it) */}- {msg.reasoning_content && !hasThinkingText(savedActivity) && (- <div className="mb-2 max-w-full">- <button- type="button"- onClick={() => toggleThought(msg.id)}- className="max-w-full min-w-0 flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs font-mono text-zinc-400 hover:text-zinc-200 bg-zinc-900/80 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700/80 transition-all cursor-pointer shadow-sm group"- >- <Sparkles size={13} className="text-violet-400 group-hover:rotate-12 transition-transform flex-shrink-0" />- <span className="truncate min-w-0 sm:max-w-md">- {msg.reasoning_content.split('\n')[0].replace(/^🔮\s*/, '')}- </span>- {isThoughtOpen ? <ChevronDown size={13} className="text-zinc-500 flex-shrink-0" /> : <ChevronRight size={13} className="text-zinc-500 flex-shrink-0" />}- </button>+ {/* Collapsible Reasoning Disclosure (the steps above already hold the thinking when they have it) */}+ {msg.reasoning_content && !hasThinkingText(savedActivity) && (+ <div className="mb-2 max-w-full">+ <button+ type="button"+ onClick={() => toggleThought(msg.id)}+ className="max-w-full min-w-0 flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs text-zinc-400 hover:text-zinc-200 bg-zinc-900/80 hover:bg-zinc-900 border border-zinc-800 hover:border-zinc-700/80 transition-all cursor-pointer shadow-sm group"+ >+ <Sparkles size={13} className="text-violet-400 group-hover:rotate-12 transition-transform flex-shrink-0" />+ <span className="truncate min-w-0 sm:max-w-md">+ {msg.reasoning_content.split('\n')[0].replace(/^🔮\s*/, '')}+ </span>+ {isThoughtOpen ? <ChevronDown size={13} className="text-zinc-500 flex-shrink-0" /> : <ChevronRight size={13} className="text-zinc-500 flex-shrink-0" />}+ </button>- {isThoughtOpen && (- <div className="mt-1.5 p-3.5 rounded-xl bg-zinc-950/90 border border-zinc-800 text-xs font-mono text-zinc-300 whitespace-pre-wrap leading-relaxed shadow-inner max-h-80 overflow-y-auto">- {msg.reasoning_content}+ {isThoughtOpen && (+ <div className="mt-1.5 p-3.5 rounded-xl bg-zinc-950/90 border border-zinc-800 text-xs text-zinc-300 whitespace-pre-wrap leading-relaxed shadow-inner max-h-80 overflow-y-auto">+ {msg.reasoning_content}+ </div>+ )}</div>)}- </div>+ </ReplyMeta>)}+ {routed && <RoutingLine text={routingLine(routed, spaceName ?? 'this space')} fallback={!!routed.fallback} />}+{/* Message Body Bubble */}{!filesOnly && (text.trim() || !files.length) && (<div@@ -1027,11 +1031,6 @@ export const ChatView: React.FC<ChatViewProps> = ({</>)}</button>- {(account || tokens) && (- <span className="sm:hidden min-w-0 truncate text-[10px]" title={tokens?.detail}>- {[account && `ran on ${account}`, tokens?.label].filter(Boolean).join(' · ')}- </span>- )}</div>)}</div>@@ -1162,13 +1161,14 @@ export const ChatView: React.FC<ChatViewProps> = ({aria-label="Bot browser"aria-pressed={vmOpen}>- <span className="text-xs" aria-hidden="true">🖥️</span>+ <Monitor size={12} aria-hidden="true" /><span className="hidden sm:inline">Bot browser</span></button></div></div>{subHeader}+ {!(welcome && messages.length === 0) && notice}<PinnedInstructions items={pinned} onEdit={onEditInstructions} />@@ -1228,6 +1228,7 @@ export const ChatView: React.FC<ChatViewProps> = ({aria-label={`Messages in ${title}`}aria-busy={isStreaming}>+ {welcome && messages.length === 0 && welcome}{groupDiscussionThreads(messages).map((item) => {if (item.kind === 'message') return renderMessage(item.message);const threadKey = `thread:${item.id}`;@@ -1310,7 +1311,7 @@ export const ChatView: React.FC<ChatViewProps> = ({{liveActivity && <LiveActivityList live={liveActivity} idBase={`live-${liveActivity.turnId}`} />}{streamingThinking && (- <div className="mb-2 p-2.5 rounded-xl bg-violet-950/20 border border-violet-500/20 text-xs font-mono text-violet-300/90 flex items-center gap-2 animate-pulse motion-reduce:animate-none max-w-full">+ <div className="mb-2 p-2.5 rounded-xl bg-violet-950/20 border border-violet-500/20 text-xs text-violet-300/90 flex items-center gap-2 animate-pulse motion-reduce:animate-none max-w-full"><Sparkles size={13} className="text-violet-400 flex-shrink-0" /><span className="truncate">{streamingThinking}</span></div>@@ -1367,7 +1368,9 @@ export const ChatView: React.FC<ChatViewProps> = ({key={prompt}type="button"onClick={() => handlePromptSuggestion(prompt)}- className="shrink-0 whitespace-nowrap px-2.5 py-1 rounded-full text-xs text-zinc-400 bg-zinc-900 border border-zinc-800 hover:border-zinc-700 hover:text-zinc-200 transition-all shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-500"+ disabled={canRun === false}+ title={canRun === false ? 'Add an account first' : undefined}+ className="shrink-0 whitespace-nowrap px-2.5 py-1 rounded-full text-xs text-zinc-400 bg-zinc-900 border border-zinc-800 hover:border-zinc-700 hover:text-zinc-200 transition-all shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-500 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-zinc-800 disabled:hover:text-zinc-400">{prompt}</button>diff --git a/frontend/src/components/ConnectionsView.tsx b/frontend/src/components/ConnectionsView.tsxindex 949d9515..da37af7c 100644--- a/frontend/src/components/ConnectionsView.tsx+++ b/frontend/src/components/ConnectionsView.tsx@@ -1,7 +1,8 @@import React, { useCallback, useEffect, useId, useRef, useState } from 'react';-import { AlertTriangle, Bot, ChevronLeft, ExternalLink, Github, KeyRound, Loader2, Lock, Mail, Plug, Plus, RefreshCw, Search, Server, UserRound } from 'lucide-react';+import { AlertTriangle, Bot, ChevronLeft, ChevronRight, ExternalLink, Github, KeyRound, Loader2, Lock, Mail, Plug, Plus, RefreshCw, Search, Server, UserRound } from 'lucide-react';import { PERSON_SIGNED_IN_EVENT, requestPersonToken } from '../auth';import { relativeTime } from '../away';+import { quotaLine } from '../clock';import { UnlockDialog, usePasswordStore } from './PasswordStorePanel';import {CatalogEntry,@@ -15,6 +16,7 @@ import {connectionsApi,countsLine,groupConnections,+ isRawCommand,mcpServerId,statusBadge,storedLabel,@@ -73,6 +75,7 @@ export const ConnectionRow: React.FC<ConnectionRowProps> = ({ c, now = Date.now(const manage = manageFor(c.kind, links);const canCheck = onCheck && mcpServerId(c) && c.status !== 'off';const composio = c.logins_stored === 'composio';+ const status = quotaLine(c.status_detail, c.limited_until, now);return (<li className="px-3 py-3 sm:px-4" aria-labelledby={`${id}-n`} data-connection={c.id}><div className="flex flex-wrap items-start gap-x-3 gap-y-2">@@ -86,10 +89,20 @@ export const ConnectionRow: React.FC<ConnectionRowProps> = ({ c, now = Date.now({badge.label}</span></div>- {c.detail && <p className="mt-0.5 text-xs text-zinc-400 break-all">{c.detail}</p>}- {c.status_detail && (- <p className={`mt-1 text-xs ${c.status === 'error' ? 'text-rose-300' : 'text-amber-200'} break-words`}>{c.status_detail}</p>- )}+ {c.detail &&+ (isRawCommand(c) ? (+ // A command or path says little to most people: it waits behind Details.+ <details className="mt-0.5 text-xs text-zinc-400 group">+ <summary className="inline-flex items-center gap-1 cursor-pointer select-none text-[11px] text-zinc-500 hover:text-zinc-300 list-none [&::-webkit-details-marker]:hidden">+ <ChevronRight size={11} className="transition-transform group-open:rotate-90 motion-reduce:transition-none" aria-hidden="true" />+ Details+ </summary>+ <code className="mt-1 block font-mono text-[11px] text-zinc-400 break-all">{c.detail}</code>+ </details>+ ) : (+ <p className="mt-0.5 text-xs text-zinc-400 break-all">{c.detail}</p>+ ))}+ {status && <p className={`mt-1 text-xs ${c.status === 'error' ? 'text-rose-300' : 'text-amber-200'} break-words`}>{status}</p>}<dl className="mt-1.5 flex flex-wrap gap-x-4 gap-y-1 text-[11px] text-zinc-400"><div className="flex items-center gap-1"><dt className="sr-only">Used by</dt>@@ -631,7 +644,7 @@ export const ConnectionsView: React.FC<ConnectionsViewProps> = ({return (<section key={g.key} aria-labelledby={`conn-${g.key}`} className="space-y-2"><h3 id={`conn-${g.key}`} className="text-xs font-semibold text-zinc-300 uppercase tracking-wider">- {g.label} <span className="font-mono font-normal text-zinc-400">{g.items.length}</span>+ {g.label} <span className="tabular-nums font-normal text-zinc-400">{g.items.length}</span></h3>{g.items.length > 0 ? (<ul className="rounded-xl border border-zinc-800 bg-zinc-900/60 divide-y divide-zinc-800">diff --git a/frontend/src/components/EngineAccounts.tsx b/frontend/src/components/EngineAccounts.tsxindex c1678177..1168562f 100644--- a/frontend/src/components/EngineAccounts.tsx+++ b/frontend/src/components/EngineAccounts.tsx@@ -178,6 +178,12 @@ const AddAccountForm: React.FC<{type KeyOrLoginSpec = { engine: Profile['engine']; kind: 'cli_home' | 'api_key' };+/** "Paste an API key" for an API card (anthropic_api, openai_api, xai_api): the same form as on its card. */+export const NewKeyAccountForm: React.FC<{ card: string; onCancel: () => void; onCreated: () => void }> = ({ card, onCancel, onCreated }) => {+ const spec = newAccountFor(card);+ return spec && spec.kind === 'api_key' ? <KeyOrLoginForm key={card} spec={spec as KeyOrLoginSpec} onCancel={onCancel} onCreated={onCreated} /> : null;+};+const KeyOrLoginForm: React.FC<{spec: KeyOrLoginSpec;onCancel: () => void;diff --git a/frontend/src/components/EnginesPanel.tsx b/frontend/src/components/EnginesPanel.tsxindex 7680ecbe..19525483 100644--- a/frontend/src/components/EnginesPanel.tsx+++ b/frontend/src/components/EnginesPanel.tsx@@ -1,6 +1,6 @@import React, { useState } from 'react';-import { AlertTriangle, ArrowRight, ChevronDown, ChevronRight, Cpu, Key, Loader2, RefreshCw, Route, Server } from 'lucide-react';-import { EngineInfo, checkedAgo, engineSummary, isAbsent, isUsable, onlyCliReady, sortEngines, statusView } from '../engines';+import { AlertTriangle, ArrowRight, ChevronDown, ChevronRight, Cpu, ExternalLink, Key, Loader2, RefreshCw, Route, Server } from 'lucide-react';+import { EngineInfo, INSTALL_URL, checkedAgo, engineSummary, isAbsent, isUsable, onlyCliReady, sortEngines, statusView } from '../engines';import { playSfx } from '../audio/chiptune';import type { EnginesApi } from '../useEngines';import { claudeNeedsSignIn } from '../claudeLogin';@@ -9,6 +9,7 @@ import { AccountList, StatusPill } from './EngineAccounts';import { Profile, accountUsable, accountsForCard, activeLimit, formatUntil } from '../profiles';import type { ProfilesState } from '../useProfiles';import { RouteRow, routeSummary } from '../routing';+import { StartPicker } from './StartPicker';const SUMMARY_TEXT = {ok: 'text-emerald-300',@@ -48,8 +49,10 @@ export const EngineCard: React.FC<{onAccountsChanged?: () => Promise<void>;/** Sign in or out of "This machine". */hostAction?: React.ReactNode;+ /** Claude's sign-in sits in "Pick one to start" above the cards. */+ signInAbove?: boolean;now?: number;-}> = ({ engine, onToggle, accounts, onAccountsChanged, hostAction, now = Date.now() }) => {+}> = ({ engine, onToggle, accounts, onAccountsChanged, hostAction, signInAbove = false, now = Date.now() }) => {const view = statusView(engine);const Icon = KIND_ICON[engine.kind] ?? Cpu;const off = engine.enabled === false;@@ -57,12 +60,14 @@ export const EngineCard: React.FC<{const labelId = `engine-${engine.id}-name`;const hasMachineRow = !!accounts?.some((p) => p.kind === 'system');// With no "This machine" row, Claude's sign-in button sits under the name and replaces "run `claude login`".- const signInHere = !hasMachineRow && engine.id === 'claude' && !!hostAction;+ const signInHere = !hasMachineRow && engine.id === 'claude' && (!!hostAction || signInAbove);const summary =signInHere && engine.status === 'signed_out' && !usable && !off- ? { text: 'Not signed in · Sign in below', tone: 'warn' as const }+ ? { text: `Not signed in · Sign in ${signInAbove ? 'above' : 'below'}`, tone: 'warn' as const }: engineSummary(engine, accounts ? summaryAccounts(accounts, now) : []);- const showAccounts = engine.kind !== 'local' && accounts !== undefined && !!onAccountsChanged;+ // Not installed and nothing but its "This machine" row: nothing to list or switch until it's installed.+ const onlyMachine = isAbsent(engine) && !accounts?.some((p) => p.kind !== 'system');+ const showAccounts = engine.kind !== 'local' && accounts !== undefined && !!onAccountsChanged && !onlyMachine;return (<li data-engine={engine.id} data-status={off ? 'off' : usable ? 'ready' : engine.status} aria-labelledby={labelId} className="rounded-xl border border-zinc-800 bg-zinc-900/90 text-xs"><div className="flex items-start gap-2.5 p-3">@@ -72,7 +77,7 @@ export const EngineCard: React.FC<{<h4 id={labelId} className={`font-semibold ${off ? 'text-zinc-400' : 'text-zinc-100'}`}>{engine.name}</h4>- {engine.version && <span className="text-[10px] font-mono text-zinc-500">v{engine.version}</span>}+ {engine.version && <span className="text-[10px] tabular-nums text-zinc-500">v{engine.version}</span>}<StatusPill tone={view.tone}>{view.label}</StatusPill></div><p data-summary className={`text-[11px] leading-snug break-words ${SUMMARY_TEXT[summary.tone]}`}>@@ -86,8 +91,18 @@ export const EngineCard: React.FC<{{engine.models.length > 3 ? '…' : ''}</p>)}+ {isAbsent(engine) && INSTALL_URL[engine.id] && (+ <a+ href={INSTALL_URL[engine.id]}+ target="_blank"+ rel="noreferrer"+ className="inline-flex items-center gap-1 text-[11px] text-violet-300 hover:text-violet-200 hover:underline underline-offset-2"+ >+ Install {engine.name} <ExternalLink size={10} aria-hidden="true" />+ </a>+ )}{/* Without a "This machine" row to hold it, the sign-in sits here. */}- {signInHere && <div className="pt-0.5">{hostAction}</div>}+ {signInHere && hostAction && <div className="pt-0.5">{hostAction}</div>}</div>{onToggle && typeof engine.enabled === 'boolean' && (<button@@ -196,8 +211,9 @@ export const EnginesPanel: React.FC<{ api: EnginesApi; accounts?: ProfilesState;const profiles = accounts?.profiles ?? null;const sorted = engines ? sortEngines(engines) : [];const cardAccounts = (e: EngineInfo) => (profiles ? accountsForCard(profiles, e.id) : undefined);- // An engine missing here but with accounts of its own (an API key account, say) still gets a card.- const present = sorted.filter((e) => !isAbsent(e) || (cardAccounts(e)?.length ?? 0) > 0);+ // An engine missing here but with accounts of its own (an API key account, say) still gets a card;+ // its "This machine" row alone doesn't count.+ const present = sorted.filter((e) => !isAbsent(e) || (cardAccounts(e) ?? []).some((p) => p.kind !== 'system'));const absent = sorted.filter((e) => !present.includes(e));const lastChecked = sorted.map((e) => e.checked_at).filter(Boolean).sort().pop() ?? null;const ago = checkedAgo(lastChecked, now);@@ -211,15 +227,21 @@ export const EnginesPanel: React.FC<{ api: EnginesApi; accounts?: ProfilesState;};const signedIn = () => void accountsChanged();+ // Nothing runs yet: "Pick one to start" leads, and holds Claude's sign-in so it isn't drawn twice.+ // An engine someone switched off isn't a first run: its card says how to turn it back on.+ const picking = !!engines && engines.length > 0 && !engines.some(isUsable) && !engines.some((e) => e.enabled === false);+const card = (e: EngineInfo) => (<EngineCardkey={e.id}engine={e}now={now}- onToggle={(on) => setEnabled(e.id, on)}+ // A switch only means something once the engine is on this computer, and once something runs.+ onToggle={isAbsent(e) || picking ? undefined : (on) => setEnabled(e.id, on)}accounts={cardAccounts(e)}onAccountsChanged={accounts ? accountsChanged : undefined}- hostAction={hostAction(e, api, signedIn, focusClaudeSignIn)}+ hostAction={picking && e.id === 'claude' ? null : hostAction(e, api, signedIn, focusClaudeSignIn)}+ signInAbove={picking && e.id === 'claude' && claudeNeedsSignIn(engines)}/>);@@ -252,10 +274,14 @@ export const EnginesPanel: React.FC<{ api: EnginesApi; accounts?: ProfilesState;? 'Checking which engines can run…': engines.length === 0? 'This server doesn’t report engine status yet.'- : headline(engines, profiles, now)}+ : picking+ ? 'Nothing can answer yet. Pick one way to start:'+ : headline(engines, profiles, now)}</p>)}+ {picking && <StartPicker engines={engines!} onSignedIn={signedIn} onKeyAdded={signedIn} focusClaudeSignIn={focusClaudeSignIn} initial={claudeNeedsSignIn(engines) ? 'claude' : null} />}+{error && (<p role="alert" className="flex items-center gap-1.5 text-[11px] text-rose-300"><AlertTriangle size={12} aria-hidden="true" /> {error}diff --git a/frontend/src/components/FirstRunWelcome.tsx b/frontend/src/components/FirstRunWelcome.tsxnew file mode 100644index 00000000..bf315e7c--- /dev/null+++ b/frontend/src/components/FirstRunWelcome.tsx@@ -0,0 +1,55 @@+import React from 'react';+import { KeyRound } from 'lucide-react';+import { ModernAvatar } from './ModernAvatar';++export interface WelcomeBot {+ id: string;+ name: string;+ title?: string;+ avatar_sprite?: string;+}++interface Props {+ bots: WelcomeBot[];+ /** "Sign in with Claude" when Claude is installed but signed out; otherwise "Add an account". */+ actionLabel: string;+ onAction: () => void;+}++/** Shown in an empty chat until an account works: what kwant is, who the bots are, one next step. */+export const FirstRunWelcome: React.FC<Props> = ({ bots, actionLabel, onAction }) => (+ <section aria-labelledby="kw-welcome-title" data-first-run-welcome="" className="mx-auto w-full max-w-lg pt-6 sm:pt-16 text-center">+ <div className="flex justify-center -space-x-2 mb-4" aria-hidden="true">+ {bots.slice(0, 5).map((b) => (+ <span key={b.id} className="rounded-full ring-4 ring-zinc-950">+ <ModernAvatar role={b.avatar_sprite} name={b.name} size={44} />+ </span>+ ))}+ </div>+ <h2 id="kw-welcome-title" className="text-lg font-semibold text-zinc-100">+ Welcome to kwant bots+ </h2>+ <p className="mt-1.5 text-sm text-zinc-400">+ These are your bots. Ask anything here and Laya picks who 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">+ {bots.slice(0, 5).map((b) => (+ <li key={b.id}>+ <span className="font-medium text-zinc-200">{b.name}</span>+ {b.title && <span className="text-zinc-500"> · {b.title}</span>}+ </li>+ ))}+ </ul>+ )}+ <button+ type="button"+ onClick={onAction}+ className="mt-6 inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium text-white bg-violet-600 hover:bg-violet-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-violet-300"+ >+ <KeyRound size={15} aria-hidden="true" />+ {actionLabel}+ </button>+ <p className="mt-2 text-[11px] text-zinc-500">Sign in with Claude or ChatGPT, or paste an API key. Your bots can answer once one works.</p>+ </section>+);diff --git a/frontend/src/components/ReplyMeta.tsx b/frontend/src/components/ReplyMeta.tsxnew file mode 100644index 00000000..a39c2fbb--- /dev/null+++ b/frontend/src/components/ReplyMeta.tsx@@ -0,0 +1,80 @@+import React, { useId, useState } from 'react';+import { ChevronRight } from 'lucide-react';+import { localClock } from '../clock';++export interface ReplyFacts {+ /** "Claude · Opus 5.5": the engine and model the reply ran on. */+ ranOn?: string | null;+ account?: string | null;+ tokens?: { label: string; detail: string } | null;+}++export interface ReplyMetaProps extends ReplyFacts {+ name: string;+ /** The message's created_at; no time is shown without one (a reply still streaming). */+ at?: string | null;+ /** Drawn before the name on phones, where the avatar column is hidden. */+ avatar?: React.ReactNode;+ /** Whether a step failed: the Details toggle says so while it's folded. */+ failed?: boolean;+ now?: number;+ /** Steps and the reasoning item; shown with the facts when Details is open. */+ children?: React.ReactNode;+}++const hasContent = (n: React.ReactNode) => React.Children.toArray(n).length > 0;++/** A bot reply's header: one line, "Name · 3:42 PM", and a Details toggle holding the rest. */+export const ReplyMeta: React.FC<ReplyMetaProps> = ({ name, at, avatar, ranOn, account, tokens, failed = false, now, children }) => {+ const [open, setOpen] = useState(false);+ const panelId = useId();+ const time = localClock(at, now);+ const facts: Array<[string, React.ReactNode]> = [];+ if (ranOn) facts.push(['Model', ranOn]);+ if (account) facts.push(['Account', account]);+ if (tokens) facts.push(['Tokens', <span title={tokens.detail}>{tokens.label}<span className="text-zinc-500"> · {tokens.detail}</span></span>]);+ const hasDetails = facts.length > 0 || hasContent(children);+ return (+ <div className="w-full max-w-full min-w-0">+ <div className="flex items-center gap-2 mb-1.5 text-[11px] text-zinc-400 font-medium max-w-full min-w-0 whitespace-nowrap">+ {avatar && <span className="sm:hidden shrink-0 inline-flex">{avatar}</span>}+ <span className="text-zinc-200 shrink-0">{name}</span>+ {time && (+ <span className="text-zinc-500 truncate min-w-0" data-reply-time="">+ <span aria-hidden="true">· </span>+ {time}+ </span>+ )}+ {hasDetails && (+ <button+ type="button"+ onClick={() => setOpen((o) => !o)}+ aria-expanded={open}+ aria-controls={open ? panelId : undefined}+ className={`shrink-0 inline-flex items-center gap-0.5 rounded px-1 -mx-0.5 min-h-[24px] text-[11px] hover:text-zinc-200 hover:bg-zinc-900 transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-sky-400 ${+ failed && !open ? 'text-rose-300' : 'text-zinc-500'+ }`}+ >+ {failed && !open ? 'Details · a step failed' : 'Details'}+ <ChevronRight size={12} className={`transition-transform motion-reduce:transition-none ${open ? 'rotate-90' : ''}`} aria-hidden="true" />+ </button>+ )}+ </div>+ {open && hasDetails && (+ <div id={panelId} className="mb-2 w-full max-w-2xl">+ {facts.length > 0 && (+ <dl className="mb-2 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-[11px]">+ {facts.map(([k, v]) => (+ <React.Fragment key={k}>+ <dt className="text-zinc-500">{k}</dt>+ <dd className="text-zinc-300 min-w-0 break-words">{v}</dd>+ </React.Fragment>+ ))}+ </dl>+ )}+ {children}+ </div>+ )}+ </div>+ );+};diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsxindex 0a087719..4a089db7 100644--- a/frontend/src/components/Sidebar.tsx+++ b/frontend/src/components/Sidebar.tsx@@ -1,9 +1,9 @@import React, { useCallback, useEffect, useState } from 'react';-import { Hash, Plus, CheckCircle2, AlertTriangle, Loader2, Users, ChevronDown, Settings2, X, Crown, UserPlus, Pencil, Inbox, Search, CalendarClock, ShieldOff, ListChecks, Split, Hand, Plug, MoreHorizontal, UserMinus, MessageSquare, KanbanSquare } from 'lucide-react';+import { Hash, Plus, CheckCircle2, KeyRound, Loader2, Users, ChevronDown, Settings2, X, Crown, UserPlus, Pencil, Inbox, Search, CalendarClock, ShieldOff, ListChecks, Split, Hand, Plug, MoreHorizontal, UserMinus, MessageSquare, KanbanSquare } from 'lucide-react';import { ModernAvatar } from './ModernAvatar';import { playSfx } from '../audio/chiptune';import { badgeText } from '../away';-import { canRunNow, isUsable, pickLabel } from '../engines';+import { canRunNow, engineTip, isUsable } from '../engines';import { STATUS_DOT, statusOf, statusText, type BotStatus } from '../botStatus';import { EnginesApi, useEngines } from '../useEngines';import { claudeNeedsSignIn } from '../claudeLogin';@@ -380,6 +380,8 @@ export const Sidebar: React.FC<SidebarProps> = ({<buttonkey={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}className={`w-full flex items-center gap-2.5 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-all text-left ${active? 'bg-zinc-800 text-zinc-100 shadow-sm border border-zinc-700/50'@@ -388,11 +390,6 @@ export const Sidebar: React.FC<SidebarProps> = ({><Hash size={15} className={active ? 'text-sky-400' : 'text-zinc-500'} /><span className="truncate flex-1">{c.name}</span>- {layaRoutes(c, kwants.length) && (- <span className="shrink-0 text-[10px] px-1.5 py-px rounded-full border border-violet-500/30 bg-violet-500/10 text-violet-200" title="Laya picks who answers here">- Laya- </span>- )}</button>);})}@@ -476,7 +473,7 @@ export const Sidebar: React.FC<SidebarProps> = ({</div><div className="flex items-center gap-1 flex-shrink-0">{!expanded && (- <span className="text-[10px] px-1.5 py-0.5 rounded-full font-mono bg-zinc-800/80 text-zinc-400 border border-zinc-800">+ <span className="text-[10px] px-1.5 py-0.5 rounded-full tabular-nums bg-zinc-800/80 text-zinc-400 border border-zinc-800">{memberIds.length}</span>)}@@ -716,7 +713,10 @@ export const Sidebar: React.FC<SidebarProps> = ({</span><div className="flex-1 min-w-0"><div className="flex items-center justify-between gap-1">- <span className="text-xs font-semibold text-zinc-200 truncate">{k.name}</span>+ {/* The full name; what it runs on is in the tooltip */}+ <span className="text-xs font-semibold text-zinc-200 truncate" title={`${k.name} · ${engineTip(k.preferred_model)}`}>+ {k.name}+ </span>{needsYou[k.id] > 0 && (<spanclassName="shrink-0 inline-flex items-center gap-1 px-1.5 py-px rounded-full text-[10px] font-medium bg-amber-400/15 text-amber-200 border border-amber-400/30"@@ -741,13 +741,6 @@ export const Sidebar: React.FC<SidebarProps> = ({<Pencil size={11} /></button>)}- {/* Capped, so a long model id (Custom API) leaves room for the bot's name. */}- <span- className="max-w-[60%] truncate whitespace-nowrap text-[10px] text-zinc-500 font-mono uppercase bg-zinc-900 px-1 py-0.2 rounded border border-zinc-800"- title={k.preferred_model === 'auto' ? 'Laya' : pickLabel(k.preferred_model)}- >- {k.preferred_model === 'auto' ? 'Laya' : pickLabel(k.preferred_model)}- </span></div>{busyKwants[k.id] ? (<p className="text-[11px] text-sky-300 truncate mt-0.5" title={busyKwants[k.id]}>@@ -796,16 +789,16 @@ export const Sidebar: React.FC<SidebarProps> = ({) : readyCount > 0 ? (<CheckCircle2 size={13} className="text-emerald-400" aria-hidden="true" />) : (- <AlertTriangle size={13} className="text-amber-400" aria-hidden="true" />+ <KeyRound size={13} className="text-violet-300" aria-hidden="true" />)}- {/* The warning wraps, so its fix is never cut off */}+ {/* The prompt wraps, so its fix is never cut off */}<span className={readyCount === 0 ? 'text-left' : 'truncate'}>{readyCount === null? 'Checking accounts…': readyCount === 0? offerClaude- ? 'Nothing can run here · Sign in with Claude'- : 'Nothing can run here · Add an account'+ ? 'No account yet · Sign in with Claude'+ : 'No account yet · Add an account': `Runs on ${runsOn[0]}${runsOn.length > 1 ? ` +${runsOn.length - 1}` : ''}`}</span></button>diff --git a/frontend/src/components/StartPicker.tsx b/frontend/src/components/StartPicker.tsxnew file mode 100644index 00000000..dddffd98--- /dev/null+++ b/frontend/src/components/StartPicker.tsx@@ -0,0 +1,135 @@+import React, { useState } from 'react';+import { ExternalLink, Key, LogIn } from 'lucide-react';+import { EngineInfo, INSTALL_URL } from '../engines';+import { playSfx } from '../audio/chiptune';+import { ClaudeSignIn } from './ClaudeSignIn';+import { NewKeyAccountForm } from './EngineAccounts';++export type StartChoice = 'claude' | 'codex' | 'key';++const KEY_PROVIDERS = [+ { card: 'anthropic_api', label: 'Anthropic' },+ { card: 'openai_api', label: 'OpenAI' },+ { card: 'xai_api', label: 'xAI' },+] as const;++const CHOICES: Array<{ id: StartChoice; title: string; hint: string; Icon: typeof Key }> = [+ { id: 'claude', title: 'Sign in with Claude', hint: 'Uses your Claude Pro or Max plan', Icon: LogIn },+ { id: 'codex', title: 'Sign in with ChatGPT', hint: 'Through Codex, with your ChatGPT plan', Icon: LogIn },+ { id: 'key', title: 'Paste an API key', hint: 'Anthropic, OpenAI or xAI', Icon: Key },+];++/** Inline `code` in an engine's hint like "Not signed in: run `codex login`". */+const withCode = (text: string) =>+ text.split(/(`[^`]+`)/).map((part, i) =>+ part.startsWith('`') && part.endsWith('`') ? (+ <code key={i} className="font-mono text-[10.5px] px-1 py-px rounded bg-zinc-800 text-zinc-200 select-text whitespace-nowrap">+ {part.slice(1, -1)}+ </code>+ ) : (+ <React.Fragment key={i}>{part}</React.Fragment>+ ),+ );++const InstallLink: React.FC<{ engine: EngineInfo | undefined; name: string }> = ({ engine, name }) => {+ const url = engine ? INSTALL_URL[engine.id] : undefined;+ return (+ <p className="text-[11px] text-zinc-400 leading-snug">+ {name} isn’t on this computer yet.{' '}+ {url && (+ <a href={url} target="_blank" rel="noreferrer" className="inline-flex items-center gap-0.5 text-violet-300 hover:text-violet-200 underline-offset-2 hover:underline">+ Install {name} <ExternalLink size={10} aria-hidden="true" />+ </a>+ )}+ {url && ', then press Re-check.'}+ </p>+ );+};++/** Settings when nothing can run yet: three ways to start, one opened at a time. */+export const StartPicker: React.FC<{+ engines: EngineInfo[];+ onSignedIn: () => void;+ onKeyAdded: () => void;+ focusClaudeSignIn?: number;+ initial?: StartChoice | null;+}> = ({ engines, onSignedIn, onKeyAdded, focusClaudeSignIn, initial = null }) => {+ const [choice, setChoice] = useState<StartChoice | null>(initial ?? (focusClaudeSignIn ? 'claude' : null));+ const [keyCard, setKeyCard] = useState<string>('anthropic_api');+ const claude = engines.find((e) => e.id === 'claude');+ const codex = engines.find((e) => e.id === 'codex');++ const body = () => {+ if (choice === 'claude') {+ if (!claude || claude.status === 'not_installed') return <InstallLink engine={claude ?? ({ id: 'claude' } as EngineInfo)} name="Claude Code" />;+ if (claude.enabled === false) return <p className="text-[11px] text-zinc-400">Claude is switched off. Turn it on in its card below.</p>;+ return <ClaudeSignIn onSignedIn={onSignedIn} focusRequest={focusClaudeSignIn} />;+ }+ if (choice === 'codex') {+ if (!codex || codex.status === 'not_installed') return <InstallLink engine={codex ?? ({ id: 'codex' } as EngineInfo)} name="Codex" />;+ if (codex.enabled === false) return <p className="text-[11px] text-zinc-400">Codex is switched off. Turn it on in its card below.</p>;+ return (+ <p className="text-[11px] text-zinc-400 leading-snug">+ {withCode(codex.detail || 'Run `codex login` on this computer and pick “Sign in with ChatGPT”.')} Then press Re-check.+ </p>+ );+ }+ if (choice === 'key')+ return (+ <div className="space-y-2">+ <div role="radiogroup" aria-label="Key from" className="flex flex-wrap gap-1.5">+ {KEY_PROVIDERS.map((p) => (+ <button+ key={p.card}+ type="button"+ role="radio"+ aria-checked={keyCard === p.card}+ onClick={() => setKeyCard(p.card)}+ className={`px-2.5 py-1 rounded-full text-[11px] border transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-violet-400 ${+ keyCard === p.card ? 'border-violet-500/60 bg-violet-500/15 text-violet-100' : 'border-zinc-800 text-zinc-400 hover:text-zinc-200'+ }`}+ >+ {p.label}+ </button>+ ))}+ </div>+ <NewKeyAccountForm card={keyCard} onCancel={() => setChoice(null)} onCreated={onKeyAdded} />+ </div>+ );+ return null;+ };++ return (+ <div data-start-picker="" className="rounded-xl border border-violet-500/25 bg-violet-500/[0.05] p-3 space-y-2.5">+ <div>+ <h4 className="text-xs font-semibold text-zinc-100">Pick one to start</h4>+ <p className="text-[11px] text-zinc-400">Your bots answer once one of these works. You can add more later.</p>+ </div>+ <div role="radiogroup" aria-label="How to start" className="grid grid-cols-1 sm:grid-cols-3 gap-2">+ {CHOICES.map(({ id, title, hint, Icon }) => (+ <button+ key={id}+ type="button"+ role="radio"+ aria-checked={choice === id}+ data-start-choice={id}+ onClick={() => {+ playSfx('click');+ setChoice(id);+ }}+ className={`text-left rounded-lg border px-3 py-2.5 min-h-[44px] transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-violet-400 ${+ choice === id ? 'border-violet-500/60 bg-violet-500/10' : 'border-zinc-800 bg-zinc-900/80 hover:border-zinc-700'+ }`}+ >+ <span className="flex items-center gap-1.5 text-xs font-medium text-zinc-100">+ <Icon size={13} className="text-violet-300" aria-hidden="true" />+ {title}+ </span>+ <span className="block mt-0.5 text-[11px] text-zinc-500">{hint}</span>+ </button>+ ))}+ </div>+ {choice && <div className="pt-1">{body()}</div>}+ </div>+ );+};diff --git a/frontend/src/connections.ts b/frontend/src/connections.tsindex b8a7e9b6..02a12b2f 100644--- a/frontend/src/connections.ts+++ b/frontend/src/connections.ts@@ -23,6 +23,8 @@ export interface Connection {detail: string | null;status: ConnectionStatus | string;status_detail: string | null;+ /** When an account that ran out of quota can run again (RFC 3339); only on limited accounts. */+ limited_until?: string | null;last_check: string | null;used_by: UsedBy[];logins_stored: LoginsStored | string;@@ -77,6 +79,10 @@ export class ConnectionsError extends Error {}}+/** An MCP server's local command ("/usr/bin/python3", "npx"), as opposed to the host of a remote one. */+export const isRawCommand = (c: Pick<Connection, 'kind' | 'detail'>): boolean =>+ c.kind === 'mcp' && !!c.detail && !/^[\w-]+(\.[\w-]+)+(:\d+)?$/.test(c.detail);+const sentence = (s: string) => {const t = s.trim();const up = t.charAt(0).toUpperCase() + t.slice(1);diff --git a/frontend/src/engines.ts b/frontend/src/engines.tsindex 6d10a7df..7d319361 100644--- a/frontend/src/engines.ts+++ b/frontend/src/engines.ts@@ -102,6 +102,13 @@ export function sortEngines(list: EngineInfo[]): EngineInfo[] {* installed" too, but it stays out: adding a key on its card is how it becomes usable. */export const isAbsent = (e: EngineInfo) => e.status === 'not_installed' && e.kind !== 'api' && e.enabled !== false && !isUsable(e);+/** Where to get an engine that isn't on this computer. */+export const INSTALL_URL: Partial<Record<EngineId, string>> = {+ claude: 'https://docs.claude.com/en/docs/claude-code/setup',+ codex: 'https://github.com/openai/codex#quickstart',+ ollama: 'https://ollama.com/download',+};+/** Whether only CLIs can run things right now (so "no API keys needed" is true). */export const onlyCliReady = (list: EngineInfo[]) => {const ready = list.filter(isUsable);@@ -265,6 +272,11 @@ export function pickLabel(value: string, engines: EngineInfo[] | null = null): sreturn `${family} · ${known?.label ?? pick.model}`;}+/** A bot's engine in words, for its tooltip in the bot list: "Laya picks the model", "Runs on Claude · Sonnet". */+export function engineTip(value: string, engines: EngineInfo[] | null = null): string {+ return parsePick(value).family === 'auto' ? 'Laya picks the model' : `Runs on ${pickLabel(value, engines)}`;+}+/** "Claude Haiku (latest)" → "Haiku" when shown after the family name. */function shortModelLabel(label: string, family: string): string {const out = label.replace(/\s*\(latest\)$/i, '');diff --git a/frontend/tests/activity.test.mjs b/frontend/tests/activity.test.mjsindex 3d6eed93..9026eba0 100644--- a/frontend/tests/activity.test.mjs+++ b/frontend/tests/activity.test.mjs@@ -88,12 +88,12 @@ test('live list: steps, mono command, waits announced, reduced motion', () => {assert.equal(ui.live({ live: { turnId: 't', steps: [], thinking: {} }, idBase: 'x' }), '');});-test('saved list starts collapsed to the summary; the engine note stays visible', () => {+test('saved list starts collapsed to the summary; the engine note waits inside the steps', () => {const activity = { steps: [step({ status: 'ok', duration_ms: 900 }), step({ id: 'n', kind: 'note', status: 'ok', title: 'This engine doesn’t share its thinking.' })], dropped: 0 };const html = ui.saved({ activity, idBase: 'm1' });assert.match(html, /aria-expanded="false"/);assert.match(html, /1 step/);- assert.match(html, /doesn’t share its thinking/);+ assert.doesNotMatch(html, /doesn’t share its thinking/, 'the note is a step, not a line under the reply');assert.doesNotMatch(html, /cargo test/, 'steps hidden until opened');assert.equal(a.hasThinkingText(activity), false);assert.equal(a.hasThinkingText({ steps: [step({ kind: 'thinking', status: 'done', text: 'hm' })], dropped: 0 }), true);diff --git a/frontend/tests/claudeLogin.test.mjs b/frontend/tests/claudeLogin.test.mjsindex 82f084fb..58a14e69 100644--- a/frontend/tests/claudeLogin.test.mjs+++ b/frontend/tests/claudeLogin.test.mjs@@ -136,7 +136,7 @@ test('a signed-out Claude row offers "Sign in with Claude"; the summary points aconst html = panel([signedOut, engine('codex', { status: 'not_installed' })]);assert.match(html, /Sign in with Claude<\/button>/);assert.match(html, /Opens claude.ai in a new tab/);- assert.match(html, /No engine can run right now\. Sign in with Claude below, or add an account\./);+ assert.match(html, /Nothing can answer yet\. Pick one way to start:/);assert.doesNotMatch(html, />Sign out</);// The button replaces "run `claude login`".assert.doesNotMatch(html, /claude login/);diff --git a/frontend/tests/engines.test.mjs b/frontend/tests/engines.test.mjsindex 7c943d0f..f0cb0aa4 100644--- a/frontend/tests/engines.test.mjs+++ b/frontend/tests/engines.test.mjs@@ -114,7 +114,8 @@ test('the headline gives way to the route summary once something is ready', () =// With something ready, the route summary answers "what runs" instead of a count.assert.match(panel(live), /What runs your kwant bots/);assert.doesNotMatch(panel(live), /no API keys are needed/);- assert.match(panel(live.map((e) => ({ ...e, status: 'signed_out' }))), /No engine can run right now/);+ assert.match(panel(live.map((e) => ({ ...e, status: 'signed_out' }))), /Nothing can answer yet/);+ assert.match(panel(live.map((e) => ({ ...e, status: 'signed_out', enabled: e.id !== 'codex' }))), /No engine can run right now/);assert.match(panel(null), /Checking which engines can run/);});diff --git a/frontend/tests/enginesAccounts.test.mjs b/frontend/tests/enginesAccounts.test.mjsindex 1a69a4d6..81286a52 100644--- a/frontend/tests/enginesAccounts.test.mjs+++ b/frontend/tests/enginesAccounts.test.mjs@@ -104,7 +104,8 @@ test('nothing signed in: the card and headline name the next step', () => {const out = engine('claude', { status: 'signed_out', ready: false, uses: null });const html = panel([out], [machine, { ...personal, signed_in: false }]);assert.equal(summary(html, 'claude'), 'No account is signed in · Sign in to one below');- assert.match(html, /No engine can run right now\. Sign in with Claude below, or add an account\./);+ // A first run: "Pick one to start" leads instead of a warning.+ assert.match(html, /Nothing can answer yet\. Pick one way to start:/);assert.match(html, /Not signed in/);assert.match(html, /Sign in with Claude<\/button>/);// Personal offers its own sign-in.diff --git a/frontend/tests/quickWins.test.mjs b/frontend/tests/quickWins.test.mjsnew file mode 100644index 00000000..b881c83e--- /dev/null+++ b/frontend/tests/quickWins.test.mjs@@ -0,0 +1,165 @@+// Pre-launch quick wins (ux-review/review.md, PR 1): one-line reply meta, readable quota times,+// raw commands behind Details, engine names in tooltips, a first-run welcome and "Pick one to start".+import assert from 'node:assert/strict';+import test from 'node:test';+import { readFileSync } from 'node:fs';+import { loadBundled } from './bundle.mjs';++// Local times read in this process's zone; pin it before anything formats a date.+process.env.TZ = 'UTC';+globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };++const m = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { ReplyMeta } from './src/components/ReplyMeta';+ import { FirstRunWelcome } from './src/components/FirstRunWelcome';+ import { StartPicker } from './src/components/StartPicker';+ import { ConnectionRow } from './src/components/ConnectionsView';+ export { localClock, quotaLine } from './src/clock';+ export { engineTip, INSTALL_URL } from './src/engines';+ export { isRawCommand } from './src/connections';+ const r = (C) => (props) => renderToStaticMarkup(React.createElement(C, props));+ export const meta = r(ReplyMeta);+ export const welcome = r(FirstRunWelcome);+ export const picker = r(StartPicker);+ export const row = (props) => renderToStaticMarkup(React.createElement('ul', null, React.createElement(ConnectionRow, props)));+ export const el = React.createElement;+`);++const NOW = Date.parse('2026-11-02T12:00:00Z');++test('localClock: the time today, the date on another day, the year in another year', () => {+ assert.equal(m.localClock('2026-11-02T20:15:00Z', NOW, 'en-US'), '8:15 PM');+ assert.equal(m.localClock('2026-11-03T08:01:00Z', NOW, 'en-US'), 'Nov 3, 8:01 AM');+ assert.equal(m.localClock('2027-01-05T09:00:00Z', NOW, 'en-US'), 'Jan 5, 2027, 9:00 AM');+ assert.equal(m.localClock(null, NOW), null);+ assert.equal(m.localClock('not a time', NOW), null);+});++test('quotaLine: "Out of quota until …" while the limit lasts, the server words otherwise', () => {+ assert.equal(m.quotaLine('Out of quota', '2026-11-02T20:15:00Z', NOW, 'en-US'), 'Out of quota until 8:15 PM');+ assert.equal(m.quotaLine('Out of quota', '2026-11-02T10:00:00Z', NOW, 'en-US'), 'Out of quota');+ assert.equal(m.quotaLine('Not checked yet', null, NOW, 'en-US'), 'Not checked yet');+ assert.equal(m.quotaLine(null, undefined, NOW), null);+});++test('reply meta is one line, name · time, with engine, account and tokens behind Details', () => {+ const html = m.meta({+ name: 'Architect',+ at: '2026-11-02T11:42:00Z',+ now: NOW,+ ranOn: 'Claude · Opus 5.5',+ account: 'Personal',+ tokens: { label: '1.2k tokens', detail: '900 in · 300 out' },+ });+ assert.match(html, />Architect</);+ assert.match(html, /data-reply-time/);+ assert.match(html, /aria-expanded="false"/);+ assert.match(html, />Details</);+ // Folded: none of the facts show.+ assert.doesNotMatch(html, /Opus 5\.5|Personal|1\.2k tokens/);+});++test('reply meta: a failed step shows on the folded toggle; no toggle without details', () => {+ assert.match(m.meta({ name: 'Ada', ranOn: 'Codex', failed: true }), /Details · a step failed/);+ const bare = m.meta({ name: 'Ada' });+ assert.doesNotMatch(bare, /Details/);+ assert.doesNotMatch(bare, /data-reply-time/);+});++test('engineTip: the engine goes in the tooltip, Auto says Laya picks', () => {+ assert.equal(m.engineTip('auto'), 'Laya picks the model');+ assert.match(m.engineTip('claude'), /^Runs on /);+});++test('sidebar rows carry no LAYA pill or engine badge; the engine is in the name tooltip', () => {+ const src = readFileSync(new URL('../src/components/Sidebar.tsx', import.meta.url), 'utf8');+ assert.doesNotMatch(src, />\s*Laya\s*</);+ assert.match(src, /title=\{`\$\{k\.name\} · \$\{engineTip\(k\.preferred_model\)\}`\}/);+ // No account yet reads as a next step, not a warning.+ assert.doesNotMatch(src, /Nothing can run here/);+});++test('first-run welcome: what kwant bots are, the bots, one action', () => {+ let clicked = 0;+ const html = m.welcome({+ bots: [+ { id: 'a', name: 'Architect', title: 'Systems Architect', avatar_sprite: 'architect' },+ { id: 'b', name: 'TechLead' },+ ],+ actionLabel: 'Add an account',+ onAction: () => clicked++,+ });+ assert.match(html, /data-first-run-welcome/);+ assert.match(html, /Laya picks who answers/);+ assert.match(html, /Architect<\/span><span[^>]*> · Systems Architect/);+ assert.match(html, />TechLead</);+ assert.equal(html.split('<button').length, 2, 'exactly one button');+ assert.match(html, /Add an account<\/button>/);+});++const engine = (id, over = {}) => ({+ id, name: id, kind: 'cli', status: 'not_installed', detail: null, version: null, models: [], checked_at: null, enabled: true, ready: false, uses: null, ...over,+});++test('Pick one to start: three choices; Claude opens first when it only needs a sign-in', () => {+ const html = m.picker({ engines: [engine('claude', { status: 'signed_out' })], onSignedIn() {}, onKeyAdded() {}, initial: 'claude' });+ assert.match(html, /Pick one to start/);+ for (const c of ['claude', 'codex', 'key']) assert.match(html, new RegExp(`data-start-choice="${c}"`));+ assert.match(html, /Sign in with ChatGPT/);+ assert.match(html, /Paste an API key/);+ assert.match(html, /data-start-choice="claude"[^>]*aria-checked="true"|aria-checked="true"[^>]*data-start-choice="claude"/);+ assert.match(html, /Sign in with Claude<\/button>/);+});++test('Pick one to start: an engine that is not installed offers an Install link instead', () => {+ const html = m.picker({ engines: [engine('codex')], onSignedIn() {}, onKeyAdded() {}, initial: 'codex' });+ assert.match(html, /Codex isn’t on this computer yet/);+ assert.ok(html.includes(`href="${m.INSTALL_URL.codex}"`));+ const key = m.picker({ engines: [], onSignedIn() {}, onKeyAdded() {}, initial: 'key' });+ assert.match(key, /role="radio" aria-checked="true"[^>]*>Anthropic</);+ assert.match(key, /type="password"/);+});++const conn = (over = {}) => ({+ id: 'mcp:s1', kind: 'mcp', name: 'files', detail: '/usr/bin/python3', status: 'connected', status_detail: null,+ last_check: null, used_by: [], logins_stored: 'kwnt', manage: '/api/mcp/servers/s1', ...over,+});++test('a local MCP command waits behind Details; a remote host stays in view', () => {+ assert.ok(m.isRawCommand(conn()));+ assert.ok(m.isRawCommand(conn({ detail: 'npx' })));+ assert.ok(!m.isRawCommand(conn({ detail: 'api.githubcopilot.com' })));+ assert.ok(!m.isRawCommand(conn({ kind: 'email', detail: '[email protected]' })));+ const html = m.row({ c: conn(), now: NOW });+ assert.match(html, /<details[^>]*>.*Details<\/summary><code[^>]*>\/usr\/bin\/python3<\/code><\/details>/s);+ const remote = m.row({ c: conn({ detail: 'api.githubcopilot.com' }), now: NOW });+ assert.doesNotMatch(remote, /<details/);+});++test('an account out of quota says until when, in local time', () => {+ const html = m.row({+ c: conn({ id: 'account:p1', kind: 'account', detail: null, status: 'limited', status_detail: 'Out of quota', limited_until: '2026-11-02T20:15:00Z' }),+ now: NOW,+ });+ assert.match(html, /Out of quota until \d{1,2}:15/);+});++test('an engine that is not installed folds away with no switch or "This machine" row', async () => {+ const { panel } = await loadBundled(`+ import React from 'react';+ import { renderToStaticMarkup } from 'react-dom/server.browser';+ import { EnginesPanel } from './src/components/EnginesPanel';+ export const panel = (engines, profiles) => renderToStaticMarkup(React.createElement(EnginesPanel, {+ api: { engines, error: null, rechecking: false, recheck() {}, setEnabled() {}, reload: async () => {} },+ accounts: { profiles, error: null, reload: async () => {} },+ }));+ `);+ const machine = (eng) => ({ id: `prf_${eng}`, engine: eng, name: 'This machine', kind: 'system', is_default: true, signed_in: false, has_key: null });+ const html = panel([engine('claude', { status: 'signed_out' }), engine('codex'), engine('grok')], [machine('claude'), machine('codex'), machine('grok')]);+ assert.match(html, /Pick one to start/);+ assert.match(html, /Not available on this computer \(2\)/);+ assert.doesNotMatch(html, /role="switch"[^>]*aria-labelledby="engine-/, 'no engine switches until something runs');+ assert.doesNotMatch(html, /data-engine="codex"/, 'folded until opened');+});diff --git a/site-src/docs-mission-board.html b/site-src/docs-mission-board.htmlindex ef9bda9b..2aa0f7be 100644--- a/site-src/docs-mission-board.html+++ b/site-src/docs-mission-board.html@@ -15,7 +15,7 @@ card_art: avatar:tech_lead</figure><h2 id="on">Turn it on</h2>-<p>The board is off until you switch it on: <strong>Settings → Mission board → Show the Mission board</strong>. Turning it off hides the board and stops new tasks; nothing is deleted.</p>+<p>The board is on from the start. To hide it, turn off <strong>Settings → Mission board → Show the Mission board</strong>. Turning it off hides the board and stops new tasks; nothing is deleted.</p><h2 id="columns">The columns</h2><div class="table-wrap"><table>diff --git a/site/docs/mission-board.html b/site/docs/mission-board.htmlindex 6134c176..b44e760e 100644--- a/site/docs/mission-board.html+++ b/site/docs/mission-board.html@@ -65,7 +65,7 @@</figure><h2 id="on">Turn it on</h2>-<p>The board is off until you switch it on: <strong>Settings → Mission board → Show the Mission board</strong>. Turning it off hides the board and stops new tasks; nothing is deleted.</p>+<p>The board is on from the start. To hide it, turn off <strong>Settings → Mission board → Show the Mission board</strong>. Turning it off hides the board and stops new tasks; nothing is deleted.</p><h2 id="columns">The columns</h2><div class="table-wrap"><table>diff --git a/src/db/spaces.rs b/src/db/spaces.rsindex ec0a21b2..07132417 100644--- a/src/db/spaces.rs+++ b/src/db/spaces.rs@@ -202,7 +202,7 @@ impl Database {let mut conn = self.pool.acquire().await?;// Table rebuilds need foreign keys off, and SQLite ignores this pragma inside a transactionsqlx::query("PRAGMA foreign_keys = OFF").execute(&mut *conn).await?;- let result = migrate_in_transaction(&mut conn).await;+ let result = migrate_in_transaction(&mut conn, fresh).await;sqlx::query("PRAGMA foreign_keys = ON").execute(&mut *conn).await?;match result {@@ -281,7 +281,7 @@ fn restrict(_path: &Path, _mode: u32) -> std::io::Result<()> {Ok(())}-async fn migrate_in_transaction(conn: &mut SqliteConnection) -> Result<(), DbError> {+async fn migrate_in_transaction(conn: &mut SqliteConnection, fresh: bool) -> Result<(), DbError> {// Violations already in the data aren't ours to fix; only new ones abort the migrationlet violations_before = foreign_key_violations(conn).await?;@@ -299,8 +299,13 @@ async fn migrate_in_transaction(conn: &mut SqliteConnection) -> Result<(), DbErr).execute(&mut *tx).await?;- sqlx::query("INSERT INTO spaces (id, name, icon, color, sort) VALUES (?, 'Default', '💼', 'amber', 0)")+ // A new install starts in "My space"; a database from before spaces keeps the name it was migrated with+ let (name, icon, color) = if fresh { ("My space", "🏠", "violet") } else { ("Default", "💼", "amber") };+ sqlx::query("INSERT INTO spaces (id, name, icon, color, sort) VALUES (?, ?, ?, ?, 0)").bind(DEFAULT_SPACE_ID)+ .bind(name)+ .bind(icon)+ .bind(color).execute(&mut *tx).await?;diff --git a/src/server/bot_actions.rs b/src/server/bot_actions.rsindex 6666c33a..c329fa6a 100644--- a/src/server/bot_actions.rs+++ b/src/server/bot_actions.rs@@ -1424,7 +1424,8 @@ impl Ctx<'_> {async fn space_archive(&self, args: &Value) -> ToolResult {if self.space.is_default() {- return fail("The Default space can't be archived.");+ let first = self.space_json(&self.space).await;+ return fail(format!("{} is the first space and can't be archived.", first["name"].as_str().unwrap_or("This")));}let mut after = self.space_json(&self.space).await;let name = after["name"].as_str().unwrap_or("").to_string();diff --git a/src/server/connections.rs b/src/server/connections.rsindex a58e5bf0..6de9b0ca 100644--- a/src/server/connections.rs+++ b/src/server/connections.rs@@ -55,6 +55,9 @@ pub struct Connection {/// `connected`, `needs_sign_in`, `limited`, `error`, `off`, `locked` or `unknown`.pub status: &'static str,pub status_detail: Option<String>,+ /// While `status` is `limited`: when the account's quota comes back. Screens format it in local time.+ #[serde(skip_serializing_if = "Option::is_none")]+ pub limited_until: Option<DateTime<Utc>>,pub last_check: Option<DateTime<Utc>>,pub used_by: Vec<UsedBy>,/// Where its sign-in lives: `vault` (kwnt's password vault or Bitwarden), `kwnt` (kwnt's@@ -157,6 +160,7 @@ async fn mcp_connections(state: &AppState, space: &SpaceId, kwants: &[Kwant]) ->detail,status,status_detail,+ limited_until: None,last_check: checks.get(&s.id).map(|c| c.at),used_by: used(&users),logins_stored: if is_composio(s) { "composio" } else { "kwnt" },@@ -203,8 +207,8 @@ async fn account_connections(state: &AppState, space: &SpaceId, kwants: &[Kwant]let custom_status = p.custom.as_ref().and_then(|c| c.status);let (status, status_detail): (&'static str, Option<String>) = if !p.enabled {("off", None)- } else if let Some(until) = p.limited_until {- ("limited", Some(format!("Out of quota until {}", until.to_rfc3339())))+ } else if p.limited_until.is_some() {+ ("limited", Some("Out of quota".into()))} else if let Some(s) = custom_status {use crate::drivers::custom::CheckStatus as C;match s {@@ -234,6 +238,7 @@ async fn account_connections(state: &AppState, space: &SpaceId, kwants: &[Kwant]detail,status,status_detail,+ limited_until: p.limited_until.filter(|_| status == "limited"),last_check: p.custom.as_ref().and_then(|c| c.checked_at),used_by: users.get(&p.id).cloned().unwrap_or_default(),logins_stored: "kwnt",@@ -275,6 +280,7 @@ async fn login_connections(state: &AppState, space: &SpaceId, kwants: &[Kwant])detail: Some(format!("{} @ {} · saved for {label}", m.username, m.origin)),status: "connected",status_detail: None,+ limited_until: None,last_check: DateTime::parse_from_rfc3339(&m.last_used).ok().map(|t| t.with_timezone(&Utc)),used_by: used(&users),logins_stored: "vault",@@ -320,6 +326,7 @@ async fn source_connections(state: &AppState, space: &SpaceId) -> Vec<Connectiondetail,status,status_detail,+ limited_until: None,last_check: s.last_scan_at,used_by: users.clone(),logins_stored: "vault",diff --git a/src/server/missions/mod.rs b/src/server/missions/mod.rsindex c7bfa784..545fcc99 100644--- a/src/server/missions/mod.rs+++ b/src/server/missions/mod.rs@@ -35,7 +35,7 @@ use crate::db::DbError;use crate::drivers::events::RuntimeEvent;use serde_json::{json, Value};-/// Setting key: `"true"` turns Mission Control on. Off by default.+/// Setting key: on by default; `"false"`, `"0"` or `"off"` turns Mission Control off.pub const SETTING: &str = "mission_board";pub const LEASE_SETTING: &str = "mission_lease_minutes";pub const BUDGET_SETTING: &str = "mission_default_budget_tokens";@@ -56,7 +56,7 @@ pub const DEFAULT_MAX_ATTEMPTS: i64 = 3;pub const MAX_EXCERPT: usize = 2_000;pub async fn enabled(state: &AppState) -> bool {- matches!(state.db.get_setting(SETTING).await.ok().flatten().as_deref().map(str::trim), Some("true" | "1" | "on"))+ !matches!(state.db.get_setting(SETTING).await.ok().flatten().as_deref().map(str::trim), Some("false" | "0" | "off"))}pub(crate) async fn int_setting(state: &AppState, key: &str, range: (i64, i64), default: i64) -> i64 {diff --git a/src/server/missions/tools.rs b/src/server/missions/tools.rsindex 0eff9590..6397bc96 100644--- a/src/server/missions/tools.rs+++ b/src/server/missions/tools.rs@@ -43,7 +43,7 @@ pub fn tools() -> Vec<Value> {vec![json!({"name": "mission_plan",- "description": "Propose a mission: a goal split into tasks with acceptance criteria and outcome checks. It is a draft until the person approves it on the board; nothing runs before that. Each task is verified only by its checks passing (or a teammate's review / the person), never by its owner saying it is done. Use it for multi-step work worth tracking, not for a quick answer.",+ "description": "Propose a mission: a goal split into tasks with acceptance criteria and outcome checks. It is a draft until the person approves it on the board; nothing runs before that. Each task is verified only by its checks passing (or a teammate's review / the person), never by its owner saying it is done. Use it only when the person asks for a plan, project or tracked multi-step work, never on your own for an ordinary request or a quick answer.","inputSchema": {"type": "object","properties": {diff --git a/tests/bot_actions_test.rs b/tests/bot_actions_test.rsindex 99eef37c..4a7bb0f4 100644--- a/tests/bot_actions_test.rs+++ b/tests/bot_actions_test.rs@@ -356,7 +356,7 @@ async fn deleting_a_bot_waits_for_the_person() {// Archiving the space: declined, nothing changeslet text = refused(&e, &token, "space_archive", json!({})).await;- assert!(text.contains("Default"), "{text}");+ assert!(text.contains("My space"), "{text}");}#[tokio::test]diff --git a/tests/chain_order_test.rs b/tests/chain_order_test.rsindex 192b3bdd..aecd8552 100644--- a/tests/chain_order_test.rs+++ b/tests/chain_order_test.rs@@ -143,6 +143,8 @@ async fn setup() -> Env {let tmp = tempfile::tempdir().unwrap();let data = tmp.path().join("data");let db = Database::init(&data).await.unwrap();+ // These turns predate the mission board, which is now on by default; keep it off here.+ db.set_setting("mission_board", "false").await.unwrap();// Laya is unreachable: turns use the kwant's preferred model, the fake claudelet config = Config {data_dir: data.clone(),diff --git a/tests/continuity_test.rs b/tests/continuity_test.rsindex 3c53b7a6..7d9591b3 100644--- a/tests/continuity_test.rs+++ b/tests/continuity_test.rs@@ -33,6 +33,8 @@ use tower::ServiceExt;async fn setup() -> (Router, AppState, TempDir) {let tmp = tempdir().unwrap();let db = Database::init(tmp.path()).await.unwrap();+ // These turns predate the mission board, which is now on by default; keep it off here.+ db.set_setting("mission_board", "false").await.unwrap();let config = Config {data_dir: tmp.path().to_path_buf(),..Config::default()diff --git a/tests/delegation_test.rs b/tests/delegation_test.rsindex 78774993..3b24386b 100644--- a/tests/delegation_test.rs+++ b/tests/delegation_test.rs@@ -126,6 +126,8 @@ async fn setup() -> Env {let tmp = tempfile::tempdir().unwrap();let data = tmp.path().join("data");let db = Database::init(&data).await.unwrap();+ // These turns predate the mission board, which is now on by default; keep it off here.+ db.set_setting("mission_board", "false").await.unwrap();// Laya is unreachable: turns use the kwant's preferred model, the fake claudelet config = Config {data_dir: data.clone(),diff --git a/tests/import_test.rs b/tests/import_test.rsindex 86f6e55c..78933ddd 100644--- a/tests/import_test.rs+++ b/tests/import_test.rs@@ -550,7 +550,7 @@ async fn space_export_is_named_after_the_space() {let e = setup().await;let named = new_space(&e, "Travel Team!").await;let symbols = new_space(&e, "★★★").await;- for (space, want) in [(dflt(), "Default.kwant.json".to_string()), (named, "Travel-Team.kwant.json".into()), (symbols.clone(), format!("{symbols}.kwant.json"))] {+ for (space, want) in [(dflt(), "My-space.kwant.json".to_string()), (named, "Travel-Team.kwant.json".into()), (symbols.clone(), format!("{symbols}.kwant.json"))] {let req = Request::builder().uri(format!("/api/export?space={space}")).body(Body::empty()).unwrap();let resp = e.app.clone().oneshot(req).await.unwrap();assert_eq!(resp.status(), StatusCode::OK);diff --git a/tests/mission_control_test.rs b/tests/mission_control_test.rsindex 37b9b148..b6a42fc1 100644--- a/tests/mission_control_test.rs+++ b/tests/mission_control_test.rs@@ -33,6 +33,14 @@ struct Env {}async fn setup() -> Env {+ let e = setup_fresh().await;+ let (status, v) = call(&e.app, "POST", "/api/settings", None, Some(json!({"mission_board": true}))).await;+ assert_eq!(status, StatusCode::OK, "{v}");+ e+}++/// A new install: nothing in settings about the board.+async fn setup_fresh() -> Env {let tmp = tempdir().unwrap();let db = Database::init(tmp.path()).await.unwrap();let config = Config { data_dir: tmp.path().to_path_buf(), ..Config::default() };@@ -46,10 +54,7 @@ async fn setup() -> Env {let space = SpaceId::default_space();let kwants = state.db.list_kwants(&space).await.unwrap();let general = state.db.list_channels(&space).await.unwrap().into_iter().find(|c| c.name == "general").unwrap().id;- let e = Env { app: create_router(state.clone()), bot: kwants[0].clone(), other: kwants[1].clone(), general, state, _tmp: tmp };- let (status, v) = call(&e.app, "POST", "/api/settings", None, Some(json!({"mission_board": true}))).await;- assert_eq!(status, StatusCode::OK, "{v}");- e+ Env { app: create_router(state.clone()), bot: kwants[0].clone(), other: kwants[1].clone(), general, state, _tmp: tmp }}async fn call(app: &Router, method: &str, uri: &str, auth: Option<&str>, body: Option<Value>) -> (StatusCode, Value) {@@ -137,6 +142,26 @@ async fn folder(e: &Env, mission_id: &str) -> std::path::PathBuf {p}+#[tokio::test]+async fn the_board_is_on_unless_turned_off() {+ let e = setup_fresh().await;+ let v = person(&e, "GET", "/api/settings", None).await;+ assert_eq!(v["mission_board"], json!(true), "{v}");+ let token = turn(&e, &e.bot, "t-fresh").await;+ let (_, v) = call(&e.app, "POST", "/api/mcp/self", Some(&token), Some(rpc("tools/list", json!({})))).await;+ let tools = v["result"]["tools"].as_array().unwrap();+ let plan = tools.iter().find(|t| t["name"] == "mission_plan").expect("mission_plan offered on a new install");+ // Bots plan only when asked: an ordinary request never starts a board task on its own.+ assert!(plan["description"].as_str().unwrap().contains("only when the person asks"), "{plan}");+ for off in ["false", "0", "off"] {+ e.state.db.set_setting("mission_board", off).await.unwrap();+ let v = person(&e, "GET", "/api/settings", None).await;+ assert_eq!(v["mission_board"], json!(false), "{off}: {v}");+ }+ e.state.db.set_setting("mission_board", "true").await.unwrap();+ assert_eq!(person(&e, "GET", "/api/settings", None).await["mission_board"], json!(true));+}+#[tokio::test]async fn tools_exist_only_while_the_board_is_on() {let e = setup().await;