Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions apps/desktop/src/design.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ const PILL_ALLOWED: [file: string, part: string, why: string][] = [
["ui/PullDiff.tsx", 'role="option"', "a completion row in a comment field's list"],
["ui/TurnChanges.tsx", "bg-fill-subtle", "the changes pill is a popover trigger"],
["ui/TurnTrace.tsx", "bg-fill-subtle", "the trace pill is a popover trigger"],
[
"ui/OutsideAgentsPage.tsx",
"aria-pressed={item.id === chosen}",
"a hosted agent's tile; its fill marks the one picked",
],
[
"ui/ModelPicker.tsx",
"aria-pressed={selected}",
Expand Down
15 changes: 5 additions & 10 deletions apps/desktop/src/ui/Capabilities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ function McpSection({
</Action>
</Tooltip>
)}
<Action quiet size="sm" onClick={() => setAdding(!adding)} aria-expanded={adding}>
<Action size="sm" onClick={() => setAdding(!adding)} aria-expanded={adding}>
<Plus size={12} /> Add server
</Action>
</div>
Expand Down Expand Up @@ -627,13 +627,7 @@ function McpRow({
</button>
<div className="flex shrink-0 items-center gap-1.5">
{needsSignIn && (
<Action
size="sm"
prominent
disabled={signingIn}
aria-busy={signingIn}
onClick={() => void signIn()}
>
<Action size="sm" disabled={signingIn} aria-busy={signingIn} onClick={() => void signIn()}>
{signingIn ? <Spinner size={12} /> : null} Sign in
</Action>
)}
Expand Down Expand Up @@ -852,7 +846,7 @@ function SkillsSection({
</Action>
</Tooltip>
{hasShell() && (
<Action quiet size="sm" onClick={() => setCreating(!creating)} aria-expanded={creating}>
<Action size="sm" onClick={() => setCreating(!creating)} aria-expanded={creating}>
<FilePlus2 size={12} /> New skill
</Action>
)}
Expand All @@ -868,7 +862,8 @@ function SkillsSection({
{groups.map(([source, skills]) => (
<Group
key={source}
title={<span className="font-medium text-body text-fg-muted">{sourceOf(source).label}</span>}
minor
title={sourceOf(source).label}
footer={sourceOf(source).note}
hint={sourceOf(source).hint}
>
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/ui/DiagnosticsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function ServerLog() {
const el = e.currentTarget;
follow.current = el.scrollHeight - el.scrollTop - el.clientHeight < 24;
}}
className="selectable m-0 h-[360px] overflow-auto p-3 font-mono text-caption leading-[15px] whitespace-pre-wrap break-all"
className="selectable m-0 h-[360px] overflow-auto px-4 py-3 font-mono text-caption leading-[15px] whitespace-pre-wrap break-all"
>
{shown.length ? (
shown.map((line, i) => (
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/ui/MachinesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export function MachinesPage() {
<Group
title="Machines"
action={
<Action prominent onClick={() => setAddMachineOpen(true)}>
<Plus size={13} />
<Action size="sm" onClick={() => setAddMachineOpen(true)}>
<Plus size={12} />
Add machine
</Action>
}
Expand Down
95 changes: 51 additions & 44 deletions apps/desktop/src/ui/OutsideAgentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { LOCAL_HOST } from "../state/threadKeys";
import { HarnessIcon } from "./HarnessIcon";
import { Copy, ExternalLink, Globe, KeyRound, Plug } from "./icons";
import { AgentTile, LevelPoints, SignInCard } from "./OutsideSignIn";
import { copyText, cx, Segments, Switch } from "./primitives";
import { copyText, cx, Switch } from "./primitives";
import { Action, Chip, fieldClass, Group, Loading, Row, Select } from "./settingsKit";

const SCOPE_OPTIONS = OUTSIDE_SCOPES.map((scope) => ({ value: scope, label: SCOPE_LABEL[scope] }));
Expand Down Expand Up @@ -140,11 +140,13 @@ export function OutsideAgentsPage() {
return () => clearInterval(timer);
}, [engine, host]);

// The same bar as the other machine pages (SettingsScope), so "which machine" sits in one place.
const picker =
machines.length > 1 ? (
<div className="mb-5 px-4">
<Segments
label="Machine"
<div className="mb-6 flex flex-wrap items-center gap-3 rounded-xl bg-surface px-4 py-3">
<div className="min-w-0 flex-1 font-medium text-body text-fg">Showing</div>
<Select
label="Showing machine"
value={host}
options={machines.map((m) => ({ value: m.host, label: m.local ? "This machine" : m.name }))}
onChange={(next) => {
Expand All @@ -166,11 +168,11 @@ export function OutsideAgentsPage() {
const where = remote ? (machineName ?? "that machine") : "this computer";
return (
<>
<p className="mb-4 max-w-[70ch] px-4 text-callout text-fg-muted">
{picker}
<p className="mb-6 max-w-[70ch] px-4 text-callout text-fg-muted">
Let other AI apps read, start or message RustCode threads on {where}. Each gets its own access level,
and you can change or revoke it here.
</p>
{picker}
{!status.available && (
<Group title="Not available here">
<Row
Expand Down Expand Up @@ -298,45 +300,50 @@ function HostedGroup({ host, status, where }: { host: string; status: OutsideSta
Copy
</Action>
</Row>
<div className="grid grid-cols-3 gap-2 px-4 py-3">
{HOSTED_APPS.map((item) => (
<button
key={item.id}
type="button"
aria-pressed={item.id === chosen}
onClick={() => setChosen(item.id)}
className={cx(
"flex flex-col items-center gap-2 rounded-xl border px-3 py-3 text-callout",
item.id === chosen ? "border-accent bg-fill" : "border-separator hover:bg-fill-subtle",
)}
>
<span className="flex size-10 items-center justify-center rounded-xl bg-fill text-fg-muted">
{item.mark ? <HarnessIcon id={item.mark} size={24} /> : <Plug size={18} />}
</span>
<span className="font-medium text-fg">{item.name}</span>
</button>
))}
</div>
{app && (
<div className="flex flex-col gap-3 px-4 pb-4">
<ol className="flex flex-col gap-1.5 text-callout text-fg-muted">
{app.steps.map((step, index) => (
<li key={step} className="flex gap-2">
<span className="flex size-5 shrink-0 items-center justify-center rounded-full bg-fill font-semibold text-caption text-fg">
{index + 1}
</span>
{step}
</li>
))}
</ol>
<div>
<Action prominent onClick={() => app.run(url)}>
{app.id === "claude" ? <ExternalLink size={14} /> : <Copy size={14} />}
{app.action}
</Action>
</div>
{/* One block: the pick, its steps and its action, with no rule between them. */}
<div className="flex flex-col gap-4 px-4 py-4">
<div className="grid grid-cols-3 gap-2">
{HOSTED_APPS.map((item) => (
<button
key={item.id}
type="button"
aria-pressed={item.id === chosen}
onClick={() => setChosen(item.id)}
className={cx(
"flex flex-col items-center gap-2 rounded-lg px-3 py-3 text-callout",
item.id === chosen
? "bg-fill-strong text-fg"
: "bg-fill-subtle text-fg-muted hover:bg-fill hover:text-fg",
)}
>
<span className="flex size-10 items-center justify-center rounded-md bg-fill text-fg-muted">
{item.mark ? <HarnessIcon id={item.mark} size={24} /> : <Plug size={18} />}
</span>
<span className="font-medium">{item.name}</span>
</button>
))}
</div>
)}
{app && (
<>
<ol className="flex flex-col gap-2 text-callout text-fg-muted">
{app.steps.map((step, index) => (
<li key={step} className="flex items-start gap-2">
<span className="flex size-5 shrink-0 items-center justify-center rounded-full bg-fill font-semibold text-caption text-fg">
{index + 1}
</span>
<span className="pt-px">{step}</span>
</li>
))}
</ol>
<div>
<Action prominent onClick={() => app.run(url)}>
{app.id === "claude" ? <ExternalLink size={14} /> : <Copy size={14} />}
{app.action}
</Action>
</div>
</>
)}
</div>
<CodeRow host={host} status={status} />
<PasskeyRows host={host} status={status} />
<WebAppRows host={host} status={status} url={url} />
Expand Down
4 changes: 2 additions & 2 deletions apps/desktop/src/ui/RemoteAccessPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { Copy, RefreshCw, Smartphone, WifiOff } from "./icons";
import { copyText, cx, Spinner, Switch } from "./primitives";
import { ConnectRequestsGroup, RevokeDeviceAction } from "./RemoteConnect";
import { ServerProblems } from "./ServerProblems";
import { Action, Chip, Group, Row } from "./settingsKit";
import { Action, Chip, Group, Row, withCode } from "./settingsKit";

/** The page keeps itself current while it is open: pairing counts down in the engine. */
const POLL_MS = 2500;
Expand Down Expand Up @@ -215,7 +215,7 @@ export function RemoteAccessPage() {
<Row
title="Gateway address"
subtitle="What a phone on this network dials."
hint="The terminal's `/remote status` shows the same address."
hint={withCode("The terminal's `/remote status` shows the same address.")}
status={
gateway?.advertisedAddress ? (
<span>
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/ui/RemoteConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function RevokeDeviceAction({ device }: { device: RemoteDevice }) {
},
});
return (
<Action quiet size="sm" disabled={busy} onClick={revoke} aria-label={`Revoke ${device.name}`}>
<Action size="sm" disabled={busy} onClick={revoke} aria-label={`Revoke ${device.name}`}>
{busy && <Spinner />}
Revoke
</Action>
Expand Down
28 changes: 28 additions & 0 deletions apps/desktop/src/ui/RestartToApply.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// The row a Settings card shows while a saved setting waits for a server restart. One component,
// so the wording, the icon and the "not while a thread runs" rule are the same on every page.
import { restartEngine, useApp } from "../state/store";
import { isRunning } from "../state/thread";
import { RefreshCw } from "./icons";
import { Action, Row } from "./settingsKit";

export function RestartToApply({ plural, onRestart }: { plural?: boolean; onRestart?: () => void }) {
const anyRunning = useApp((s) => Object.values(s.threads).some((t) => isRunning(t)));
return (
<Row
title="Restart the server to apply"
subtitle={`The server reads ${plural ? "these" : "this setting"} when it starts.`}
>
<Action
prominent
disabled={anyRunning}
onClick={() => {
onRestart?.();
void restartEngine();
}}
>
<RefreshCw size={13} />
Restart server
</Action>
</Row>
);
}
16 changes: 1 addition & 15 deletions apps/desktop/src/ui/ServerProblems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// this app, install the server from this app), else the command to run, and a
// Dismiss that hides it until its words change (state/settingsAttention.ts).

import type { ReactNode } from "react";
import { installServer, linkCliToApp, useMachines } from "../state/machines";
import {
dismissProblem,
Expand All @@ -15,20 +14,7 @@ import {
} from "../state/settingsAttention";
import { Copy, Server, SquareTerminal, TriangleAlert, X } from "./icons";
import { copyText, Spinner } from "./primitives";
import { Action } from "./settingsKit";

/** A message with its backticked commands and paths set in code type. */
function withCode(message: string): ReactNode[] {
return message.split(/(`[^`]+`)/g).map((part, i) =>
part.startsWith("`") && part.endsWith("`") && part.length > 1 ? (
<code key={i} className="rounded bg-fill px-1 font-mono text-caption">
{part.slice(1, -1)}
</code>
) : (
part
),
);
}
import { Action, withCode } from "./settingsKit";

function Fix({ problem }: { problem: ServerProblem }) {
const linking = useMachines((s) => s.serverLink.status === "running");
Expand Down
16 changes: 4 additions & 12 deletions apps/desktop/src/ui/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import {
openSettingAt,
openSettings,
request,
restartEngine,
SETTINGS_DEFAULTS,
type SettingsSection,
setChatWidth,
Expand Down Expand Up @@ -82,7 +81,7 @@ import {
TerminalSquare,
X,
} from "./icons";

import { RestartToApply } from "./RestartToApply";
import { AboutPage, AdvancedPage, STATUS_READ_MS } from "./SettingsAbout";
import { AppearancePage } from "./SettingsAppearance";
import { OrchestrationPage } from "./SettingsOrchestration";
Expand Down Expand Up @@ -112,7 +111,6 @@ const StatisticsPage = lazy(() => import("./StatisticsPage").then((m) => ({ defa

import { refreshServerService, useMachines } from "../state/machines";
import { useSettingsAttention } from "../state/settingsAttention";
import { isRunning } from "../state/thread";
import { type SettingEntry, searchSettings } from "./settingsIndex";
import {
Action,
Expand All @@ -126,6 +124,7 @@ import {
Slider,
useEngineData,
useRowResets,
withCode,
} from "./settingsKit";

const UsagePage = lazy(() => import("./UsagePage").then((m) => ({ default: m.UsagePage })));
Expand Down Expand Up @@ -491,7 +490,6 @@ function ChatPage() {
const smartUiPending = useApp((s) => s.smartUiPending);
const chatWidth = useApp((s) => s.chatWidth);
const showToolCalls = useApp((s) => s.showToolCalls);
const anyRunning = useApp((s) => Object.values(s.threads).some((t) => isRunning(t)));
const [linkPreviews, setLinkPreviewsState] = useState(linkPreviewsEnabled);
const [nextPrompt, setNextPromptState] = useState(nextPromptEnabled);
return (
Expand Down Expand Up @@ -532,13 +530,7 @@ function ChatPage() {
>
<Switch label="Show tool calls" checked={showToolCalls} onChange={setShowToolCalls} />
</Row>
{smartUiPending && (
<Row title="Restart the server to apply" subtitle="The server reads this setting when it starts.">
<Action prominent disabled={anyRunning} onClick={() => void restartEngine()}>
Restart Server
</Action>
</Row>
)}
{smartUiPending && <RestartToApply />}
<Row
title="Link previews"
reset={
Expand Down Expand Up @@ -815,7 +807,7 @@ function ConnectionsPage() {
<Row title="Not signed in" subtitle="Run: gh auth login" />
)}
</Group>
<Group title="Model accounts" footer="Sign in or out with `/login` in a thread.">
<Group title="Model accounts" footer={withCode("Sign in or out with `/login` in a thread.")}>
{data.accounts.length ? (
data.accounts.map((a, i) => (
<Row key={i} title={a.display || a.provider} subtitle={`${a.provider} · ${a.method}`}>
Expand Down
Loading
Loading