Skip to content
Python

Settings: Machines, scoped pages, connectors across machines

Rohit C Prasad260bcc72866e
diff --git a/surfaces/gui/src/components/AccessSection.tsx b/surfaces/gui/src/components/AccessSection.tsx
index 2ecf28f8..f16151c6 100644
--- a/surfaces/gui/src/components/AccessSection.tsx
+++ b/surfaces/gui/src/components/AccessSection.tsx
@@ -10,16 +10,19 @@
// to expand it and scroll it into view.
import { useCallback, useEffect, useRef, useState } from "react";
-import { useTranslation } from "react-i18next";
+import { Trans, useTranslation } from "react-i18next";
import {
CLOUD_CHANGED,
getCloudStatus,
getConnectors,
getRecentChannels,
+ getMachines,
getSessionConnections,
+ machineOfSession,
getSubscriptions,
setSessionConnection,
subscribeChannel,
+ type SubscriptionHolder,
unsubscribeChannel,
type CloudStatus,
type Connector,
@@ -42,12 +45,12 @@ import { Toggle } from "./Toggle";
// slack (the backend's own default when no platform prefix is given).
const platformOf = (channel: string) => (channel.includes(":") ? channel.split(":")[0] : "slack");
-const SEC_H = "text-[11px] uppercase tracking-[0.05em] text-faint font-semibold";
+const SEC_H = "text-label text-faint font-medium";
const TAG_CORE =
- "text-[11px] px-1.5 py-0.5 rounded-full bg-warnSoft/70 text-warnInk border border-warnInk/15";
-const BTN_ACCENT = "text-[12px] px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0";
+ "text-label px-1.5 py-0.5 rounded-full bg-warnSoft/70 text-warnInk border border-warnInk/15";
+const BTN_ACCENT = "text-meta px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0";
const BTN_BORDERED =
- "text-[12px] px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
+ "text-meta px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
export function AccessSection({
sessionId,
@@ -93,7 +96,10 @@ export function AccessSection({
// expand so a single failed fetch at mount can't hide them for the session's whole lifetime.
useEffect(() => {
let live = true;
- getConnectors()
+ // The session's ENGINE owns the catalog: a remote session's connectors live on
+ // its box, and the machines dashboard has none of its own (owner report
+ // 2026-09-03: "slack" found no match on a sandbox session).
+ getConnectors(machineOfSession(sessionId))
.then((list) => live && setByName(indexConnectors(list)))
.catch(() => {});
return () => {
@@ -144,11 +150,15 @@ export function AccessSection({
const [recent, setRecent] = useState<RecentChannel[]>([]);
const [draft, setDraft] = useState("");
const [addErr, setAddErr] = useState<string | null>(null);
- const loadSubs = () => getSubscriptions().then(setSubs).catch(() => setSubs([]));
+ const [held, setHeld] = useState<{ holder: SubscriptionHolder; movable: boolean } | null>(null);
+ // Subscriptions and the recent-channel picker live on the session's engine (same
+ // rule as the catalog above): the dashboard origin has no box behind it.
+ const loadSubs = () =>
+ getSubscriptions(machineOfSession(sessionId)).then(setSubs).catch(() => setSubs([]));
useEffect(() => {
if (!open) return;
loadSubs();
- getRecentChannels().then(setRecent).catch(() => setRecent([]));
+ getRecentChannels(machineOfSession(sessionId)).then(setRecent).catch(() => setRecent([]));
}, [open]);
// Collapsing the section also closes any child view — reopening starts at the top level.
@@ -169,15 +179,19 @@ export function AccessSection({
};
const channelsOf = (connector: string) =>
subs.filter((s) => s.session_id === sessionId && platformOf(s.channel) === connector);
- const addChannel = async () => {
+ const addChannel = async (move = false) => {
const raw = draft.trim();
if (!raw || !channelsFor) return;
const channel = raw.includes(":") || raw.startsWith("#") ? raw : `${channelsFor}:${raw}`;
- const r = await subscribeChannel(sessionId, channel);
+ const r = await subscribeChannel(sessionId, channel, { move });
if (!r.ok) {
- setAddErr(r.error || t("access.channel_add_error"));
+ // One session across all machines answers a source: the cloud names the
+ // holder and the user decides whether to move it here.
+ setHeld(r.error === "held" && r.held_by ? { holder: r.held_by, movable: r.move_allowed !== false } : null);
+ setAddErr(r.error === "held" ? null : r.error || t("access.channel_add_error"));
return;
}
+ setHeld(null);
setAddErr(null);
setDraft("");
loadSubs();
@@ -236,7 +250,7 @@ export function AccessSection({
<Icon name={open ? "chevronDown" : "chevronRight"} size={14} className="rail-chev" />
<span>{t("access.section_title")}</span>
<span
- className="ml-auto min-w-0 truncate text-[11px] font-normal text-faint"
+ className="ml-auto min-w-0 truncate text-label font-normal text-faint"
data-testid="access-summary"
title={summary}
>
@@ -250,6 +264,7 @@ export function AccessSection({
<ConnectInline
c={connectFor}
cloud={cloud}
+ machineId={machineOfSession(sessionId)}
onDone={() => {
const name = connectFor.name;
setConnectFor(null);
@@ -278,8 +293,12 @@ export function AccessSection({
onDraft={(v) => {
setDraft(v);
setAddErr(null);
+ setHeld(null);
}}
- onAdd={addChannel}
+ onAdd={() => addChannel(false)}
+ onMove={() => addChannel(true)}
+ machineId={machineOfSession(sessionId)}
+ held={held}
error={addErr}
onRemove={removeChannel}
onBack={() => setChannelsFor(null)}
@@ -290,7 +309,7 @@ export function AccessSection({
<div>
<div className={`${SEC_H} mb-1.5`}>{t("access.sources")}</div>
{connected.length === 0 && (
- <div className="text-[12px] text-faint py-0.5">
+ <div className="text-meta text-faint py-0.5">
{t("access.no_connectors")}
</div>
)}
@@ -299,13 +318,13 @@ export function AccessSection({
<div className="flex items-center gap-2 py-1" key={c.connector}>
<ConnectorBadge connector={visualFor(c.connector, "connector", byName)} size={24} />
<div className="min-w-0 flex-1">
- <div className="text-[13px] font-medium leading-tight truncate">
+ <div className="text-ui font-medium leading-tight truncate">
<span>{labelFor(c.connector, byName)}</span>
{c.detail && <span className="text-faint font-normal"> · {c.detail}</span>}
</div>
{byName[c.connector]?.channels && (
<button
- className="inline-flex items-center gap-0.5 text-[11px] text-accent hover:underline"
+ className="inline-flex items-center gap-0.5 text-label text-accent hover:underline"
onClick={() => {
setDraft("");
setChannelsFor(c.connector);
@@ -330,7 +349,7 @@ export function AccessSection({
{adding ? (
<div className="mt-1.5">
<input
- className="w-full px-2.5 py-1.5 rounded-lg border border-line bg-panel text-[13px] outline-none focus:border-accent"
+ className="w-full px-2.5 py-1.5 rounded-lg border border-line bg-panel text-ui outline-none focus:border-accent"
placeholder={t("access.search_placeholder")}
value={query}
onChange={(e) => setQuery(e.target.value)}
@@ -346,7 +365,7 @@ export function AccessSection({
{results.length === 0 && (
// Also covers a failed/empty catalog fetch: an open picker must never
// be silently blank — point at the Connectors page either way.
- <div className="text-[12px] text-faint mt-1.5 px-0.5">
+ <div className="text-meta text-faint mt-1.5 px-0.5">
{t("access.no_match")}
</div>
)}
@@ -365,10 +384,10 @@ export function AccessSection({
>
<ConnectorBadge connector={visualFor(c.name, "connector", byName)} size={22} />
<span className="min-w-0 flex-1">
- <span className="block text-[13px] font-medium leading-tight">
+ <span className="block text-ui font-medium leading-tight">
{c.title}
</span>
- <span className="block text-[11px] text-faint truncate">{c.blurb}</span>
+ <span className="block text-label text-faint truncate">{c.blurb}</span>
</span>
<Icon name="chevronRight" size={11} className="text-faint shrink-0" />
</button>
@@ -379,7 +398,7 @@ export function AccessSection({
/* UX-038 (owner ruling: option C): ONE footer row, both verbs — the
in-session add flow (with its lands-enabled-here guarantee) and the
global-page jump. The mute explainer lives on the toggles' tooltip. */
- <div className="mt-1.5 flex items-center gap-1.5 text-[12px]">
+ <div className="mt-1.5 flex items-center gap-1.5 text-meta">
<button
className="text-accent hover:underline text-left"
onClick={() => setAdding(true)}
@@ -407,11 +426,11 @@ export function AccessSection({
<div className="flex items-center gap-2 py-1" key={r.connector}>
<ConnectorBadge connector={visualFor(r.connector, "connector", byName)} size={24} />
<div className="min-w-0 flex-1">
- <div className="flex items-center gap-1.5 text-[13px] font-medium leading-tight">
+ <div className="flex items-center gap-1.5 text-ui font-medium leading-tight">
<span className="truncate">{labelFor(r.connector, byName)}</span>
{r.tier === "core" && <span className={TAG_CORE}>{t("access.core_tag")}</span>}
</div>
- <div className="text-[11px] text-faint truncate" title={r.reason}>
+ <div className="text-label text-faint truncate" title={r.reason}>
{r.reason}
</div>
</div>
@@ -462,7 +481,7 @@ export function AccessSection({
</div>
) : (
<button
- className="mt-1 text-[12px] text-accent hover:underline text-left"
+ className="mt-1 text-meta text-accent hover:underline text-left"
onClick={() => setAddingFolder(true)}
>
+ {t("access.give_folder")}
@@ -484,11 +503,13 @@ export function AccessSection({
function ConnectInline({
c,
cloud,
+ machineId,
onDone,
onBack,
}: {
c: Connector;
cloud: CloudStatus | null;
+ machineId?: string | null;
onDone: () => void;
onBack: () => void;
}) {
@@ -496,7 +517,7 @@ function ConnectInline({
useEffect(() => {
const t = setInterval(async () => {
try {
- const list = await getConnectors();
+ const list = await getConnectors(machineId);
if (list.find((x) => x.name === c.name)?.connected) onDone();
} catch {
/* poll again */
@@ -508,19 +529,19 @@ function ConnectInline({
return (
<div>
<button
- className="inline-flex items-center gap-1 text-[12px] text-faint hover:text-ink mb-2"
+ className="inline-flex items-center gap-1 text-meta text-faint hover:text-ink mb-2"
onClick={onBack}
aria-label={tt("access.back_to_sources")}
>
<Icon name="arrowLeft" size={13} /> {tt("access.connect_title", { title: c.title })}
</button>
- {c.blurb && <p className="text-[12px] text-muted mb-1 leading-relaxed">{c.blurb}</p>}
+ {c.blurb && <p className="text-meta text-muted mb-1 leading-relaxed">{c.blurb}</p>}
<div className="-mx-2">
<ConnectSetup c={c} cloud={cloud} onConnected={onDone} />
</div>
{/* Scope semantics, stated once (owner ask 2026-07-13): connecting is account-level,
the toggle above is what scopes it to a session. */}
- <p className="text-[11px] text-faint mt-2 leading-snug">
+ <p className="text-label text-faint mt-2 leading-snug">
{tt("access.scope_note", { title: c.title })}
</p>
</div>
@@ -536,6 +557,9 @@ function ChannelsInline({
draft,
onDraft,
onAdd,
+ onMove,
+ machineId,
+ held,
error,
onRemove,
onBack,
@@ -546,15 +570,39 @@ function ChannelsInline({
draft: string;
onDraft: (v: string) => void;
onAdd: () => void;
+ onMove: () => void;
+ machineId?: string | null;
+ held?: { holder: SubscriptionHolder; movable: boolean } | null;
error?: string | null;
onRemove: (channel: string) => void;
onBack: () => void;
}) {
const { t: tt } = useTranslation();
+ // Name the holding machine (UX-049 D): the machines list is cheap and cached
+ // by the browser; unknown ids fall back to "another machine".
+ const [machineNames, setMachineNames] = useState<Record<string, string>>({});
+ useEffect(() => {
+ if (!held || !held.holder.machine_id || held.holder.machine_id === "desktop") return;
+ getMachines()
+ .then((r) => {
+ const map: Record<string, string> = {};
+ for (const m of r.machines) {
+ map[m.id] = m.name;
+ map[m.id.replace(/^cloud:/, "")] = m.name;
+ }
+ setMachineNames(map);
+ })
+ .catch(() => {});
+ }, [held]);
+ const where = held
+ ? held.holder.machine_id === "desktop" || !held.holder.machine_id
+ ? tt("onmachine.this_mac")
+ : machineNames[held.holder.machine_id] || tt("onmachine.access.another_machine")
+ : "";
return (
<div>
<button
- className="inline-flex items-center gap-1 text-[12px] text-faint hover:text-ink mb-2"
+ className="inline-flex items-center gap-1 text-meta text-faint hover:text-ink mb-2"
onClick={onBack}
aria-label={tt("access.back_to_sources")}
>
@@ -562,7 +610,7 @@ function ChannelsInline({
</button>
<div className={`${SEC_H} mb-1.5`}>{tt("access.subscribed", { count: channels.length })}</div>
{channels.length === 0 ? (
- <div className="text-[12px] text-faint py-0.5">
+ <div className="text-meta text-faint py-0.5">
{tt("access.no_channels", { label })}
</div>
) : (
@@ -570,12 +618,12 @@ function ChannelsInline({
{channels.map((s) => (
<div className="flex items-center gap-1.5 py-1" key={s.channel}>
<Icon name="plug" size={13} className="text-muted shrink-0" />
- <span className="min-w-0 flex-1 text-[13px] truncate" title={s.channel}>
+ <span className="min-w-0 flex-1 text-ui truncate" title={s.channel}>
{s.channel_name ? `#${s.channel_name}` : s.channel}
</span>
{s.collision && (
<span
- className="text-[11px] text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1 shrink-0"
+ className="text-label text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1 shrink-0"
title={tt("access.collision_title")}
>
⚠
@@ -594,17 +642,40 @@ function ChannelsInline({
)}
<div className={`${SEC_H} mt-3 mb-1.5`}>{tt("access.add_channel")}</div>
<div className="flex items-center gap-1.5">
- <ChannelPicker value={draft} onChange={onDraft} recent={recent} onSubmit={onAdd} />
+ <ChannelPicker value={draft} onChange={onDraft} recent={recent} onSubmit={onAdd} machineId={machineId} />
<button className={BTN_ACCENT} disabled={!draft.trim()} onClick={onAdd}>
{tt("access.add_btn")}
</button>
</div>
{error && (
- <p className="text-[11px] text-warnInk mt-1.5 leading-snug" data-testid="channel-add-error">
+ <p className="text-label text-warnInk mt-1.5 leading-snug" data-testid="channel-add-error">
{error}
</p>
)}
- <p className="text-[11px] text-faint mt-1.5 leading-snug">
+ {held && (
+ <div
+ className="mt-1.5 rounded-md border border-line bg-paper px-2.5 py-2"
+ data-testid="channel-held"
+ >
+ <p className="text-label text-ink leading-snug">
+ <Trans
+ i18nKey={held.movable ? "onmachine.access.held_movable" : "onmachine.access.held_fixed"}
+ values={{ where }}
+ components={{
+ holder: <span className="font-medium">{held.holder.title || held.holder.session_id}</span>,
+ }}
+ />
+ </p>
+ {held.movable && (
+ <div className="mt-1.5 flex gap-1.5">
+ <button className={BTN_ACCENT} onClick={onMove} data-testid="channel-move">
+ {tt("onmachine.access.move_here")}
+ </button>
+ </div>
+ )}
+ </div>
+ )}
+ <p className="text-label text-faint mt-1.5 leading-snug">
{tt("access.channels_note")}
</p>
</div>
diff --git a/surfaces/gui/src/components/GalleryModal.tsx b/surfaces/gui/src/components/GalleryModal.tsx
index e42c87eb..4d7626ea 100644
--- a/surfaces/gui/src/components/GalleryModal.tsx
+++ b/surfaces/gui/src/components/GalleryModal.tsx
@@ -28,8 +28,8 @@ import { PersonaHero } from "./PersonaHero";
const CARD = "rounded-xl border border-line bg-panel/60";
const BTN_ACCENT =
- "text-[13px] px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
-const CHIP = "text-[11px] px-1.5 py-0.5 rounded border border-line text-muted";
+ "text-ui px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
+const CHIP = "text-label px-1.5 py-0.5 rounded border border-line text-muted";
type Source = "all" | "openworker" | "team";
@@ -153,7 +153,7 @@ export function GalleryModal({
<button
key={key}
className={
- "text-[12px] px-2.5 py-1 rounded-full border " +
+ "text-meta px-2.5 py-1 rounded-full border " +
(source === key
? "border-accent text-accent bg-accentSoft"
: "border-line text-muted hover:border-lineStrong")
@@ -166,14 +166,14 @@ export function GalleryModal({
</div>
{unavailable && cloud?.signed_in && (
- <div className="text-[13px] text-muted">
+ <div className="text-ui text-muted">
{t("gallery.unreachable")}
</div>
)}
{featured.length > 0 && (
<>
- <div className="text-[11px] uppercase tracking-[0.05em] text-faint font-semibold mb-2">
+ <div className="text-label text-faint font-medium mb-2">
{t("gallery.featured")}
</div>
<div className="flex gap-3 overflow-x-auto hairline-scroll pb-2 mb-5" data-testid="gallery-featured">
@@ -185,8 +185,8 @@ export function GalleryModal({
>
<PersonaHero slug={p.slug} height={88} />
<div className="p-3">
- <div className="text-[13px] font-semibold">{p.name}</div>
- <div className="text-[12px] text-muted leading-snug mt-0.5 mb-2">{p.tagline}</div>
+ <div className="text-ui font-semibold">{p.name}</div>
+ <div className="text-meta text-muted leading-snug mt-0.5 mb-2">{p.tagline}</div>
<div className="flex flex-wrap gap-1.5">
{p.recommended_connectors.slice(0, 3).map((c) => (
<ConnectorChip key={c} name={c} />
@@ -199,7 +199,7 @@ export function GalleryModal({
</>
)}
- <div className="text-[11px] uppercase tracking-[0.05em] text-faint font-semibold mb-2">
+ <div className="text-label text-faint font-medium mb-2">
{t("gallery.all_personas")}
</div>
<div className="space-y-2">
@@ -214,13 +214,13 @@ export function GalleryModal({
>
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2 mb-0.5">
- <span className="font-semibold text-[13px]">{p.name}</span>
+ <span className="font-semibold text-ui">{p.name}</span>
<span className={CHIP}>{p.family}</span>
- <span className="text-[11px] text-faint">
+ <span className="text-label text-faint">
{t("gallery.version_publisher", { version: p.version, publisher: p.publisher })}
</span>
</div>
- <div className="text-[13px] text-muted mb-1.5">{p.tagline}</div>
+ <div className="text-ui text-muted mb-1.5">{p.tagline}</div>
{p.recommended_connectors.length > 0 && (
<div className="flex flex-wrap gap-1.5">
{p.recommended_connectors.map((c) => (
@@ -231,16 +231,16 @@ export function GalleryModal({
</div>
<div className="shrink-0 flex items-center">
{isInstalled ? (
- <span className="text-[12px] text-muted">{t("gallery.installed")}</span>
+ <span className="text-meta text-muted">{t("gallery.installed")}</span>
) : (
- <span className="text-[13px] text-accent">{t("gallery.view_install")}</span>
+ <span className="text-ui text-accent">{t("gallery.view_install")}</span>
)}
</div>
</div>
);
})}
{visible.length === 0 && !unavailable && (
- <div className="text-[13px] text-muted py-4">
+ <div className="text-ui text-muted py-4">
{source === "team"
? t("gallery.empty_team")
: q
@@ -251,7 +251,7 @@ export function GalleryModal({
</div>
{source !== "team" && teamCount === 0 && (
- <div className="mt-5 pt-3 border-t border-line text-[12px] text-faint" data-testid="gallery-team-teaser">
+ <div className="mt-5 pt-3 border-t border-line text-meta text-faint" data-testid="gallery-team-teaser">
{t("gallery.team_teaser")}
</div>
)}
@@ -263,31 +263,31 @@ export function GalleryModal({
const detailView = detailSlug && (
<div data-testid="gallery-detail">
<button
- className="text-[13px] text-muted hover:text-ink mb-3"
+ className="text-ui text-muted hover:text-ink mb-3"
onClick={() => setDetailSlug(null)}
>
{t("gallery.back_to_gallery")}
</button>
{!detail ? (
- <div className="text-[13px] text-muted">{t("gallery.loading")}</div>
+ <div className="text-ui text-muted">{t("gallery.loading")}</div>
) : !detail.ok || !card ? (
- <div className="text-[13px] text-danger">{detail.error || t("gallery.could_not_load")}</div>
+ <div className="text-ui text-danger">{detail.error || t("gallery.could_not_load")}</div>
) : (
<div className="space-y-4">
<div className="flex items-start gap-4">
<div className="min-w-0 flex-1">
<div className="flex items-center gap-2 mb-1">
- <span className="font-semibold text-[16px]">{card.name}</span>
+ <span className="font-semibold text-body">{card.name}</span>
<span className={CHIP}>{card.family}</span>
</div>
- <div className="text-[13px] text-muted">{card.tagline}</div>
- <div className="text-[12px] text-faint mt-1">
+ <div className="text-ui text-muted">{card.tagline}</div>
+ <div className="text-meta text-faint mt-1">
{t("gallery.detail_meta", { version: card.version, publisher: card.publisher, risk: card.risk_summary })}
</div>
</div>
<div className="shrink-0">
{installed.has(detailSlug) ? (
- <span className="text-[13px] text-muted">{t("gallery.installed")}</span>
+ <span className="text-ui text-muted">{t("gallery.installed")}</span>
) : (
<button className={BTN_ACCENT} onClick={() => install(detailSlug)} disabled={busy}>
{busy ? t("gallery.installing") : t("gallery.install")}
@@ -295,11 +295,11 @@ export function GalleryModal({
)}
</div>
</div>
- {msg && <div className="text-[13px] text-danger">{msg}</div>}
+ {msg && <div className="text-ui text-danger">{msg}</div>}
{justInstalled && (
<div className="rounded-lg border border-okLine bg-okSoft px-3.5 py-2.5 flex items-center gap-3">
- <span className="flex-1 text-[13px] text-ok">
+ <span className="flex-1 text-ui text-ok">
{t("gallery.installed_waiting")}
</span>
<button className={BTN_ACCENT} onClick={onClose}>
@@ -311,20 +311,20 @@ export function GalleryModal({
<PersonaHero slug={detailSlug} height={128} className="rounded-xl" />
{card.pitch_markdown && (
- <div className={CARD + " p-4 text-[13px] leading-relaxed"}>
+ <div className={CARD + " p-4 text-ui leading-relaxed"}>
<Markdown text={card.pitch_markdown} />
</div>
)}
{caps && (
<div className={CARD + " p-4"} data-testid="gallery-capabilities">
- <div className="text-[13px] font-semibold mb-2">
+ <div className="text-ui font-semibold mb-2">
{t("gallery.capabilities_title")}
</div>
- <div className="text-[12px] text-faint mb-3">
+ <div className="text-meta text-faint mb-3">
{t("gallery.capabilities_desc")}
</div>
- <div className="space-y-2 text-[13px]">
+ <div className="space-y-2 text-ui">
<div>
<span className="text-muted">{t("gallery.tools_label")}</span>
{caps.tools.join(", ") || t("gallery.none")}
@@ -349,11 +349,11 @@ export function GalleryModal({
{r.ref}
{r.tier === "core" ? ` · ${t("gallery.core_tag")}` : ""}
</span>
- <span className="text-[12px] text-faint">{r.reason}</span>
+ <span className="text-meta text-faint">{r.reason}</span>
</div>
))}
</div>
- <div className="text-[12px] text-faint mt-2">
+ <div className="text-meta text-faint mt-2">
{t("gallery.connect_yourself_note")}
</div>
</div>
@@ -372,8 +372,8 @@ export function GalleryModal({
<div className="absolute left-1/2 top-[6vh] -translate-x-1/2 w-[720px] max-w-[94vw] max-h-[88vh] rounded-xl2 border border-line bg-panel shadow-2xl overflow-hidden flex flex-col">
<div className="px-5 pt-4 pb-3 border-b border-line flex items-center gap-3 shrink-0">
<div className="min-w-0 flex-1">
- <div className="text-[14px] font-semibold">{t("gallery.title")}</div>
- <div className="text-[12px] text-muted">
+ <div className="text-body font-semibold">{t("gallery.title")}</div>
+ <div className="text-meta text-muted">
{t("gallery.subtitle")}
</div>
</div>
@@ -382,7 +382,7 @@ export function GalleryModal({
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder={t("gallery.search_placeholder")}
- className="w-[180px] px-3 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-[180px] px-3 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
/>
)}
<button
@@ -398,7 +398,7 @@ export function GalleryModal({
<div className="overflow-y-auto hairline-scroll p-5">
{loading ? (
<div className="space-y-2" data-testid="gallery-loading" aria-busy="true">
- <div className="text-[13px] text-muted mb-3">{t("gallery.loading_gallery")}</div>
+ <div className="text-ui text-muted mb-3">{t("gallery.loading_gallery")}</div>
{[0, 1, 2].map((i) => (
<div key={i} className={CARD + " p-3.5 animate-pulse"}>
<div className="h-3.5 w-44 rounded bg-line mb-2.5" />
@@ -409,8 +409,8 @@ export function GalleryModal({
) : cloud && !cloud.signed_in ? (
<div className={CARD + " p-5 flex items-center gap-4"} data-testid="gallery-signin">
<div className="min-w-0 flex-1">
- <div className="font-semibold text-[14px] mb-1">{t("gallery.signin_title")}</div>
- <div className="text-[13px] text-muted leading-relaxed">
+ <div className="font-semibold text-body mb-1">{t("gallery.signin_title")}</div>
+ <div className="text-ui text-muted leading-relaxed">
{t("gallery.signin_desc")}
</div>
</div>
diff --git a/surfaces/gui/src/components/InboxConfigure.tsx b/surfaces/gui/src/components/InboxConfigure.tsx
index 7ef0bdf6..b3de418f 100644
--- a/surfaces/gui/src/components/InboxConfigure.tsx
+++ b/surfaces/gui/src/components/InboxConfigure.tsx
@@ -27,8 +27,8 @@ import { Icon } from "./Icon";
// also deleted a duplication: the mirror channel used to be editable BOTH on this page and
// via an inline configurator on the Inbox list.
const CARD = "rounded-xl2 border border-line bg-panel";
-const SELECT = "px-2.5 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink";
-const BTN_ACCENT_SM = "text-[12px] px-2.5 py-1 rounded-md bg-accent text-white disabled:opacity-50";
+const SELECT = "px-2.5 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink";
+const BTN_ACCENT_SM = "text-meta px-2.5 py-1 rounded-md bg-accent text-white disabled:opacity-50";
export function InboxConfigure() {
const { t } = useTranslation();
@@ -42,8 +42,8 @@ export function InboxConfigure() {
{/* Unrouted = delivery FAILURES ("messages that never reached you"), so it lives with
the Inbox now (§28; previously with routing under Connectors, §26). */}
<div className="mt-6" data-testid="unrouted-section">
- <h3 className="text-[14px] font-semibold mb-1">{t("inbox.unrouted_title")}</h3>
- <p className="text-[13px] text-muted mb-3">
+ <h3 className="text-body font-semibold mb-1">{t("inbox.unrouted_title")}</h3>
+ <p className="text-ui text-muted mb-3">
{t("inbox.unrouted_sub")}
</p>
<UnroutedTable />
@@ -125,8 +125,8 @@ function InboxRoutingCard() {
return (
<div className={CARD + " p-4"} data-testid="inbox-mirror-card">
- <div className="font-semibold text-[13px] mb-1">{tt("inbox.unattended_approvals")}</div>
- <p className="text-[12px] text-muted mb-3">
+ <div className="font-semibold text-ui mb-1">{tt("inbox.unattended_approvals")}</div>
+ <p className="text-meta text-muted mb-3">
{tt("inbox.mirror_desc_prefix")}{" "}
<strong className="text-ink font-medium" title={target || undefined}>
{known ? `#${known}` : target || tt("inbox.in_app_inbox_only")}
@@ -146,17 +146,17 @@ function InboxRoutingCard() {
{tt("inbox.set")}
</button>
{target && (
- <button className="text-[12px] text-danger/80 hover:text-danger" onClick={clear}>
+ <button className="text-meta text-danger/80 hover:text-danger" onClick={clear}>
{tt("inbox.clear")}
</button>
)}
</div>
{missingSlackOwner && (
- <p className="text-[12px] text-warnInk mt-2">
+ <p className="text-meta text-warnInk mt-2">
{tt("inbox.missing_slack_owner")}
</p>
)}
- {error && <p className="text-[12px] text-warnInk mt-2">{error}</p>}
+ {error && <p className="text-meta text-warnInk mt-2">{error}</p>}
</div>
);
}
@@ -186,8 +186,8 @@ function DmRouteCard() {
return (
<div className={CARD + " p-4"}>
- <div className="font-semibold text-[13px] mb-1">{tt("inbox.direct_messages")}</div>
- <p className="text-[12px] text-muted mb-3">
+ <div className="font-semibold text-ui mb-1">{tt("inbox.direct_messages")}</div>
+ <p className="text-meta text-muted mb-3">
{tt("inbox.dm_desc")}
</p>
<div className="flex items-center gap-2">
@@ -229,9 +229,21 @@ function SubscriptionsCard() {
}, []);
const real = sessions.filter((s) => !s.session_id.startsWith("__"));
+ const [addErr, setAddErr] = useState<string | null>(null);
const add = async () => {
if (!addSession || !addChannel.trim()) return;
- await subscribeChannel(addSession, addChannel.trim());
+ const r = await subscribeChannel(addSession, addChannel.trim());
+ if (!r.ok) {
+ // Held by another session (any machine): this global list only reports it —
+ // the move lives in the session's own Access panel.
+ setAddErr(
+ r.error === "held" && r.held_by
+ ? tt("misc.inbox_configure.held_by", { session: r.held_by.title || r.held_by.session_id })
+ : r.error || tt("misc.inbox_configure.add_failed"),
+ );
+ return;
+ }
+ setAddErr(null);
setAddChannel("");
load();
};
@@ -246,13 +258,13 @@ function SubscriptionsCard() {
<span className="text-muted shrink-0">
<Icon name="plug" size={15} />
</span>
- <span className="font-semibold text-[13px]">{tt("inbox.channel_subscriptions")}</span>
- <span className="text-[12px] text-muted">{tt("inbox.subscriptions_sub")}</span>
+ <span className="font-semibold text-ui">{tt("inbox.channel_subscriptions")}</span>
+ <span className="text-meta text-muted">{tt("inbox.subscriptions_sub")}</span>
</div>
{subs && subs.length > 0 ? (
- <table className="w-full text-[13px]">
- <thead className="text-[11px] uppercase tracking-[0.04em] text-faint">
+ <table className="w-full text-ui">
+ <thead className="text-label text-faint">
<tr className="text-left">
<th className="font-medium px-4 py-2">{tt("inbox.col_session")}</th>
<th className="font-medium px-4 py-2">{tt("inbox.col_listens_to")}</th>
@@ -273,12 +285,12 @@ function SubscriptionsCard() {
</span>
{s.channel_name ? `#${s.channel_name}` : s.channel}
{s.channel_name && (
- <span className="text-[11px] text-faint">{s.channel}</span>
+ <span className="text-label text-faint">{s.channel}</span>
)}
</span>
{s.collision && (
<span
- className="ml-1.5 text-[11px] text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1.5 py-0.5"
+ className="ml-1.5 text-label text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1.5 py-0.5"
title={tt("inbox.collision_title")}
>
{tt("inbox.collides")}
@@ -300,7 +312,7 @@ function SubscriptionsCard() {
</tbody>
</table>
) : (
- <div className="px-4 py-3 text-[13px] text-muted">
+ <div className="px-4 py-3 text-ui text-muted">
{tt("inbox.no_subscriptions")}
</div>
)}
@@ -323,6 +335,11 @@ function SubscriptionsCard() {
{tt("inbox.subscribe")}
</button>
</div>
+ {addErr && (
+ <p className="text-label text-warnInk mt-1.5 leading-snug" data-testid="inbox-subscribe-error">
+ {addErr}
+ </p>
+ )}
</div>
);
}
@@ -342,15 +359,15 @@ function UnroutedTable() {
if (items && items.length === 0)
return (
- <div className={CARD + " p-4 text-[13px] text-muted"}>
+ <div className={CARD + " p-4 text-ui text-muted"}>
{tt("inbox.unrouted_empty")}
</div>
);
return (
<div className={CARD + " overflow-hidden"}>
- <table className="w-full text-[13px]">
- <thead className="text-[11px] uppercase tracking-[0.04em] text-faint">
+ <table className="w-full text-ui">
+ <thead className="text-label text-faint">
<tr className="text-left">
<th className="font-medium px-4 py-2">{tt("inbox.col_when")}</th>
<th className="font-medium px-4 py-2">{tt("inbox.col_source")}</th>
diff --git a/surfaces/gui/src/components/IntegrationsView.tsx b/surfaces/gui/src/components/IntegrationsView.tsx
index 6d4dacae..9405147d 100644
--- a/surfaces/gui/src/components/IntegrationsView.tsx
+++ b/surfaces/gui/src/components/IntegrationsView.tsx
@@ -1,66 +1,13 @@
-import { useEffect, useState } from "react";
-import { useTranslation } from "react-i18next";
-import { getConnectors } from "../api";
-import { ConnectorsSection } from "./connectors/ConnectorsSection";
-import { Icon } from "./Icon";
-
-// The Connectors surface (renamed from "Integrations", §26). The separate "MCP
-// servers" tab is retired (UX-034): custom MCP servers now live on the Connectors
-// page itself — a "Custom · MCP" group plus the top "Add custom server" modal —
-// so the sub-nav is a single fixed item. The old "Messaging routing" tab (and its
-// ⚠ unrouted badge) moved whole to Inbox ▸ Configure (§28); the one remaining
-// Activity is the audit log, reached from the account menu.
-
-export function IntegrationsView() {
- const { t: tt } = useTranslation();
- // Sub-nav count: how many connectors exist. Polled so the badge stays live.
- const [connCount, setConnCount] = useState<number | null>(null);
-
- useEffect(() => {
- const load = () => {
- getConnectors().then((cs) => setConnCount(cs.length)).catch(() => {});
- };
- load();
- const t = setInterval(load, 5000);
- return () => clearInterval(t);
- }, []);
-
- return (
- <main className="flex-1 min-w-0 flex bg-paper">
- <nav className="page-subnav w-[208px] shrink-0 border-r border-line bg-panel/40 px-3 py-4">
- <div className="px-2 text-[13px] font-semibold mb-3 flex items-center gap-2">
- <Icon name="plug" size={16} /> {tt("integrations.nav_title")}
- </div>
- <button className="w-full text-left px-2.5 py-2 rounded-lg text-[13px] flex items-center justify-between bg-paper text-accent font-medium">
- <span className="flex items-center gap-2 min-w-0">
- <Icon name="plug" size={15} /> {tt("integrations.tab_connectors")}
- </span>
- {connCount != null && (
- <span className="text-[11px] shrink-0 text-accent">{connCount}</span>
- )}
- </button>
- </nav>
-
- <div className="flex-1 min-w-0 overflow-y-auto hairline-scroll">
- <div className="max-w-4xl mx-auto px-7 py-6">
- <section>
- <PanelHead
- title={tt("integrations.connectors_title")}
- sub={tt("integrations.connectors_sub")}
- />
- <ConnectorsSection />
- </section>
- </div>
- </div>
- </main>
- );
-}
+// The standalone Connectors surface is RETIRED (owner 2026-08-31): Connectors
+// lives in Settings under the MACHINE group — machine-scoped like every other
+// engine page (see SettingsView + RemoteConnectorsPanel). This file keeps
+// PanelHead, the page-shell heading shared across surfaces.
export function PanelHead({ title, sub }: { title: string; sub: string }) {
return (
<div className="mb-4">
- <h2 className="text-[20px] font-semibold tracking-tight">{title}</h2>
- <p className="text-[13px] text-muted mt-0.5">{sub}</p>
+ <h2 className="text-title font-semibold tracking-tight">{title}</h2>
+ <p className="text-ui text-muted mt-0.5">{sub}</p>
</div>
);
}
diff --git a/surfaces/gui/src/components/MachineKeysCard.test.tsx b/surfaces/gui/src/components/MachineKeysCard.test.tsx
new file mode 100644
index 00000000..72cd19d3
--- /dev/null
+++ b/surfaces/gui/src/components/MachineKeysCard.test.tsx
@@ -0,0 +1,76 @@
+// OPE-149: browser-sealed key deploy. The card seals IN THE TEST (real
+// crypto) and the assertion that matters most: the plaintext key never
+// appears in any request body — the backend only ever sees ciphertext.
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { MachinesSection } from "./MachinesSection";
+import { setWalletAvailable } from "../api";
+import { x25519 } from "@noble/curves/ed25519.js";
+
+afterEach(() => {
+ cleanup();
+ setWalletAvailable(true);
+});
+
+const sealPriv = x25519.utils.randomSecretKey();
+const sealPubB64 = btoa(String.fromCharCode(...x25519.getPublicKey(sealPriv)));
+
+const machine = {
+ id: "m1",
+ name: "cloud-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: Date.now() / 1000,
+ connected: true,
+ seal_pubkey: sealPubB64,
+ seal_fingerprint: "feedfacecafe0123",
+};
+
+let deployBodies: any[] = [];
+
+beforeEach(() => {
+ setWalletAvailable(false);
+ deployBodies = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ if (url.endsWith("/v1/machines/m1/secrets")) {
+ if (init?.method === "POST") {
+ deployBodies.push(JSON.parse(String(init.body)));
+ return { ok: true, json: async () => ({ ok: true, deployed: ["provider:anthropic"] }) } as Response;
+ }
+ return { ok: true, json: async () => ({ secrets: [] }) } as Response;
+ }
+ if (url.endsWith("/v1/machines")) {
+ return { ok: true, json: async () => ({ machines: [machine], armed: false }) } as Response;
+ }
+ return { ok: true, json: async () => ({}) } as Response;
+ }),
+ );
+});
+
+describe("MachineKeysCard", () => {
+ it("seals in the tab: the request carries ciphertext, never the key", async () => {
+ render(<MachinesSection />);
+ await waitFor(() => expect(screen.getByText("cloud-box")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("keys-cloud-box"));
+ expect(screen.getByTestId("seal-fingerprint").textContent).toContain("feedfacecafe0123");
+
+ fireEvent.change(screen.getByTestId("keys-value"), {
+ target: { value: "sk-super-secret-123" },
+ });
+ fireEvent.click(screen.getByTestId("keys-deploy"));
+ await waitFor(() => expect(screen.getByTestId("keys-note").textContent).toContain("Deployed"));
+
+ expect(deployBodies).toHaveLength(1);
+ const body = deployBodies[0];
+ expect(body.profiles).toEqual(["provider:anthropic"]);
+ expect(typeof body.sealed_b64).toBe("string");
+ expect(body.sealed_b64.length).toBeGreaterThan(60);
+ expect(body.hashes["provider:anthropic"]).toMatch(/^[0-9a-f]{64}$/);
+ // The doctrine assertion: plaintext never leaves the tab.
+ expect(JSON.stringify(body)).not.toContain("sk-super-secret-123");
+ });
+});
diff --git a/surfaces/gui/src/components/MachineModelsPanel.tsx b/surfaces/gui/src/components/MachineModelsPanel.tsx
new file mode 100644
index 00000000..da0bc4cd
--- /dev/null
+++ b/surfaces/gui/src/components/MachineModelsPanel.tsx
@@ -0,0 +1,321 @@
+import { useCallback, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import {
+ type AuditExportStatus,
+ deployMachineSecrets,
+ deploySealedSecrets,
+ getMachineSecrets,
+ getMachineSettings,
+ getWalletProfiles,
+ hasWallet,
+ revokeMachineSecrets,
+ type Machine,
+ type MachineSecretRow,
+} from "../api";
+import { profileHash, sealProfiles } from "../seal";
+import { Icon } from "./Icon";
+import { PanelHead } from "./IntegrationsView";
+
+// Settings ▸ Models & Keys, scoped to a REMOTE machine (UX-046). Three parts:
+// what the machine itself reports as active (the same list the composer's
+// picker offers — the ratified truth source), the deploy ledger from this
+// controller, and the two ways to send a key — from this Mac's wallet
+// (desktop only), or pasted and sealed in this window (all deployments).
+
+const CARD = "rounded-xl2 border border-line bg-panel";
+const ROW = "flex items-center gap-3 px-4 py-3 border-b border-line last:border-b-0 text-ui";
+const ACT = "text-meta text-accent ml-auto shrink-0";
+
+const KEY_PROVIDERS = [
+ { id: "anthropic", label: "Anthropic" },
+ { id: "openai", label: "OpenAI" },
+ { id: "google", label: "Google" },
+ { id: "openrouter", label: "OpenRouter" },
+];
+
+function groupModels(models: string[]): { provider: string; names: string[] }[] {
+ const by = new Map<string, string[]>();
+ for (const m of models) {
+ const [provider, ...rest] = m.split(":");
+ const name = rest.join(":") || provider;
+ by.set(provider, [...(by.get(provider) ?? []), name]);
+ }
+ return [...by.entries()].map(([provider, names]) => ({ provider, names }));
+}
+
+export function MachineModelsPanel({ machine }: { machine: Machine }) {
+ const { t } = useTranslation();
+ // Governance must be visible to the governed: an org export policy shows here.
+ const [auditExport, setAuditExport] = useState<AuditExportStatus | null>(null);
+ const [models, setModels] = useState<string[] | null>(null);
+ const [rows, setRows] = useState<MachineSecretRow[]>([]);
+ const [walletProfiles, setWalletProfiles] = useState<string[]>([]);
+ const [walletPick, setWalletPick] = useState("");
+ const [provider, setProvider] = useState(KEY_PROVIDERS[0].id);
+ const [custom, setCustom] = useState("");
+ const [value, setValue] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [note, setNote] = useState<{ tone: "ok" | "err"; text: string } | null>(null);
+
+ const refresh = useCallback(() => {
+ getMachineSettings(machine.id)
+ .then((s) => {
+ // The box keeps its default model selectable even before that
+ // provider has a key (onboarding relies on it); `model_ready` says
+ // whether it can actually run. A fresh sandbox has no keys at all —
+ // showing its default as "active" would be a lie (owner catch,
+ // 2026-09-02), so drop it until a key lands.
+ const reported = s.models ?? [];
+ setModels(s.model_ready === false ? reported.filter((m) => m !== s.model) : reported);
+ setAuditExport(s.audit_export ?? null);
+ })
+ .catch(() => setModels(null));
+ getMachineSecrets(machine.id).then(setRows).catch(() => setRows([]));
+ }, [machine.id]);
+
+ useEffect(() => {
+ setModels(null);
+ setNote(null);
+ refresh();
+ if (hasWallet()) {
+ getWalletProfiles()
+ .then((p) => setWalletProfiles(p.map((x) => x.profile).filter((n) => n.startsWith("provider:"))))
+ .catch(() => setWalletProfiles([]));
+ }
+ }, [refresh]);
+
+ const done = (r: { error?: string }, ok: string) => {
+ setNote(r.error ? { tone: "err", text: r.error } : { tone: "ok", text: ok });
+ refresh();
+ };
+
+ const sendFromWallet = async () => {
+ if (!walletPick) return;
+ setBusy(true);
+ try {
+ done(await deployMachineSecrets(machine.id, [walletPick]), t("machines.models.sent_note", { profile: walletPick, name: machine.name }));
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const profileName = provider === "custom" ? custom.trim() : `provider:${provider}`;
+
+ const deployPasted = async () => {
+ const secret = value.trim();
+ if (!secret || !profileName || !machine.seal_pubkey) return;
+ setBusy(true);
+ setNote(null);
+ try {
+ const data = { api_key: secret, key_set_at: new Date().toISOString().slice(0, 10) };
+ const sealed = sealProfiles(machine.seal_pubkey, { [profileName]: data });
+ const hash = await profileHash(data);
+ const r = await deploySealedSecrets(machine.id, sealed, [profileName], { [profileName]: hash });
+ if (!r.error) setValue("");
+ done(r, t("machines.models.deployed_note", { profile: profileName, name: machine.name }));
+ } catch (e) {
+ setNote({ tone: "err", text: String((e as Error).message || e) });
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const revoke = async (profile: string) => {
+ done(await revokeMachineSecrets(machine.id, [profile]), t("machines.models.revoked_note", { profile, name: machine.name }));
+ };
+
+ return (
+ <section data-testid="machine-models-panel">
+ <PanelHead
+ title={t("machines.models.title")}
+ sub={
+ machine.seal_fingerprint
+ ? t("machines.models.sub_sealed", {
+ name: machine.name,
+ fingerprint: machine.seal_fingerprint,
+ })
+ : t("machines.models.sub", { name: machine.name })
+ }
+ />
+
+ <div className="text-label text-faint font-medium mb-2">
+ {t("machines.models.active_heading")}
+ </div>
+ <div className={CARD}>
+ {models === null ? (
+ <div className={ROW + " text-muted"}>
+ {machine.connected ? t("machines.models.loading") : t("machines.models.offline")}
+ </div>
+ ) : models.length === 0 ? (
+ <div className={ROW + " text-muted"}>{t("machines.models.none")}</div>
+ ) : (
+ groupModels(models).map((g) => (
+ <div key={g.provider} className={ROW} data-testid={`active-${g.provider}`}>
+ <span className="inline-block w-[7px] h-[7px] rounded-full bg-ok" />
+ <span className="font-medium text-ink">{g.provider}</span>
+ <span className="text-muted text-meta truncate">{g.names.join(" · ")}</span>
+ </div>
+ ))
+ )}
+ </div>
+ <div className="text-label text-faint mt-1.5 mb-5">
+ {t("machines.models.reported_note")}
+ </div>
+
+ {auditExport?.enabled && (
+ <div className={CARD + " mb-5"} data-testid="audit-export-notice">
+ <div className={ROW}>
+ <span className="inline-block w-[7px] h-[7px] rounded-full bg-ok" />
+ <span className="font-medium text-ink">{t("machines.models.audit_exported")}</span>
+ <span className="text-muted text-meta truncate">
+ {auditExport.sink === "http"
+ ? t("machines.models.audit_to_url", { url: auditExport.url })
+ : t("machines.models.audit_via_cloud")}
+ {" · " + t("machines.models.audit_sent", { n: auditExport.exported })}
+ {auditExport.pending
+ ? " · " + t("machines.models.audit_pending", { n: auditExport.pending })
+ : ""}
+ {auditExport.last_error ? ` · ${auditExport.last_error}` : ""}
+ </span>
+ </div>
+ </div>
+ )}
+
+ {rows.length > 0 && (
+ <>
+ <div className="text-label text-faint font-medium mb-2">
+ {t("machines.models.ledger_heading")}
+ </div>
+ <div className={CARD + " mb-5"}>
+ {rows.map((r) => (
+ <div key={r.profile} className={ROW} data-testid={`ledger-${r.profile}`}>
+ <span className="font-mono text-meta text-ink">{r.profile}</span>
+ <span className="text-faint text-label">
+ {t("machines.keys.deployed_on", {
+ date: new Date(r.deployed_at * 1000).toLocaleDateString(),
+ })}
+ </span>
+ {r.stale && (
+ <span className="text-label text-amber-600">{t("machines.models.stale")}</span>
+ )}
+ <button className={ACT} onClick={() => void revoke(r.profile)}>
+ {t("settings.trust_revoke")}
+ </button>
+ </div>
+ ))}
+ </div>
+ </>
+ )}
+
+ <div className="text-label text-faint font-medium mb-2">
+ {t("machines.models.send_heading")}
+ </div>
+ {!machine.seal_pubkey ? (
+ <div className="text-meta text-muted">
+ {t("machines.models.no_seal_key")}
+ </div>
+ ) : (
+ <>
+ {hasWallet() && walletProfiles.length > 0 && (
+ <div className="flex items-center gap-2.5 mb-2.5">
+ <select
+ className="px-2.5 py-2 rounded-lg border border-line bg-paper text-meta text-ink outline-none"
+ value={walletPick}
+ onChange={(e) => setWalletPick(e.target.value)}
+ data-testid="wallet-pick"
+ >
+ <option value="">{t("machines.models.from_wallet")}</option>
+ {walletProfiles.map((p) => (
+ <option key={p} value={p}>
+ {p}
+ </option>
+ ))}
+ </select>
+ <button
+ className="px-3.5 py-2 rounded-lg bg-accent text-white text-ui font-medium disabled:opacity-50"
+ disabled={busy || !walletPick}
+ onClick={() => void sendFromWallet()}
+ data-testid="wallet-send"
+ >
+ {t("common.send")}
+ </button>
+ </div>
+ )}
+ <div className="flex items-center gap-2.5">
+ <select
+ className="px-2.5 py-2 rounded-lg border border-line bg-paper text-meta text-ink outline-none"
+ value={provider}
+ onChange={(e) => setProvider(e.target.value)}
+ >
+ {KEY_PROVIDERS.map((p) => (
+ <option key={p.id} value={p.id}>
+ {p.label}
+ </option>
+ ))}
+ <option value="custom">{t("machines.keys.custom_profile")}</option>
+ </select>
+ {provider === "custom" && (
+ <input
+ className="px-2.5 py-2 rounded-lg border border-line bg-paper font-mono text-meta text-ink outline-none w-40"
+ placeholder={t("machines.keys.profile_placeholder")}
+ value={custom}
+ onChange={(e) => setCustom(e.target.value)}
+ />
+ )}
+ <input
+ type="password"
+ className="flex-1 min-w-0 px-2.5 py-2 rounded-lg border border-line bg-paper font-mono text-meta text-ink outline-none focus:border-accent"
+ placeholder={t("machines.models.paste_placeholder")}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void deployPasted();
+ }}
+ data-testid="paste-key"
+ />
+ <button
+ className="px-3.5 py-2 rounded-lg bg-accent text-white text-ui font-medium disabled:opacity-50"
+ disabled={busy || !value.trim() || !profileName}
+ onClick={() => void deployPasted()}
+ data-testid="paste-deploy"
+ >
+ {busy ? t("machines.keys.sealing") : t("machines.keys.deploy")}
+ </button>
+ </div>
+ </>
+ )}
+ {note && (
+ <div
+ className={"mt-2.5 text-meta " + (note.tone === "ok" ? "text-ok" : "text-red-500")}
+ data-testid="keys-panel-note"
+ >
+ {note.text}
+ </div>
+ )}
+ </section>
+ );
+}
+
+/** Placeholder for machine-scoped pages that only speak to the local engine so
+ * far. Honest emptiness beats silently showing This-Mac data under a remote
+ * machine's name. */
+export function MachineScopePending({ machine, page }: { machine: Machine; page: string }) {
+ const { t } = useTranslation();
+ return (
+ <section className="text-ui text-muted" data-testid="machine-scope-pending">
+ <PanelHead title={page} sub={t("machines.models.sub", { name: machine.name })} />
+ <div className="rounded-xl2 border border-line bg-panel px-4 py-6 flex items-center gap-3">
+ <Icon name="clock" size={16} />
+ <span>
+ {hasWallet()
+ ? t("machines.models.scope_pending_local", {
+ page,
+ name: machine.name,
+ page_lower: page.toLowerCase(),
+ })
+ : t("machines.models.scope_pending", { page, name: machine.name })}
+ </span>
+ </div>
+ </section>
+ );
+}
diff --git a/surfaces/gui/src/components/MachinesSection.test.tsx b/surfaces/gui/src/components/MachinesSection.test.tsx
new file mode 100644
index 00000000..08b02f5b
--- /dev/null
+++ b/surfaces/gui/src/components/MachinesSection.test.tsx
@@ -0,0 +1,242 @@
+// UX-045 frame C/D: machine rows, arming enrollment, join detection.
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { MachinesSection } from "./MachinesSection";
+
+afterEach(cleanup);
+
+const baseMachines = () => [
+ {
+ id: "m1",
+ name: "hetzner-box",
+ fingerprint: "8aaaac6fdc97e081",
+ app_version: "0.2.0",
+ created_at: 1_755_000_000,
+ last_seen: Date.now() / 1000 - 30,
+ connected: true,
+ },
+ {
+ id: "m2",
+ name: "old-macpro",
+ fingerprint: "1234567890abcdef",
+ app_version: "0.1.9",
+ created_at: 1_754_000_000,
+ last_seen: Date.now() / 1000 - 200_000,
+ connected: false,
+ },
+ ];
+
+const machinesPayload: { machines: any[]; armed: boolean } = {
+ machines: baseMachines(),
+ armed: false,
+};
+
+let armCalls = 0;
+let disarmCalls = 0;
+
+beforeEach(() => {
+ armCalls = 0;
+ disarmCalls = 0;
+ machinesPayload.machines = baseMachines();
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ if (url.endsWith("/v1/remote/arm")) {
+ if (init?.method === "DELETE") {
+ disarmCalls += 1;
+ return { json: async () => ({ armed: false }) } as Response;
+ }
+ armCalls += 1;
+ return {
+ json: async () => ({
+ join_url: "http://127.0.0.1:9787/j/tok123",
+ expires_at: Date.now() / 1000 + 600,
+ }),
+ } as Response;
+ }
+ return { json: async () => machinesPayload } as Response;
+ }),
+ );
+});
+
+describe("MachinesSection", () => {
+ it("renders This Mac plus machine rows with presence", async () => {
+ render(<MachinesSection />);
+ expect(screen.getByText("This Mac")).toBeTruthy();
+ await waitFor(() => expect(screen.getByText("hetzner-box")).toBeTruthy());
+ expect(screen.getByText(/online/)).toBeTruthy();
+ expect(screen.getByText(/last seen/)).toBeTruthy();
+ expect(screen.getByText(/v0\.2\.0/)).toBeTruthy();
+ });
+
+ it("opening Add a machine arms enrollment and shows the one-liner; closing disarms", async () => {
+ render(<MachinesSection />);
+ await waitFor(() => expect(screen.getByText("hetzner-box")).toBeTruthy());
+ fireEvent.click(screen.getByText("Add a machine…"));
+ await waitFor(() =>
+ expect(screen.getByTestId("join-command").textContent).toContain(
+ "openworker join http://127.0.0.1:9787/j/tok123",
+ ),
+ );
+ expect(armCalls).toBe(1);
+ expect(screen.getByText(/Waiting for the machine/)).toBeTruthy();
+ expect(screen.getByText("SSH reverse tunnel")).toBeTruthy();
+ fireEvent.click(screen.getByLabelText("Close"));
+ await waitFor(() => expect(disarmCalls).toBe(1));
+ });
+
+ it("a machine that appears while the card is open flips to the joined state", async () => {
+ render(<MachinesSection />);
+ await waitFor(() => expect(screen.getByText("hetzner-box")).toBeTruthy());
+ fireEvent.click(screen.getByText("Add a machine…"));
+ await waitFor(() => expect(screen.getByTestId("join-command")).toBeTruthy());
+ machinesPayload.machines = [
+ ...machinesPayload.machines,
+ {
+ id: "m3",
+ name: "my-box",
+ fingerprint: "feedfacecafebeef",
+ app_version: "0.2.0",
+ created_at: Date.now() / 1000,
+ last_seen: Date.now() / 1000,
+ connected: true,
+ },
+ ];
+ await waitFor(
+ () => expect(screen.getByTestId("join-success").textContent).toContain("my-box joined"),
+ { timeout: 5000 },
+ );
+ expect(screen.getByTestId("join-success").textContent).toContain("feedfacecafebeef");
+ });
+
+ it("typed-code approval: look up shows name + fingerprint, approve confirms", async () => {
+ const decisions: string[] = [];
+ const fetchMock = vi.mocked(globalThis.fetch);
+ fetchMock.mockImplementation(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ if (url.includes("/v1/remote/device/")) {
+ if (init?.method === "POST") {
+ decisions.push(url.split("/").pop()!);
+ return { ok: true, json: async () => ({ ok: true }) } as Response;
+ }
+ if (url.endsWith("/WXYZ-2345")) {
+ return {
+ ok: true,
+ json: async () => ({
+ user_code: "WXYZ-2345",
+ name: "auth-vm",
+ fingerprint: "deadbeef00112233",
+ expires_at: Date.now() / 1000 + 600,
+ }),
+ } as Response;
+ }
+ return { ok: false, status: 404, json: async () => ({}) } as Response;
+ }
+ return { ok: true, json: async () => machinesPayload } as Response;
+ });
+
+ render(<MachinesSection />);
+ await waitFor(() => expect(screen.getByText("hetzner-box")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("approve-machine-button"));
+
+ // A wrong code is a dead end, not a grant.
+ const input = screen.getByTestId("approval-code-input");
+ fireEvent.change(input, { target: { value: "aaaa-0000" } });
+ fireEvent.keyDown(input, { key: "Enter" });
+ await waitFor(() => expect(screen.getByTestId("approval-unknown")).toBeTruthy());
+
+ // The right code shows the machine's claim; approving records the decision.
+ fireEvent.change(input, { target: { value: "wxyz-2345" } });
+ fireEvent.keyDown(input, { key: "Enter" });
+ await waitFor(() =>
+ expect(screen.getByTestId("approval-fingerprint").textContent).toContain(
+ "deadbeef00112233",
+ ),
+ );
+ fireEvent.click(screen.getByTestId("approve-button"));
+ await waitFor(() =>
+ expect(screen.getByTestId("approval-result").textContent).toContain("Approved"),
+ );
+ expect(decisions).toEqual(["approve"]);
+ });
+});
+
+// -- managed sandboxes (spec §Fly sandboxes) ------------------------------------
+
+describe("MachinesSection sandboxes (cloud mode)", () => {
+ it("offers New sandbox from the listing's cap, shows the pending row, and routes a sandbox machine's Remove through the sandbox", async () => {
+ const { setAppMode } = await import("../api");
+ setAppMode("cloud");
+ const sandboxes: any = { sandboxes: [], cap: 3, used: 0 };
+ const calls: string[] = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ const method = init?.method ?? "GET";
+ calls.push(`${method} ${url.replace(/^https?:\/\/[^/]+/, "")}`);
+ if (url.endsWith("/v1/sandboxes") && method === "POST") {
+ sandboxes.sandboxes = [
+ { id: "sb-1", name: "sandbox-1", owner: "me", mine: true, state: "provisioning", phase: "provisioning", error: "", machine_id: "", connected: false, created_at: 1, updated_at: 1 },
+ ];
+ sandboxes.used = 1;
+ return { ok: true, status: 202, json: async () => ({ sandbox: sandboxes.sandboxes[0] }) } as Response;
+ }
+ if (url.endsWith("/v1/sandboxes")) {
+ return { ok: true, status: 200, json: async () => sandboxes } as Response;
+ }
+ if (url.includes("/v1/sandboxes/sb-1") && method === "DELETE") {
+ sandboxes.sandboxes = [];
+ sandboxes.used = 0;
+ machinesPayload.machines = [];
+ return { ok: true, status: 200, json: async () => ({ removed: "sb-1" }) } as Response;
+ }
+ return { ok: true, status: 200, json: async () => machinesPayload } as Response;
+ }),
+ );
+ try {
+ render(<MachinesSection />);
+ const button = await screen.findByTestId("new-sandbox-button");
+ expect(button.textContent).toContain("New sandbox (0 of 3)");
+ fireEvent.click(button);
+ // The pending row appears with its phase, the count moves.
+ await waitFor(() => expect(screen.getByTestId("sandbox-phase-sandbox-1").textContent).toContain("creating the machine"));
+ await waitFor(() => expect(screen.getByTestId("new-sandbox-button").textContent).toContain("(1 of 3)"));
+
+ // The box joins: the machine row wears the sandbox tag and Remove goes
+ // through the sandbox (machine + disk), not the plain machine delete.
+ sandboxes.sandboxes[0] = { ...sandboxes.sandboxes[0], state: "running", phase: "online", machine_id: "m9", connected: true };
+ machinesPayload.machines = [
+ { id: "m9", name: "sandbox-1", fingerprint: "abcdefabcdef0000", app_version: "0.2.0", created_at: 2, last_seen: Date.now() / 1000, connected: true, provenance: "fly", provenance_ref: "sb-1" },
+ ];
+ await waitFor(() => expect(screen.getByTestId("sandbox-tag-sandbox-1")).toBeTruthy(), { timeout: 5000 });
+ vi.stubGlobal("confirm", () => true);
+ fireEvent.click(screen.getAllByText("Remove")[0]);
+ await waitFor(() => expect(calls).toContain("DELETE /v1/sandboxes/sb-1"));
+ expect(calls.some((c) => c === "DELETE /v1/machines/m9")).toBe(false);
+ } finally {
+ setAppMode("desktop");
+ }
+ });
+
+ it("shows nothing about sandboxes when the cap is zero", async () => {
+ const { setAppMode } = await import("../api");
+ setAppMode("cloud");
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (input: RequestInfo | URL) => {
+ const url = String(input);
+ if (url.endsWith("/v1/sandboxes")) return { ok: true, status: 200, json: async () => ({ sandboxes: [], cap: 0, used: 0 }) } as Response;
+ return { ok: true, status: 200, json: async () => machinesPayload } as Response;
+ }),
+ );
+ try {
+ render(<MachinesSection />);
+ await waitFor(() => expect(screen.getByText("hetzner-box")).toBeTruthy());
+ expect(screen.queryByTestId("new-sandbox-button")).toBeNull();
+ } finally {
+ setAppMode("desktop");
+ }
+ });
+});
diff --git a/surfaces/gui/src/components/MachinesSection.tsx b/surfaces/gui/src/components/MachinesSection.tsx
new file mode 100644
index 00000000..a9ea82d7
--- /dev/null
+++ b/surfaces/gui/src/components/MachinesSection.tsx
@@ -0,0 +1,1013 @@
+import { useCallback, useEffect, useRef, useState } from "react";
+import type { TFunction } from "i18next";
+import { Trans, useTranslation } from "react-i18next";
+import {
+ approveDeviceRequest,
+ armEnrollment,
+ denyDeviceRequest,
+ deployMachineSecrets,
+ deploySealedSecrets,
+ disarmEnrollment,
+ getDeviceRequest,
+ getMachines,
+ MACHINES_CHANGED,
+ getMachineSecrets,
+ getWalletProfiles,
+ removeMachine,
+ createSandbox,
+ deleteSandbox,
+ getSandboxes,
+ renameMachine,
+ revokeMachineSecrets,
+ type DeviceRequestDetail,
+ type Machine,
+ type MachineSecretRow,
+} from "../api";
+import {
+ getCloudMachines,
+ hasWallet,
+ isCloudMode,
+ type Sandbox,
+ type SandboxesInfo,
+ type CloudMachinesInfo,
+} from "../api";
+import { profileHash, sealProfiles } from "../seal";
+import { consumeApprovalCode, peekApprovalCode } from "../routes";
+import { keyPushAllowed } from "../cloudAuth";
+import { Icon } from "./Icon";
+import { PanelHead } from "./IntegrationsView";
+
+// Settings ▸ Machines (UX-045 frame C/D). Rows model the connectors/accounts
+// idiom: calm at rest, actions on hover. Opening "Add a machine" is what ARMS
+// enrollment — it mints the single-use token and starts the 10-minute window;
+// closing the card disarms. Already-joined machines reconnect anytime.
+
+const ROW =
+ "flex items-center gap-3 px-3.5 py-3 rounded-xl2 border border-line bg-panel mb-2.5 group";
+const META = "text-label text-muted";
+const ACT =
+ "text-meta text-muted hover:text-ink opacity-0 group-hover:opacity-100 transition-opacity";
+
+const POLL_MS = 2000;
+
+function agoLabel(epochSeconds: number | null, t: TFunction): string {
+ if (!epochSeconds) return t("machines.never_seen");
+ const seconds = Math.max(0, Date.now() / 1000 - epochSeconds);
+ if (seconds < 90) return t("inbox.rel_just_now");
+ if (seconds < 3600) return t("machines.min_ago", { n: Math.round(seconds / 60) });
+ if (seconds < 172800) return t("machines.hours_ago", { n: Math.round(seconds / 3600) });
+ return t("machines.days_ago", { n: Math.round(seconds / 86400) });
+}
+
+function joinedLabel(epochSeconds: number): string {
+ return new Date(epochSeconds * 1000).toLocaleDateString(undefined, {
+ month: "short",
+ day: "numeric",
+ });
+}
+
+export function MachinesSection() {
+ const { t } = useTranslation();
+ const [machines, setMachines] = useState<Machine[]>([]);
+ const [loaded, setLoaded] = useState(false);
+ const [adding, setAdding] = useState<"arm" | "approve" | null>(null);
+ const [keysFor, setKeysFor] = useState<string | null>(null);
+ // #/approve/CODE deep link: open the approval card with the code filled
+ // in. Consumed in the effect — reopening this page later must not replay it.
+ const [deepLinkCode] = useState(() => peekApprovalCode());
+ useEffect(() => {
+ if (deepLinkCode) {
+ consumeApprovalCode();
+ setAdding("approve");
+ }
+ }, [deepLinkCode]);
+ const [renaming, setRenaming] = useState<string | null>(null);
+ const [renameText, setRenameText] = useState("");
+ const [error, setError] = useState<string | null>(null);
+
+ // Union view: the cloud registry's rows, shown in their own section on a
+ // signed-in desktop. A cloud-session problem only ever degrades that
+ // section — the local list above it is never blocked.
+ const [cloud, setCloud] = useState<CloudMachinesInfo | null>(null);
+ // Managed sandboxes (hosted only): the listing carries the caller's cap,
+ // so nothing here depends on the sign-in gate having run.
+ const [sandboxes, setSandboxes] = useState<SandboxesInfo>({ sandboxes: [], cap: 0, used: 0 });
+ const [creating, setCreating] = useState(false);
+
+ const knownIds = useRef<string>("");
+ const refresh = useCallback(async () => {
+ try {
+ const d = await getMachines();
+ const rows = d.machines ?? [];
+ setMachines(rows);
+ setLoaded(true);
+ // Tell the Settings rail (and any other picker) when the fleet changed.
+ const ids = rows.map((m) => m.id).sort().join(",");
+ if (knownIds.current && ids !== knownIds.current) {
+ window.dispatchEvent(new CustomEvent(MACHINES_CHANGED));
+ }
+ knownIds.current = ids || "-";
+ } catch {
+ /* sidecar unreachable — keep the last list */
+ }
+ if (!isCloudMode()) {
+ try {
+ setCloud(await getCloudMachines());
+ } catch {
+ /* keep the last cloud view */
+ }
+ } else {
+ setSandboxes(await getSandboxes());
+ }
+ }, []);
+
+ useEffect(() => {
+ void refresh();
+ }, [refresh]);
+
+ // Presence changes while the page is open (a box going down) should show
+ // without a manual reload; slow poll only while the tab is visible — and a
+ // quick one while a sandbox is still coming up, so the row flips on its own.
+ const pending = sandboxes.sandboxes.some((s) => s.phase === "provisioning" || s.phase === "joining");
+ useEffect(() => {
+ const t = setInterval(() => void refresh(), pending ? 3000 : 15000);
+ return () => clearInterval(t);
+ }, [refresh, pending]);
+
+ const newSandbox = async () => {
+ setCreating(true);
+ const r = await createSandbox();
+ setCreating(false);
+ if (r.error) setError(r.error);
+ else setError(null);
+ void refresh();
+ };
+
+ const removeSandbox = async (sb: Sandbox) => {
+ if (
+ !window.confirm(
+ t("machines.confirm_delete_sandbox", { name: sb.name }),
+ )
+ )
+ return;
+ const r = await deleteSandbox(sb.id);
+ if (r.error) setError(r.error);
+ else setError(null);
+ void refresh();
+ };
+
+ const submitRename = async (id: string) => {
+ const name = renameText.trim();
+ setRenaming(null);
+ if (!name) return;
+ const r = await renameMachine(id, name);
+ if (r.error) setError(r.error);
+ else setError(null);
+ void refresh();
+ };
+
+ const doRemove = async (m: Machine) => {
+ if (m.provenance === "fly" && m.provenance_ref) {
+ const sb = sandboxes.sandboxes.find((s) => s.id === m.provenance_ref);
+ if (sb) return removeSandbox(sb);
+ }
+ if (
+ !window.confirm(
+ t("machines.confirm_remove", { name: m.name }),
+ )
+ )
+ return;
+ const r = await removeMachine(m.id);
+ if (r.error) setError(r.error);
+ else setError(null);
+ void refresh();
+ };
+
+ // One row renderer for both registries — a cloud machine is the same row
+ // wearing a different origin; rename/remove/keys route by id prefix.
+ const machineRow = (m: Machine) =>
+ renaming === m.id ? (
+ <div key={m.id} className={ROW}>
+ <div className="w-8 h-8 rounded-lg bg-paper flex items-center justify-center text-body">
+ ⌂
+ </div>
+ <input
+ autoFocus
+ className="flex-1 min-w-0 px-2.5 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
+ value={renameText}
+ onChange={(e) => setRenameText(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void submitRename(m.id);
+ if (e.key === "Escape") setRenaming(null);
+ }}
+ onBlur={() => void submitRename(m.id)}
+ />
+ </div>
+ ) : (
+ <div key={m.id} className={ROW} data-testid={`machine-${m.name}`}>
+ <div className="w-8 h-8 rounded-lg bg-paper flex items-center justify-center text-body">
+ {m.provenance === "fly" ? "☁" : "⌂"}
+ </div>
+ <div className="min-w-0">
+ <div className="text-ui font-medium text-ink truncate">
+ {m.name}
+ {m.provenance === "fly" && (
+ <span
+ className="ml-2 align-middle text-[10.5px] text-muted border border-line rounded px-1.5 py-[1px]"
+ data-testid={`sandbox-tag-${m.name}`}
+ >
+ {t("machines.sandbox_tag")}
+ </span>
+ )}
+ </div>
+ <div className={META}>
+ <span
+ className={
+ "inline-block w-[7px] h-[7px] rounded-full mr-1.5 align-middle " +
+ (m.connected ? "bg-ok" : sandboxPhaseOf(m) === "asleep" ? "bg-accent" : "bg-faint")
+ }
+ />
+ {m.connected
+ ? t("machines.online")
+ : sandboxPhaseOf(m) === "asleep"
+ ? t("machines.asleep")
+ : t("machines.last_seen", { ago: agoLabel(m.last_seen, t) })}
+ {m.app_version ? ` · v${m.app_version}` : ""}
+ {" · " + t("machines.joined", { date: joinedLabel(m.created_at) })}
+ <span className="font-mono"> · {m.fingerprint.slice(0, 8)}…</span>
+ </div>
+ </div>
+ <div className="ml-auto flex items-center gap-3.5">
+ {/* Wallet-less backend (hosted): keys are sealed IN THE BROWSER
+ and relayed — the per-machine Keys card is the deploy surface.
+ Desktop keeps its wallet flows on the provider cards. */}
+ {!hasWallet() && keyPushAllowed() && (
+ <button
+ className={ACT}
+ onClick={() => setKeysFor(keysFor === m.id ? null : m.id)}
+ data-testid={`keys-${m.name}`}
+ >
+ {t("machines.keys_action")}
+ </button>
+ )}
+ <button
+ className={ACT}
+ onClick={() => {
+ setRenaming(m.id);
+ setRenameText(m.name);
+ }}
+ >
+ {t("sidebar.rename")}
+ </button>
+ <button className={ACT} onClick={() => void doRemove(m)}>
+ {t("common.remove")}
+ </button>
+ </div>
+ </div>
+ );
+
+ const sandboxPhaseOf = (m: Machine) =>
+ m.provenance === "fly"
+ ? sandboxes.sandboxes.find((s) => s.id === m.provenance_ref)?.phase
+ : undefined;
+
+ // Sandboxes that have no machine row yet (still coming up, stuck, or
+ // failed) get a row of their own so the click has visible consequences.
+ const pendingSandboxRow = (sb: Sandbox) => (
+ <div key={sb.id} className={ROW} data-testid={`sandbox-${sb.name}`}>
+ <div className="w-8 h-8 rounded-lg bg-paper flex items-center justify-center text-body">
+ ☁
+ </div>
+ <div className="min-w-0">
+ <div className="text-ui font-medium text-ink truncate">
+ {sb.name}
+ <span className="ml-2 align-middle text-[10.5px] text-muted border border-line rounded px-1.5 py-[1px]">
+ {t("machines.sandbox_tag")}
+ </span>
+ </div>
+ <div className={META} data-testid={`sandbox-phase-${sb.name}`}>
+ {sb.phase === "provisioning" && (
+ <>
+ <span className="inline-block w-[7px] h-[7px] rounded-full mr-1.5 align-middle bg-accent animate-pulse" />
+ {t("machines.sandbox_provisioning")}
+ </>
+ )}
+ {sb.phase === "joining" && (
+ <>
+ <span className="inline-block w-[7px] h-[7px] rounded-full mr-1.5 align-middle bg-accent animate-pulse" />
+ {t("machines.sandbox_joining")}
+ </>
+ )}
+ {sb.phase === "stuck" && (
+ <>
+ <span className="inline-block w-[7px] h-[7px] rounded-full mr-1.5 align-middle bg-faint" />
+ {t("machines.sandbox_stuck")}
+ </>
+ )}
+ {sb.phase === "failed" && (
+ <span className="text-red-500">
+ {t("machines.sandbox_failed", { error: sb.error || t("machines.unknown_error") })}
+ </span>
+ )}
+ {!sb.mine && ` · ${sb.owner}`}
+ </div>
+ </div>
+ {(sb.phase === "stuck" || sb.phase === "failed") && (
+ <div className="ml-auto flex items-center gap-3.5">
+ <button className={ACT} onClick={() => void removeSandbox(sb)}>
+ {t("sidebar.delete")}
+ </button>
+ </div>
+ )}
+ </div>
+ );
+ const pendingSandboxes = sandboxes.sandboxes.filter((sb) => !sb.machine_id);
+ const atCap = sandboxes.used >= sandboxes.cap;
+
+ return (
+ <section>
+ <PanelHead
+ title={t("machines.title")}
+ sub={t("machines.sub")}
+ />
+ {error ? (
+ <div className="text-meta text-red-500 mb-3">{error}</div>
+ ) : null}
+
+ {/* Cloud mode: the controller isn't a home — there is no This-Mac row. */}
+ {!isCloudMode() && (
+ <div className={ROW}>
+ <div className="w-8 h-8 rounded-lg bg-paper flex items-center justify-center text-body">
+ 💻
+ </div>
+ <div>
+ <div className="text-ui font-medium text-ink">{t("machines.this_mac")}</div>
+ <div className={META}>{t("machines.always_available")}</div>
+ </div>
+ </div>
+ )}
+
+ {machines.map(machineRow)}
+ {pendingSandboxes.map(pendingSandboxRow)}
+ {keysFor && machines.some((m) => m.id === keysFor) && (
+ <MachineKeysCard
+ machine={machines.find((m) => m.id === keysFor)!}
+ onClose={() => setKeysFor(null)}
+ />
+ )}
+
+ {adding === "arm" ? (
+ <AddMachineCard
+ knownIds={machines.map((m) => m.id)}
+ onJoined={() => void refresh()}
+ onClose={() => {
+ setAdding(null);
+ void refresh();
+ }}
+ />
+ ) : adding === "approve" ? (
+ <ApproveMachineCard
+ initialCode={deepLinkCode}
+ onDecided={() => void refresh()}
+ onClose={() => {
+ setAdding(null);
+ void refresh();
+ }}
+ />
+ ) : (
+ <div className="flex items-center gap-2.5 mt-1.5">
+ {/* Managed sandboxes (spec §Fly sandboxes): offered only where the
+ caller's cap is above zero; disabled once they are at it. */}
+ {isCloudMode() && sandboxes.cap > 0 && (
+ <button
+ className="inline-flex items-center gap-2 px-3.5 py-2 rounded-lg border border-accent bg-panel text-ui text-ink hover:border-lineStrong disabled:opacity-50"
+ onClick={() => void newSandbox()}
+ disabled={!loaded || creating || atCap}
+ title={
+ atCap
+ ? t("machines.sandbox_cap_title", { used: sandboxes.used, cap: sandboxes.cap })
+ : t("machines.sandbox_create_title")
+ }
+ data-testid="new-sandbox-button"
+ >
+ <Icon name="plus" size={14} />
+ {creating
+ ? t("automations.creating")
+ : t("machines.new_sandbox", { used: sandboxes.used, cap: sandboxes.cap })}
+ </button>
+ )}
+ <button
+ className="inline-flex items-center gap-2 px-3.5 py-2 rounded-lg border border-line bg-panel text-ui text-ink hover:border-lineStrong"
+ onClick={() => setAdding("arm")}
+ disabled={!loaded}
+ >
+ <Icon name="plus" size={14} /> {t("machines.add_machine")}
+ </button>
+ <button
+ className="inline-flex items-center gap-2 px-3.5 py-2 rounded-lg border border-line bg-panel text-ui text-ink hover:border-lineStrong"
+ onClick={() => setAdding("approve")}
+ disabled={!loaded}
+ data-testid="approve-machine-button"
+ >
+ <Icon name="shield" size={14} /> {t("machines.approve_machine")}
+ </button>
+ </div>
+ )}
+
+ {/* Union view (spec §"Union view on the signed-in desktop"): the cloud
+ registry's rows, one pane down. Signed out ⇒ the section does not
+ exist; an expired session degrades to a sign-in-again row; the
+ local list above is never touched by any of it. */}
+ {!isCloudMode() && cloud && cloud.session !== "signed_out" && (
+ <div className="mt-7" data-testid="cloud-machines-section">
+ <div className="mb-2.5 text-label text-faint font-medium">
+ OpenWorker Cloud{cloud.org?.name ? ` · ${cloud.org.name}` : ""}
+ </div>
+ {cloud.session === "expired" ? (
+ <div className={ROW} data-testid="cloud-session-expired">
+ <div className="text-meta text-muted">
+ {t("machines.cloud_expired")}
+ </div>
+ </div>
+ ) : cloud.session === "unreachable" ? (
+ <div className={ROW}>
+ <div className="text-meta text-muted">
+ {t("machines.cloud_unreachable")}
+ </div>
+ </div>
+ ) : cloud.machines.length === 0 ? (
+ <div className={ROW}>
+ <div className="text-meta text-muted">
+ {t("machines.cloud_empty")}
+ </div>
+ </div>
+ ) : (
+ cloud.machines.map(machineRow)
+ )}
+ </div>
+ )}
+ </section>
+ );
+}
+
+// The signed-in identity + org switcher moved to Settings ▸ Account
+// (UX-046 tail, 2026-08-30) — this page is the fleet list only.
+
+// Typed-code approval for `openworker auth join` (GitHub device-flow style).
+// The machine printed a code; the user types it here, checks the fingerprint
+// against what the machine printed, and decides. Approval mints the one join
+// token, bound to that machine's identity — a mistyped code shows a stranger's
+// name and fingerprint at worst, never grants anything by itself.
+function ApproveMachineCard({
+ initialCode = "",
+ onDecided,
+ onClose,
+}: {
+ initialCode?: string;
+ onDecided: () => void;
+ onClose: () => void;
+}) {
+ const { t } = useTranslation();
+ const [code, setCode] = useState(initialCode);
+ const [detail, setDetail] = useState<DeviceRequestDetail | null>(null);
+ const [status, setStatus] = useState<"idle" | "unknown" | "approved" | "denied">("idle");
+
+ const lookup = useCallback(async (raw?: string) => {
+ const normalized = (raw ?? code).trim().toUpperCase();
+ if (!normalized) return;
+ const d = await getDeviceRequest(normalized);
+ setDetail(d);
+ setStatus(d ? "idle" : "unknown");
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [code]);
+
+ // Deep-linked code: look it up immediately — the user clicked a URL the
+ // joining machine printed; the card should already show its claim.
+ useEffect(() => {
+ if (initialCode) void lookup(initialCode);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [initialCode]);
+
+ const decide = async (approve: boolean) => {
+ if (!detail) return;
+ const ok = approve
+ ? await approveDeviceRequest(detail.user_code)
+ : await denyDeviceRequest(detail.user_code);
+ if (!ok) {
+ setDetail(null);
+ setStatus("unknown");
+ return;
+ }
+ setStatus(approve ? "approved" : "denied");
+ onDecided();
+ };
+
+ return (
+ <div className="rounded-xl2 border border-line bg-panel px-5 py-4 mt-1.5 max-w-xl">
+ <div className="flex items-center justify-between">
+ <div className="text-body font-semibold text-ink">{t("machines.approve.title")}</div>
+ <button className="text-muted hover:text-ink" onClick={onClose} aria-label={t("modal.close")}>
+ <Icon name="x" size={14} />
+ </button>
+ </div>
+
+ {status === "approved" || status === "denied" ? (
+ <div className="mt-3 text-ui font-medium text-ink" data-testid="approval-result">
+ {status === "approved" ? (
+ <Trans
+ i18nKey="machines.approve.approved"
+ values={{ name: detail?.name ?? "" }}
+ components={{ mono: <span className="font-mono" /> }}
+ />
+ ) : (
+ <>{t("machines.approve.denied")}</>
+ )}
+ </div>
+ ) : detail ? (
+ <>
+ <div className="mt-3 text-meta text-muted">
+ {t("machines.approve.claim_intro")}
+ </div>
+ <div className="mt-2 rounded-lg border border-line bg-paper px-3 py-2.5 text-ui text-ink">
+ <div className="font-medium">{detail.name}</div>
+ <div className="font-mono text-label text-muted mt-0.5" data-testid="approval-fingerprint">
+ {t("machines.key_fingerprint", { fingerprint: detail.fingerprint })}
+ </div>
+ </div>
+ <div className="mt-2 text-label text-faint">
+ {t("machines.approve.check_fingerprint")}
+ </div>
+ <div className="mt-3.5 flex items-center gap-2.5">
+ <button
+ className="px-3.5 py-2 rounded-lg bg-accent text-white text-ui font-medium"
+ onClick={() => void decide(true)}
+ data-testid="approve-button"
+ >
+ {t("inbox.approve")}
+ </button>
+ <button
+ className="px-3.5 py-2 rounded-lg border border-line text-ui text-ink"
+ onClick={() => void decide(false)}
+ >
+ {t("approval.deny")}
+ </button>
+ </div>
+ </>
+ ) : (
+ <>
+ <div className="mt-3 text-meta text-muted">
+ <Trans
+ i18nKey="machines.approve.instructions"
+ components={{
+ cmd: (
+ <span className="font-mono text-ink">
+ {`openworker auth join <${t("machines.approve.this_url")}>`}
+ </span>
+ ),
+ }}
+ />
+ </div>
+ <div className="mt-2.5 flex items-center gap-2.5">
+ <input
+ autoFocus
+ className="px-3 py-2 rounded-lg border border-line bg-paper font-mono text-body tracking-widest text-ink outline-none focus:border-accent uppercase"
+ placeholder="XXXX-XXXX"
+ value={code}
+ onChange={(e) => setCode(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void lookup();
+ }}
+ data-testid="approval-code-input"
+ />
+ <button
+ className="px-3.5 py-2 rounded-lg border border-line text-ui text-ink hover:border-lineStrong"
+ onClick={() => void lookup()}
+ >
+ {t("machines.approve.look_up")}
+ </button>
+ </div>
+ {status === "unknown" && (
+ <div className="mt-2 text-meta text-red-500" data-testid="approval-unknown">
+ {t("machines.approve.unknown_code")}
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ );
+}
+
+function AddMachineCard({
+ knownIds,
+ onJoined,
+ onClose,
+}: {
+ knownIds: string[];
+ onJoined: () => void;
+ onClose: () => void;
+}) {
+ const { t } = useTranslation();
+ const [joinUrl, setJoinUrl] = useState<string | null>(null);
+ const [expiresAt, setExpiresAt] = useState(0);
+ const [now, setNow] = useState(() => Date.now() / 1000);
+ const [reach, setReach] = useState<"ssh" | "vpn">("ssh");
+ const [joined, setJoined] = useState<Machine | null>(null);
+ const [copied, setCopied] = useState(false);
+ // "Provision with my defaults" (§Keys wallet): the wallet's provider keys,
+ // deployed automatically the moment the machine joins. Names only here —
+ // values are resolved and sealed sidecar-side.
+ const [providerProfiles, setProviderProfiles] = useState<string[]>([]);
+ const [provision, setProvision] = useState(true);
+ const [provisioned, setProvisioned] = useState<string[] | null>(null);
+ useEffect(() => {
+ getWalletProfiles()
+ .then((rows) =>
+ setProviderProfiles(
+ rows.map((r) => r.profile).filter((p) => p.startsWith("provider:")),
+ ),
+ )
+ .catch(() => setProviderProfiles([]));
+ }, []);
+ // Machines enrolled before the card opened must not read as the new arrival.
+ const known = useRef(new Set(knownIds));
+
+ const arm = useCallback(async () => {
+ try {
+ const d = await armEnrollment();
+ setJoinUrl(d.join_url);
+ setExpiresAt(d.expires_at);
+ } catch {
+ setJoinUrl(null);
+ }
+ }, []);
+
+ useEffect(() => {
+ void arm();
+ // Leaving the card closes the enrollment window — but never after a
+ // successful join, and never revoke a window we no longer own.
+ return () => {
+ void disarmEnrollment();
+ };
+ }, [arm]);
+
+ useEffect(() => {
+ const t = setInterval(() => setNow(Date.now() / 1000), 1000);
+ return () => clearInterval(t);
+ }, []);
+
+ useEffect(() => {
+ if (joined) return;
+ const t = setInterval(async () => {
+ try {
+ const d = await getMachines();
+ const fresh = (d.machines ?? []).find((m) => !known.current.has(m.id));
+ if (fresh) {
+ setJoined(fresh);
+ onJoined();
+ if (provision && providerProfiles.length) {
+ try {
+ const r = await deployMachineSecrets(fresh.id, providerProfiles);
+ setProvisioned(r.deployed ?? []);
+ } catch {
+ setProvisioned([]);
+ }
+ }
+ }
+ } catch {
+ /* keep waiting */
+ }
+ }, POLL_MS);
+ return () => clearInterval(t);
+ }, [joined, onJoined, provision, providerProfiles]);
+
+ const remaining = Math.max(0, Math.floor(expiresAt - now));
+ const expired = joinUrl !== null && remaining === 0 && !joined;
+ const countdown = `${Math.floor(remaining / 60)}:${String(remaining % 60).padStart(2, "0")}`;
+ const port = (() => {
+ try {
+ return joinUrl ? new URL(joinUrl).port || "80" : "9787";
+ } catch {
+ return "9787";
+ }
+ })();
+ const command = joinUrl ? `openworker join ${joinUrl} --name=my-box` : "…";
+
+ const copy = async () => {
+ if (!joinUrl) return;
+ try {
+ await navigator.clipboard.writeText(command);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 1500);
+ } catch {
+ /* clipboard unavailable */
+ }
+ };
+
+ return (
+ <div className="rounded-xl2 border border-line bg-panel px-5 py-4 mt-1.5 max-w-xl">
+ <div className="flex items-center justify-between">
+ <div className="text-body font-semibold text-ink">{t("machines.add.title")}</div>
+ <button className="text-muted hover:text-ink" onClick={onClose} aria-label={t("modal.close")}>
+ <Icon name="x" size={14} />
+ </button>
+ </div>
+
+ {joined ? (
+ <>
+ <div className="mt-3 text-ui text-ok font-medium" data-testid="join-success">
+ {t("machines.add.joined", { name: joined.name })}
+ <span className="text-faint font-normal font-mono text-label">
+ {joined.app_version ? ` · v${joined.app_version}` : ""}
+ {" · " + t("machines.key_fingerprint", { fingerprint: joined.fingerprint })}
+ </span>
+ </div>
+ {provisioned !== null && (
+ <div className="mt-1.5 text-meta text-muted" data-testid="provisioned-note">
+ {provisioned.length
+ ? t("machines.add.provisioned", { count: provisioned.length })
+ : t("machines.add.provision_failed")}
+ </div>
+ )}
+ <div className="mt-2.5 text-meta text-muted">
+ <Trans
+ i18nKey="machines.add.next"
+ values={{ name: joined.name }}
+ components={{ b: <b className="text-ink font-medium" /> }}
+ />
+ </div>
+ </>
+ ) : (
+ <>
+ {/* Cloud: machines dial the public URL directly — no reach step. */}
+ {!isCloudMode() && (
+ <>
+ <div className="mt-3 text-meta text-muted">
+ <Trans
+ i18nKey="machines.add.step_reach"
+ components={{ b: <b className="text-ink font-medium" /> }}
+ />
+ </div>
+ <div className="inline-flex mt-2 border border-line rounded-lg overflow-hidden text-meta">
+ <button
+ className={"px-3 py-1.5 " + (reach === "ssh" ? "bg-paper text-ink font-medium" : "text-muted")}
+ onClick={() => setReach("ssh")}
+ >
+ {t("machines.add.reach_ssh")}
+ </button>
+ <button
+ className={"px-3 py-1.5 " + (reach === "vpn" ? "bg-paper text-ink font-medium" : "text-muted")}
+ onClick={() => setReach("vpn")}
+ >
+ {t("machines.add.reach_vpn")}
+ </button>
+ </div>
+ <div className="mt-2 text-label text-faint leading-relaxed">
+ {reach === "ssh" ? (
+ <>
+ {t("machines.add.ssh_help")}
+ <div className="font-mono mt-1">{`ssh -N -R ${port}:localhost:${port} user@your-vm`}</div>
+ </>
+ ) : (
+ <>
+ {t("machines.add.vpn_help")}
+ </>
+ )}
+ </div>
+ </>
+ )}
+
+ <div className="mt-3.5 text-meta text-muted">
+ {isCloudMode() ? (
+ <>{t("machines.add.run_this")}</>
+ ) : (
+ <Trans
+ i18nKey="machines.add.step_run"
+ components={{ b: <b className="text-ink font-medium" /> }}
+ />
+ )}
+ </div>
+ <div className="mt-2 flex items-center justify-between gap-3 rounded-lg border border-line bg-paper px-3 py-2.5 font-mono text-label text-ink">
+ <span className="truncate" data-testid="join-command">{command}</span>
+ <button className="text-accent text-label font-sans shrink-0" onClick={copy}>
+ {copied ? t("transcript.copied") : t("machines.add.copy")}
+ </button>
+ </div>
+
+ {providerProfiles.length > 0 && (
+ <label className="mt-3 flex items-start gap-2 text-meta text-muted cursor-pointer select-none">
+ <input
+ type="checkbox"
+ className="mt-0.5"
+ checked={provision}
+ onChange={(e) => setProvision(e.target.checked)}
+ data-testid="provision-defaults"
+ />
+ <span>
+ {t("machines.add.provision_label", { n: providerProfiles.length })}
+ </span>
+ </label>
+ )}
+
+ <div className="mt-3.5 pt-3 border-t border-line flex items-center gap-2.5 text-meta text-muted">
+ {expired ? (
+ <>
+ <span>{t("machines.add.expired")}</span>
+ <button className="ml-auto text-accent" onClick={() => void arm()}>
+ {t("machines.add.rearm")}
+ </button>
+ </>
+ ) : (
+ <>
+ <span className="w-[9px] h-[9px] rounded-full border-[1.5px] border-faint border-t-transparent animate-spin" />
+ {t("machines.add.waiting")}
+ <span className="ml-auto text-faint" data-testid="token-countdown">
+ {t("machines.add.token_expires", { countdown: joinUrl ? countdown : "…" })}
+ </span>
+ </>
+ )}
+ </div>
+ </>
+ )}
+ </div>
+ );
+}
+
+// Per-machine key deploy for wallet-less backends (OPE-149). The value is
+// sealed IN THIS TAB to the machine's attested sealing key; the backend
+// relays ciphertext and records only names. The fingerprint shown here is
+// the user's verification anchor: `openworker status` on the box prints the
+// same sixteen characters.
+const KEY_PROVIDERS = [
+ { id: "anthropic", label: "Anthropic" },
+ { id: "openai", label: "OpenAI" },
+ { id: "google", label: "Google" },
+ { id: "openrouter", label: "OpenRouter" },
+];
+
+function MachineKeysCard({ machine, onClose }: { machine: Machine; onClose: () => void }) {
+ const { t } = useTranslation();
+ const [rows, setRows] = useState<MachineSecretRow[]>([]);
+ const [provider, setProvider] = useState(KEY_PROVIDERS[0].id);
+ const [custom, setCustom] = useState("");
+ const [value, setValue] = useState("");
+ const [busy, setBusy] = useState(false);
+ const [note, setNote] = useState<{ tone: "ok" | "err"; text: string } | null>(null);
+
+ const refresh = useCallback(() => {
+ getMachineSecrets(machine.id).then(setRows).catch(() => setRows([]));
+ }, [machine.id]);
+ useEffect(() => {
+ refresh();
+ }, [refresh]);
+
+ const profileName =
+ provider === "custom" ? custom.trim() : `provider:${provider}`;
+
+ const deploy = async () => {
+ const secret = value.trim();
+ if (!secret || !profileName || !machine.seal_pubkey) return;
+ setBusy(true);
+ setNote(null);
+ try {
+ const data = {
+ api_key: secret,
+ key_set_at: new Date().toISOString().slice(0, 10),
+ };
+ const sealed = sealProfiles(machine.seal_pubkey, { [profileName]: data });
+ const hash = await profileHash(data);
+ const r = await deploySealedSecrets(machine.id, sealed, [profileName], {
+ [profileName]: hash,
+ });
+ if (r.error) setNote({ tone: "err", text: r.error });
+ else {
+ setValue("");
+ setNote({ tone: "ok", text: t("machines.keys.deployed_note", { profile: profileName }) });
+ refresh();
+ }
+ } catch (e) {
+ setNote({ tone: "err", text: String((e as Error).message || e) });
+ } finally {
+ setBusy(false);
+ }
+ };
+
+ const revoke = async (profile: string) => {
+ const r = await revokeMachineSecrets(machine.id, [profile]);
+ if (r.error) setNote({ tone: "err", text: r.error });
+ else setNote({ tone: "ok", text: t("machines.keys.revoked_note", { profile }) });
+ refresh();
+ };
+
+ return (
+ <div className="rounded-xl2 border border-line bg-panel px-5 py-4 mt-1.5 max-w-xl" data-testid="machine-keys-card">
+ <div className="flex items-center justify-between">
+ <div className="text-body font-semibold text-ink">
+ {t("machines.keys.title", { name: machine.name })}
+ </div>
+ <button className="text-muted hover:text-ink" onClick={onClose} aria-label={t("modal.close")}>
+ <Icon name="x" size={14} />
+ </button>
+ </div>
+
+ {!machine.seal_pubkey ? (
+ <div className="mt-3 text-meta text-muted">
+ {t("machines.keys.no_seal_key")}
+ </div>
+ ) : (
+ <>
+ <div className="mt-2.5 text-meta text-muted leading-relaxed">
+ {t("machines.keys.sealed_note")}
+ </div>
+ <div className="mt-1.5 text-label text-faint">
+ <Trans
+ i18nKey="machines.keys.fingerprint_line"
+ components={{
+ fp: (
+ <span className="font-mono text-ink" data-testid="seal-fingerprint">
+ {machine.seal_fingerprint}
+ </span>
+ ),
+ cmd: <span className="font-mono" />,
+ }}
+ />
+ </div>
+
+ {rows.length > 0 && (
+ <div className="mt-3.5">
+ {rows.map((r) => (
+ <div
+ key={r.profile}
+ className="flex items-center gap-3 py-1.5 text-meta text-ink group"
+ data-testid={`deployed-${r.profile}`}
+ >
+ <span className="font-mono">{r.profile}</span>
+ <span className="text-faint text-label">
+ {t("machines.keys.deployed_on", {
+ date: new Date(r.deployed_at * 1000).toLocaleDateString(),
+ })}
+ </span>
+ <button className={"ml-auto " + ACT} onClick={() => void revoke(r.profile)}>
+ {t("settings.trust_revoke")}
+ </button>
+ </div>
+ ))}
+ </div>
+ )}
+
+ <div className="mt-3.5 flex items-center gap-2.5">
+ <select
+ className="px-2 py-2 rounded-lg border border-line bg-paper text-meta text-ink outline-none"
+ value={provider}
+ onChange={(e) => setProvider(e.target.value)}
+ data-testid="keys-provider"
+ >
+ {KEY_PROVIDERS.map((p) => (
+ <option key={p.id} value={p.id}>
+ {p.label}
+ </option>
+ ))}
+ <option value="custom">{t("machines.keys.custom_profile")}</option>
+ </select>
+ {provider === "custom" && (
+ <input
+ className="px-2.5 py-2 rounded-lg border border-line bg-paper font-mono text-meta text-ink outline-none w-40"
+ placeholder={t("machines.keys.profile_placeholder")}
+ value={custom}
+ onChange={(e) => setCustom(e.target.value)}
+ />
+ )}
+ <input
+ type="password"
+ className="flex-1 min-w-0 px-2.5 py-2 rounded-lg border border-line bg-paper font-mono text-meta text-ink outline-none focus:border-accent"
+ placeholder={t("machines.keys.api_key_placeholder")}
+ value={value}
+ onChange={(e) => setValue(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void deploy();
+ }}
+ data-testid="keys-value"
+ />
+ <button
+ className="px-3.5 py-2 rounded-lg bg-accent text-white text-ui font-medium disabled:opacity-50"
+ disabled={busy || !value.trim() || !profileName}
+ onClick={() => void deploy()}
+ data-testid="keys-deploy"
+ >
+ {busy ? t("machines.keys.sealing") : t("machines.keys.deploy")}
+ </button>
+ </div>
+ {note && (
+ <div
+ className={
+ "mt-2 text-meta " + (note.tone === "ok" ? "text-ok" : "text-red-500")
+ }
+ data-testid="keys-note"
+ >
+ {note.text}
+ </div>
+ )}
+ </>
+ )}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/ManageTabs.tsx b/surfaces/gui/src/components/ManageTabs.tsx
index abd28450..6598b3ed 100644
--- a/surfaces/gui/src/components/ManageTabs.tsx
+++ b/surfaces/gui/src/components/ManageTabs.tsx
@@ -22,6 +22,7 @@ import {
import { CloudSignInInline, CloudStatusPending } from "./connectors/CloudSignIn";
import { ModelChecklist } from "./ModelChecklist";
import { ProviderCards, ProviderForm, useProviderSetup } from "../providers/ProviderSetup";
+import { WalletChips } from "./WalletChips";
// "2h ago"-style label for the providers' Last-used line (null when never used).
const relTime = (epoch?: number | null): string | null => {
@@ -39,10 +40,10 @@ const relTime = (epoch?: number | null): string | null => {
// Shared tab bodies for the Settings and Integrations pages (the old top-tab ManageModal was retired
// when Settings/Activity became full-page surfaces): ModelsTab → Settings ▸ Models; ConnectorsTab →
// Integrations ▸ Connectors (the MCP tab retired into the Connectors page, UX-034).
-const SEC_H = "text-[11px] uppercase tracking-[0.05em] text-faint font-semibold";
+const SEC_H = "text-label text-faint font-medium";
const BTN_BORDERED =
- "text-[13px] px-3 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
-const BTN_ACCENT = "text-[13px] px-3 py-1.5 rounded-lg bg-accent text-white shrink-0 disabled:opacity-50";
+ "text-ui px-3 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
+const BTN_ACCENT = "text-ui px-3 py-1.5 rounded-lg bg-accent text-white shrink-0 disabled:opacity-50";
/** Two-letter initials for a chip/avatar (first+last word, else first two chars). */
function initials(name: string): string {
@@ -66,7 +67,7 @@ export function ModelsTab() {
refreshSettings();
}, []);
- if (!settings) return <div className="text-[13px] text-muted">{t("manage.loading")}</div>;
+ if (!settings) return <div className="text-ui text-muted">{t("manage.loading")}</div>;
const info = ps.info;
const knownNames = ps.providers.map((p) => p.name);
@@ -88,7 +89,7 @@ export function ModelsTab() {
footer={
ps.credentialed ? (
<button
- className="text-[13px] text-danger/80 hover:text-danger hover:underline underline-offset-2"
+ className="text-ui text-danger/80 hover:text-danger hover:underline underline-offset-2"
data-testid="set-remove-key"
onClick={() => {
if (window.confirm(t("manage.remove_key_confirm", { title: info?.title || "" }))) ps.removeKey();
@@ -101,15 +102,20 @@ export function ModelsTab() {
/>
{ps.sel === "openai" && settings.source === "env" && (
- <p className="text-[12px] text-muted mt-3 leading-relaxed">
+ <p className="text-meta text-muted mt-3 leading-relaxed">
{t("manage.openai_env_help")}
</p>
)}
+ {/* Keys wallet: once a machine is enrolled, a provider with a STORED key can
+ deploy it (sealed; the machine owns its copy). Keyless providers (Ollama)
+ have nothing in the wallet — no row. */}
+ {ps.credentialed && ps.sel && <WalletChips profiles={[`provider:${ps.sel}`]} />}
+
{info?.configured ? (
<div className="mt-6">
<div className={SEC_H + " mb-1.5"}>{t("manage.models")}</div>
- <p className="text-[12px] text-muted mb-2.5 leading-relaxed">
+ <p className="text-meta text-muted mb-2.5 leading-relaxed">
{t("manage.models_help")}
</p>
<ModelChecklist
@@ -128,7 +134,7 @@ export function ModelsTab() {
(info?.suggested_models?.length || 0) > 0 && (
<div className="mt-6" data-testid="model-preview">
<div className={SEC_H + " mb-1.5"}>{t("manage.included_models")}</div>
- <p className="text-[12px] text-muted mb-2.5 leading-relaxed">
+ <p className="text-meta text-muted mb-2.5 leading-relaxed">
{t("manage.included_models_help")}
</p>
<div className="space-y-1">
@@ -137,7 +143,7 @@ export function ModelsTab() {
return (
<div
key={m}
- className="px-2.5 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-muted"
+ className="px-2.5 py-1.5 rounded-lg border border-line bg-paper text-ui text-muted"
title={full}
>
{settings.model_labels?.[full] || m}
@@ -177,7 +183,7 @@ function ComposerPickerCard({
return (
<div className="mt-6" data-testid="composer-picker">
<div className={SEC_H + " mb-1.5"}>{t("manage.composer_picker_title")}</div>
- <p className="text-[12px] text-muted mb-2.5 leading-relaxed">
+ <p className="text-meta text-muted mb-2.5 leading-relaxed">
{t("manage.composer_picker_help")}
</p>
<div className="mlist">
@@ -197,7 +203,7 @@ function ComposerPickerCard({
{settings.model_labels?.[id] || id}
</span>
</label>
- <span className="text-[11px] text-faint mr-2 shrink-0">{tag(id)}</span>
+ <span className="text-label text-faint mr-2 shrink-0">{tag(id)}</span>
{isDefault ? (
<span className="mlist-default">{t("models.default_badge")}</span>
) : (
@@ -253,15 +259,15 @@ export function UnauthorizedBlock({
<div className="space-y-2">
{items.map((m) => (
<div key={m.id} className="rounded-xl border border-line bg-paper p-2.5">
- <div className="flex items-center gap-2 text-[12px] text-muted">
+ <div className="flex items-center gap-2 text-meta text-muted">
<span className="font-medium text-ink">{m.user_name || m.user_id}</span>
<span>{t("manage.parked_in", { chat: m.chat_name || m.chat_id })}</span>
<span className="ml-auto shrink-0">{relTime(m.ts) || ""}</span>
</div>
- <div className="text-[13px] mt-1 break-words">{m.text}</div>
+ <div className="text-ui mt-1 break-words">{m.text}</div>
<div className="flex items-center gap-1.5 mt-2">
<button
- className="text-[12px] px-2 py-1 rounded-md bg-accent text-white"
+ className="text-meta px-2 py-1 rounded-md bg-accent text-white"
data-testid={`parked-allow-deliver-${m.id}`}
title={t("manage.parked_allow_deliver_tip")}
onClick={() => act(m.id, "allow_deliver")}
@@ -277,7 +283,7 @@ export function UnauthorizedBlock({
{t("manage.parked_allow_only")}
</button>
<button
- className="text-[12px] px-2 py-1 rounded-md text-faint hover:text-danger"
+ className="text-meta px-2 py-1 rounded-md text-faint hover:text-danger"
data-testid={`parked-dismiss-${m.id}`}
title={t("manage.parked_dismiss_tip")}
onClick={() => act(m.id, "dismiss")}
@@ -309,13 +315,13 @@ export function ListeningSessionsBlock({ c }: { c: Connector }) {
<div className="border-t border-line px-3.5 py-3" data-testid={`listening-${c.name}`}>
<div className={SEC_H + " mb-2"}>{t("manage.listening_title", { title: c.title, n: mine.length })}</div>
{mine.length === 0 ? (
- <div className="text-[12px] text-faint">
+ <div className="text-meta text-faint">
{t("manage.listening_empty")}
</div>
) : (
<div className="space-y-1.5">
{mine.map((s) => (
- <div className="flex items-center gap-2 text-[13px]" key={s.session_id + s.channel}>
+ <div className="flex items-center gap-2 text-ui" key={s.session_id + s.channel}>
<span className="min-w-0 truncate" title={s.session_id}>
{s.session_title || s.session_id}
{s.agent ? <span className="text-faint"> · {s.agent}</span> : null}
@@ -372,12 +378,12 @@ export function AllowlistBlock({
<div className={SEC_H + " mb-2"}>{t("manage.allowed_to_message")}</div>
<div className="flex flex-wrap gap-1.5">
{allowedUsers.length === 0 && (
- <span className="text-[12px] text-faint">{t("manage.allowed_empty")}</span>
+ <span className="text-meta text-faint">{t("manage.allowed_empty")}</span>
)}
{allowedUsers.map((u) => (
<span
key={u}
- className="inline-flex items-center gap-1.5 pl-2 pr-1 py-1 rounded-full bg-paper border border-line text-[12px]"
+ className="inline-flex items-center gap-1.5 pl-2 pr-1 py-1 rounded-full bg-paper border border-line text-meta"
title={t("manage.id_title", { id: u })}
>
<span className="w-4 h-4 rounded-full bg-accentSoft text-accent grid place-items-center text-[9px] font-bold">
@@ -401,11 +407,11 @@ export function AllowlistBlock({
<div>
<div className={SEC_H + " mb-2"}>{t("manage.recent_senders")}</div>
{unknownRecent.length === 0 ? (
- <div className="text-[12px] text-faint">{t("manage.recent_empty")}</div>
+ <div className="text-meta text-faint">{t("manage.recent_empty")}</div>
) : (
<div className="space-y-1.5">
{unknownRecent.map((r) => (
- <div className="flex items-center gap-2 text-[13px]" key={r.user_id}>
+ <div className="flex items-center gap-2 text-ui" key={r.user_id}>
<span className="w-5 h-5 rounded-full bg-paper border border-line grid place-items-center text-[9px] font-bold text-muted shrink-0">
{initials(r.user_name || "?")}
</span>
@@ -413,7 +419,7 @@ export function AllowlistBlock({
{r.user_name || t("manage.unknown")} <span className="text-faint">· {r.chat_type}</span>
</span>
<button
- className="ml-auto text-[12px] px-2 py-0.5 rounded-md bg-accent text-white shrink-0"
+ className="ml-auto text-meta px-2 py-0.5 rounded-md bg-accent text-white shrink-0"
onClick={async () => {
await allowUser(c.name, r.user_id, teamId);
onChanged();
@@ -438,7 +444,7 @@ export function ConnectorTools({ c, onChanged }: { c: Connector; onChanged: () =
};
if (!c.tools?.length)
return (
- <div className="border-t border-line px-3.5 py-3 text-[13px] text-muted">
+ <div className="border-t border-line px-3.5 py-3 text-ui text-muted">
{t("manage.connector_no_tools")}
</div>
);
@@ -458,11 +464,11 @@ export function ConnectorTools({ c, onChanged }: { c: Connector; onChanged: () =
onChange={(e) => toggle(tool.name, e.target.checked)}
/>
<span className="min-w-0">
- <span className="block text-[13px]">{tool.label}</span>
- <span className="block text-[12px] text-faint">
+ <span className="block text-ui">{tool.label}</span>
+ <span className="block text-meta text-faint">
{t("manage.tool_asks_approval", { name: tool.name, kind: tool.kind })}
</span>
- <span className="block text-[12px] text-faint">{tool.description}</span>
+ <span className="block text-meta text-faint">{tool.description}</span>
</span>
</label>
))}
@@ -528,7 +534,7 @@ export function ConnectSetup({
{waiting ? t("manage.check_browser") : t("manage.connect_one_click", { title: c.title })}
</button>
{c.fields.length > 0 && (
- <div className="text-[12px] text-faint">{t("manage.or_connect_manually")}</div>
+ <div className="text-meta text-faint">{t("manage.or_connect_manually")}</div>
)}
</div>
)}
@@ -540,11 +546,11 @@ export function ConnectSetup({
<>
<button className={BTN_ACCENT + " opacity-50"} disabled data-testid="managed-coming-soon">
{t("manage.connect_one_click", { title: c.title })}
- <span className="ml-2 text-[11px] font-medium px-1.5 py-0.5 rounded-full bg-white/25">
+ <span className="ml-2 text-label font-medium px-1.5 py-0.5 rounded-full bg-white/25">
{t("manage.coming_soon")}
</span>
</button>
- <div className="text-[12px] text-faint">
+ <div className="text-meta text-faint">
{t("manage.one_click_coming")}
</div>
</>
@@ -562,12 +568,12 @@ export function ConnectSetup({
<CloudStatusPending />
)}
{!c.managed_paused && cloud?.signed_in && (
- <div className="text-[12px] text-faint">{t("manage.or_connect_manually")}</div>
+ <div className="text-meta text-faint">{t("manage.or_connect_manually")}</div>
)}
</div>
)}
{c.instructions.length > 0 && (
- <ol className="list-decimal pl-4 text-[13px] text-muted leading-relaxed space-y-1">
+ <ol className="list-decimal pl-4 text-ui text-muted leading-relaxed space-y-1">
{c.instructions.map((step, i) => (
<li key={i}>{step}</li>
))}
@@ -594,7 +600,7 @@ export function ConnectSetup({
{busy ? t("manage.validating") : t("manage.connect")}
</button>
</div>
- {error && <div className="text-[13px] text-danger">{error}</div>}
+ {error && <div className="text-ui text-danger">{error}</div>}
</div>
);
}
diff --git a/surfaces/gui/src/components/MemorySection.tsx b/surfaces/gui/src/components/MemorySection.tsx
index 81be9d32..14c37803 100644
--- a/surfaces/gui/src/components/MemorySection.tsx
+++ b/surfaces/gui/src/components/MemorySection.tsx
@@ -8,9 +8,12 @@ import {
setMemorySettings,
updateMemory,
MEMORY_CHANGED,
+ type Machine,
type MemoryEntry,
type MemorySettings,
} from "../api";
+import { useMachineData } from "../useMachineData";
+import { CachedNote, LoadingRow, UnreachableRow } from "./ScopedStatus";
import { Icon } from "./Icon";
import { PanelHead } from "./IntegrationsView";
import { Toggle } from "./Toggle";
@@ -20,24 +23,35 @@ import { Toggle } from "./Toggle";
// no scope vocabulary, no markdown, no files. Everything else memory does happens in
// chat (toast §5.1, attribution §5.2).
const CARD = "rounded-xl2 border border-line bg-panel";
-const FIELD_LABEL = "text-[13px] font-medium text-ink";
-const FIELD_HELP = "text-[12px] text-muted mt-1.5 leading-relaxed";
+const FIELD_LABEL = "text-ui font-medium text-ink";
+const FIELD_HELP = "text-meta text-muted mt-1.5 leading-relaxed";
const BTN_ACCENT =
- "text-[13px] px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
+ "text-ui px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
-export function MemorySection() {
+export function MemorySection({
+ machine,
+ onAskWorker,
+}: {
+ // UX-046 machine scope: a remote machine's memory is VIEW-ONLY (owner
+ // ruling 2026-08-30) — memory belongs to that machine's worker; changing
+ // it is a conversation, and `onAskWorker` starts one on that machine.
+ machine?: Machine | null;
+ onAskWorker?: (machineId: string) => void;
+} = {}) {
const { t } = useTranslation();
- const [settings, setSettings] = useState<MemorySettings | null>(null);
- const [entries, setEntries] = useState<MemoryEntry[] | null>(null);
+ const mid = machine?.id ?? null;
+ const readOnly = !!machine;
+ const mem = useMachineData(`memory:${mid ?? "local"}`, async () => ({
+ settings: await getMemorySettings(mid),
+ entries: await getMemory(mid),
+ }));
+ const settings = mem.data?.settings ?? null;
+ const entries = mem.data?.entries ?? null;
// State-change copy (§5.3): shown under the toggle / list after an action.
const [toggleMsg, setToggleMsg] = useState<string | null>(null);
const [listMsg, setListMsg] = useState<string | null>(null);
- const refresh = () => {
- getMemorySettings().then(setSettings).catch(() => setSettings(null));
- getMemory().then(setEntries).catch(() => setEntries([]));
- };
- useEffect(refresh, []);
+ const refresh = mem.refresh;
// Stay current while the screen is open: a save/edit landing in a conversation, or
// the window regaining focus after one did. Without this the list is a snapshot from
// whenever the page mounted — it showed "Nothing yet" seconds after a real save
@@ -52,9 +66,9 @@ export function MemorySection() {
}, []);
const toggleEnabled = async () => {
- if (!settings) return;
+ if (!settings || readOnly) return;
const next = await setMemorySettings({ enabled: !settings.enabled });
- setSettings(next);
+ refresh();
setToggleMsg(next.enabled ? t("memory.on_msg") : t("memory.off_msg"));
};
@@ -65,37 +79,81 @@ export function MemorySection() {
refresh();
};
- if (!settings || entries === null)
- return <div className="text-[13px] text-muted">{t("memory.loading")}</div>;
+ if (!settings || entries === null) {
+ if (mem.error && machine)
+ return (
+ <section>
+ <PanelHead title={t("settings.tab.memory")} sub={t("onmachine.memory.on_machine", { machine: machine.name })} />
+ <div className={CARD}>
+ <UnreachableRow machineName={machine.name} />
+ </div>
+ </section>
+ );
+ return <LoadingRow what={machine ? t("onmachine.memory.loading_what_machine", { machine: machine.name }) : t("onmachine.memory.loading_what")} />;
+ }
return (
<section>
- <PanelHead title={t("settings.tab.memory")} sub={t("memory.section_sub")} />
+ <PanelHead
+ title={t("settings.tab.memory")}
+ sub={
+ machine
+ ? t("onmachine.memory.remote_sub", { machine: machine.name })
+ : t("memory.section_sub")
+ }
+ />
+ {mem.cachedAt ? <CachedNote at={mem.cachedAt} /> : null}
+
+ {readOnly && (
+ <div className={CARD + " p-4 mb-4 flex items-center gap-3"} data-testid="memory-remote-cta">
+ <div className="min-w-0 flex-1">
+ <div className={FIELD_LABEL}>
+ {settings.enabled ? t("onmachine.memory.remote_on") : t("onmachine.memory.remote_off")}
+ </div>
+ <div className="text-meta text-muted mt-0.5">
+ {t("onmachine.memory.remote_help")}
+ </div>
+ </div>
+ {onAskWorker && (
+ <button
+ className={BTN_ACCENT}
+ onClick={() => onAskWorker(machine!.id)}
+ data-testid="memory-ask-worker"
+ >
+ {t("onmachine.memory.ask_worker")}
+ </button>
+ )}
+ </div>
+ )}
{/* On/off — one switch, no other setup (§5.4). */}
+ {!readOnly && (
<div className={CARD + " p-4 mb-4"} data-testid="memory-toggle-card">
<div className="flex items-center gap-3">
<Toggle checked={settings.enabled} onChange={toggleEnabled} title={t("memory.toggle_title")} />
<div className="min-w-0 flex-1">
<div className={FIELD_LABEL}>{t("memory.toggle_label")}</div>
- <div className="text-[12px] text-muted mt-0.5">{t("memory.toggle_help")}</div>
+ <div className="text-meta text-muted mt-0.5">{t("memory.toggle_help")}</div>
</div>
</div>
{toggleMsg && (
- <div className="text-[13px] text-muted mt-3 pt-3 border-t border-line" data-testid="memory-toggle-msg">
+ <div className="text-ui text-muted mt-3 pt-3 border-t border-line" data-testid="memory-toggle-msg">
{toggleMsg}
</div>
)}
</div>
+ )}
{/* What I've learned (§5.3): directly under the toggle that governs it — the off
message ("what I already know is kept, delete it below") points here. */}
<div className={CARD + " p-4 mb-4"} data-testid="memory-list-card">
<div className="flex items-center gap-2">
- <div className={FIELD_LABEL + " flex-1"}>{t("memory.learned_title")}</div>
- {entries.length > 0 && (
+ <div className={FIELD_LABEL + " flex-1"}>
+ {readOnly ? t("onmachine.memory.learned_title") : t("memory.learned_title")}
+ </div>
+ {entries.length > 0 && !readOnly && (
<button
- className="text-[12px] text-danger/80 hover:text-danger"
+ className="text-meta text-danger/80 hover:text-danger"
data-testid="memory-delete-all"
onClick={wipeAll}
>
@@ -103,22 +161,26 @@ export function MemorySection() {
</button>
)}
</div>
- <div className={FIELD_HELP}>{t("memory.learned_help")}</div>
+ <div className={FIELD_HELP}>
+ {readOnly
+ ? t("onmachine.memory.learned_help")
+ : t("memory.learned_help")}
+ </div>
{listMsg && (
- <div className="text-[13px] text-muted mt-2.5" data-testid="memory-list-msg">
+ <div className="text-ui text-muted mt-2.5" data-testid="memory-list-msg">
{listMsg}
</div>
)}
{entries.length === 0 ? (
!listMsg && (
- <div className="text-[12px] text-muted mt-3" data-testid="memory-empty">
+ <div className="text-meta text-muted mt-3" data-testid="memory-empty">
{t("memory.empty")}
</div>
)
) : (
<div className="mt-3 divide-y divide-line">
{entries.map((m) => (
- <MemoryRow key={m.id} entry={m} onChanged={refresh} />
+ <MemoryRow key={m.id} entry={m} onChanged={refresh} readOnly={readOnly} />
))}
</div>
)}
@@ -126,7 +188,7 @@ export function MemorySection() {
{/* Your instructions (§6): user-authored, toggle-independent — so it sits apart
from the auto-memory pair above. The agent never edits these. */}
- <UserRulesCard settings={settings} onSaved={setSettings} />
+ <UserRulesCard settings={settings} onSaved={() => refresh()} readOnly={readOnly} />
</section>
);
}
@@ -134,9 +196,11 @@ export function MemorySection() {
function UserRulesCard({
settings,
onSaved,
+ readOnly,
}: {
settings: MemorySettings;
onSaved: (s: MemorySettings) => void;
+ readOnly?: boolean;
}) {
const { t } = useTranslation();
const [draft, setDraft] = useState(settings.user_rules);
@@ -157,11 +221,13 @@ function UserRulesCard({
value={draft}
onChange={(e) => setDraft(e.target.value)}
rows={4}
+ disabled={readOnly}
placeholder={t("memory.rules_placeholder")}
data-testid="user-rules-input"
- className="w-full mt-2.5 px-3 py-2.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent resize-y leading-relaxed"
+ className="w-full mt-2.5 px-3 py-2.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent resize-y leading-relaxed"
/>
<div className="flex items-center gap-3 mt-2">
+ {!readOnly && (
<button
className={BTN_ACCENT}
onClick={save}
@@ -170,15 +236,24 @@ function UserRulesCard({
>
{t("memory.save")}
</button>
+ )}
{savedMsg && (
- <span className="text-[13px] text-muted">{t("memory.rules_saved")}</span>
+ <span className="text-ui text-muted">{t("memory.rules_saved")}</span>
)}
</div>
</div>
);
}
-function MemoryRow({ entry, onChanged }: { entry: MemoryEntry; onChanged: () => void }) {
+function MemoryRow({
+ entry,
+ onChanged,
+ readOnly,
+}: {
+ entry: MemoryEntry;
+ onChanged: () => void;
+ readOnly?: boolean;
+}) {
const { t } = useTranslation();
const [editing, setEditing] = useState(false);
const [draft, setDraft] = useState(entry.content);
@@ -202,7 +277,7 @@ function MemoryRow({ entry, onChanged }: { entry: MemoryEntry; onChanged: () =>
onChange={(e) => setDraft(e.target.value)}
rows={2}
autoFocus
- className="w-full px-3 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent resize-y leading-relaxed"
+ className="w-full px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent resize-y leading-relaxed"
onKeyDown={(e) => {
if (e.key === "Enter" && !e.shiftKey) {
e.preventDefault();
@@ -215,7 +290,7 @@ function MemoryRow({ entry, onChanged }: { entry: MemoryEntry; onChanged: () =>
<button className={BTN_ACCENT} onClick={() => void save()}>
{t("memory.save")}
</button>
- <button className="text-[13px] text-muted hover:text-ink" onClick={() => setEditing(false)}>
+ <button className="text-ui text-muted hover:text-ink" onClick={() => setEditing(false)}>
{t("manage.cancel")}
</button>
</div>
@@ -224,7 +299,8 @@ function MemoryRow({ entry, onChanged }: { entry: MemoryEntry; onChanged: () =>
return (
<div className="py-2.5 flex items-start gap-2.5 group" data-testid={`memory-row-${entry.id}`}>
- <div className="min-w-0 flex-1 text-[13px] leading-relaxed">{entry.content}</div>
+ <div className="min-w-0 flex-1 text-ui leading-relaxed">{entry.content}</div>
+ {!readOnly && (<>
<button
className="text-faint hover:text-ink shrink-0 mt-0.5"
title={t("memory.fix_tip")}
@@ -244,6 +320,7 @@ function MemoryRow({ entry, onChanged }: { entry: MemoryEntry; onChanged: () =>
>
<Icon name="trash" size={14} />
</button>
+ </>)}
</div>
);
}
diff --git a/surfaces/gui/src/components/PersonaView.tsx b/surfaces/gui/src/components/PersonaView.tsx
index 5ba775fc..75fa1470 100644
--- a/surfaces/gui/src/components/PersonaView.tsx
+++ b/surfaces/gui/src/components/PersonaView.tsx
@@ -20,6 +20,7 @@ import {
setPersonaConnection,
setPersonaEnabled,
updatePersona,
+ type Machine,
type PersonaDetail,
} from "../api";
import { chooseFolder } from "../tauri";
@@ -30,13 +31,13 @@ import { Markdown } from "./Markdown";
import { Toggle } from "./Toggle";
import { indexConnectors, labelFor, visualFor, type ConnectorMap } from "../connectors/visuals";
-const SEC_H = "text-[11px] uppercase tracking-[0.05em] text-faint font-semibold";
+const SEC_H = "text-label text-faint font-medium";
const TAG_CORE =
- "text-[11px] px-1.5 py-0.5 rounded-full bg-warnSoft/70 text-warnInk border border-warnInk/15";
-const TAG_MCP = "text-[11px] px-1.5 py-0.5 rounded border border-line text-faint";
-const BTN_ACCENT = "text-[12px] px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0";
+ "text-label px-1.5 py-0.5 rounded-full bg-warnSoft/70 text-warnInk border border-warnInk/15";
+const TAG_MCP = "text-label px-1.5 py-0.5 rounded border border-line text-faint";
+const BTN_ACCENT = "text-meta px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0";
const BTN_BORDERED =
- "text-[12px] px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0 disabled:opacity-40";
+ "text-meta px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0 disabled:opacity-40";
const GRP = "rounded-xl2 border border-line bg-panel divide-y divide-line overflow-hidden";
const COL_STATUS = "w-[96px] flex justify-end items-center shrink-0";
const COL_ENABLE = "w-[64px] flex justify-center items-center shrink-0";
@@ -45,12 +46,17 @@ export function PersonaView({
personaId,
onBack,
onOpenIntegrations,
+ machine,
}: {
personaId: string;
onBack?: () => void;
onOpenIntegrations?: () => void;
+ // UX-046 machine scope: this coworker lives on a joined machine; every read
+ // and write goes through the controller's proxy.
+ machine?: Machine | null;
}) {
const { t } = useTranslation();
+ const mid = machine?.id ?? null;
const [detail, setDetail] = useState<PersonaDetail | null>(null);
const [byName, setByName] = useState<ConnectorMap>({});
const [error, setError] = useState<string | null>(null);
@@ -67,44 +73,44 @@ export function PersonaView({
setError(null);
setMediaUrls([]);
setShot(0);
- getPersonaDetail(personaId)
+ getPersonaDetail(personaId, mid)
.then(async (d) => {
if (!live) return;
setDetail(d);
const loaded = await Promise.all(
- (d.media || []).map((name) => getPersonaMediaUrl(personaId, name).catch(() => null)),
+ (d.media || []).map((name) => getPersonaMediaUrl(personaId, name, mid).catch(() => null)),
);
urls = loaded.filter(Boolean) as string[];
if (live) setMediaUrls(urls);
})
.catch(() => live && setError(t("persona.load_error")));
- getConnectors()
+ getConnectors(mid)
.then((list) => live && setByName(indexConnectors(list)))
.catch(() => {});
return () => {
live = false;
urls.forEach((u) => URL.revokeObjectURL(u));
};
- }, [personaId]);
+ }, [personaId, mid]);
const toggleEnabled = async (next: boolean) => {
setDetail((d) => (d ? { ...d, enabled: next } : d)); // optimistic
- const r = await setPersonaEnabled(personaId, next);
- if (!r.ok) getPersonaDetail(personaId).then(setDetail).catch(() => {});
+ const r = await setPersonaEnabled(personaId, next, mid);
+ if (!r.ok) getPersonaDetail(personaId, mid).then(setDetail).catch(() => {});
};
const toggleDefault = async (connector: string, next: boolean) => {
- const r = await setPersonaConnection(personaId, connector, next);
+ const r = await setPersonaConnection(personaId, connector, next, mid);
if (r.default_connections) {
setDetail((d) => (d ? { ...d, default_connections: r.default_connections! } : d));
} else {
- getPersonaDetail(personaId).then(setDetail).catch(() => {});
+ getPersonaDetail(personaId, mid).then(setDetail).catch(() => {});
}
};
const patch = async (body: { surfaced?: boolean; default?: boolean }) => {
- await updatePersona(personaId, body);
- getPersonaDetail(personaId).then(setDetail).catch(() => {});
+ await updatePersona(personaId, body, mid);
+ getPersonaDetail(personaId, mid).then(setDetail).catch(() => {});
};
const exportBundle = async () => {
@@ -119,7 +125,7 @@ export function PersonaView({
{onBack && (
<>
<button
- className="inline-flex items-center gap-1 text-[13px] text-muted hover:text-ink"
+ className="inline-flex items-center gap-1 text-ui text-muted hover:text-ink"
onClick={onBack}
>
<Icon name="arrowLeft" size={15} /> {t("persona.back")}
@@ -127,7 +133,7 @@ export function PersonaView({
<span className="text-faint">·</span>
</>
)}
- <span className="text-[13px] font-semibold">{t("persona.persona")}</span>
+ <span className="text-ui font-semibold">{t("persona.persona")}</span>
</div>
);
@@ -135,7 +141,14 @@ export function PersonaView({
return (
<main className="flex-1 min-w-0 flex flex-col bg-paper">
{header}
- <div className="p-12 text-center text-faint text-[13px]">{error || t("persona.loading")}</div>
+ <div className="p-12 flex items-center justify-center gap-2.5 text-faint text-ui">
+ {error ?? (
+ <>
+ <span className="w-[12px] h-[12px] rounded-full border-[1.5px] border-faint border-t-transparent animate-spin" />
+ {machine ? t("settingsx.persona.loading_from", { name: machine.name }) : t("persona.loading")}
+ </>
+ )}
+ </div>
</main>
);
}
@@ -182,13 +195,13 @@ export function PersonaView({
{/* identity + enable (no coworker glyph — owner 2026-08-21) */}
<header className="flex items-start gap-3.5">
<div className="min-w-0">
- <h1 className="text-[20px] font-semibold tracking-tight">
+ <h1 className="text-title font-semibold tracking-tight">
{fullPersonaName(detail.name, personaId)}
</h1>
- <p className="text-[13px] text-muted mt-0.5">{detail.tagline}</p>
+ <p className="text-ui text-muted mt-0.5">{detail.tagline}</p>
</div>
<div className="ml-auto flex items-center gap-2">
- <span className="text-[12px] text-muted">{detail.enabled ? t("persona.enabled") : t("persona.disabled")}</span>
+ <span className="text-meta text-muted">{detail.enabled ? t("persona.enabled") : t("persona.disabled")}</span>
<Toggle checked={detail.enabled} onChange={toggleEnabled} title={t("persona.enable_title")} />
</div>
</header>
@@ -198,7 +211,7 @@ export function PersonaView({
<section>
<div className={`${SEC_H} mb-1.5`}>{t("persona.about")}</div>
{detail.description && (
- <div className="text-[14px] leading-relaxed text-ink/90">
+ <div className="text-body leading-relaxed text-ink/90">
<Markdown text={detail.description} />
</div>
)}
@@ -254,7 +267,7 @@ export function PersonaView({
<section>
<div className={`${SEC_H} mb-1.5 flex items-baseline`}>
<span>{t("persona.connectors")}</span>
- <span className="ml-auto flex font-semibold text-[11px] text-faint normal-case tracking-normal">
+ <span className="ml-auto flex font-semibold text-label text-faint normal-case tracking-normal">
<span className={COL_STATUS}>{t("persona.col_status")}</span>
<span className={COL_ENABLE}>{t("persona.col_enable")}</span>
</span>
@@ -265,18 +278,18 @@ export function PersonaView({
<ConnectorBadge connector={visualFor(r.ref, r.kind, byName)} size={32} />
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
- <span className="text-[13px] font-medium">{labelFor(r.ref, byName)}</span>
+ <span className="text-ui font-medium">{labelFor(r.ref, byName)}</span>
{r.kind === "mcp" ? (
<span className={TAG_MCP}>MCP</span>
) : r.tier === "core" ? (
<span className={TAG_CORE}>{t("persona.core_tag")}</span>
) : null}
</div>
- {r.reason && <div className="text-[12px] text-muted">{r.reason}</div>}
+ {r.reason && <div className="text-meta text-muted">{r.reason}</div>}
</div>
<span className={COL_STATUS}>
{r.connected ? (
- <span className="text-[11px] font-medium px-2 py-0.5 rounded-full bg-okSoft text-ok border border-okLine">
+ <span className="text-label font-medium px-2 py-0.5 rounded-full bg-okSoft text-ok border border-okLine">
{t("persona.connected")}
</span>
) : (
@@ -301,13 +314,13 @@ export function PersonaView({
}
/>
) : (
- <span className="text-faint text-[11px]">—</span>
+ <span className="text-faint text-label">—</span>
)}
</span>
</div>
))}
</div>
- <p className="text-[12px] text-faint mt-1.5 px-1">
+ <p className="text-meta text-faint mt-1.5 px-1">
{t("persona.defaults_footnote")}
</p>
</section>
@@ -328,11 +341,11 @@ export function PersonaView({
size={12}
className={"text-faint transition-transform" + (showTools ? " rotate-90" : "")}
/>
- <span className="text-[13px]">{t("persona.tool_calls")}</span>
- <span className="ml-auto text-[12px] text-faint">{detail.tools.length}</span>
+ <span className="text-ui">{t("persona.tool_calls")}</span>
+ <span className="ml-auto text-meta text-faint">{detail.tools.length}</span>
</button>
{showTools && (
- <div className="px-4 pb-3 font-mono text-[12px] text-muted">
+ <div className="px-4 pb-3 font-mono text-meta text-muted">
{detail.tools.join(" · ")}
</div>
)}
@@ -341,7 +354,7 @@ export function PersonaView({
)}
{/* defaults footer */}
- <section className="flex flex-wrap gap-x-8 gap-y-2 text-[13px]">
+ <section className="flex flex-wrap gap-x-8 gap-y-2 text-ui">
{detail.recommended_models.length > 0 && (
<div>
<span className="text-faint">{t("persona.models_label")}</span> ·{" "}
@@ -365,7 +378,7 @@ export function PersonaView({
</section>
{/* management — the controls that left the list page (UX-035) */}
- <section className="border-t border-line pt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-[13px]">
+ <section className="border-t border-line pt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-ui">
<label className="flex items-center gap-2 text-muted select-none">
<input
type="checkbox"
@@ -384,7 +397,7 @@ export function PersonaView({
>
{detail.default ? t("persona.default_for_new") : t("persona.make_default")}
</button>
- {!detail.builtin && (
+ {!detail.builtin && !machine && (
<button className={BTN_BORDERED} data-testid="persona-export" onClick={exportBundle}>
{t("persona.export")}
</button>
@@ -393,10 +406,10 @@ export function PersonaView({
(confirmDel ? (
<span className="flex items-center gap-1.5">
<button
- className="text-[12px] px-2.5 py-1.5 rounded-lg bg-danger text-white"
+ className="text-meta px-2.5 py-1.5 rounded-lg bg-danger text-white"
data-testid="persona-delete-confirm"
onClick={async () => {
- const r = await deletePersona(personaId);
+ const r = await deletePersona(personaId, mid);
if (r.ok) onBack?.();
else setMsg(r.error || t("persona.delete_failed"));
}}
@@ -409,7 +422,7 @@ export function PersonaView({
</span>
) : (
<button
- className="text-[13px] text-danger/80 hover:text-danger"
+ className="text-ui text-danger/80 hover:text-danger"
data-testid="persona-delete"
onClick={() => setConfirmDel(true)}
>
diff --git a/surfaces/gui/src/components/PersonasTab.tsx b/surfaces/gui/src/components/PersonasTab.tsx
index ff810e32..6ac69022 100644
--- a/surfaces/gui/src/components/PersonasTab.tsx
+++ b/surfaces/gui/src/components/PersonasTab.tsx
@@ -1,13 +1,17 @@
import { useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import {
+ getMachineSessionsList,
getPersonasIndex,
getSessions,
installPersona,
updatePersona,
+ type Machine,
type Persona,
type PersonaConsent,
} from "../api";
+import { useMachineData } from "../useMachineData";
+import { CachedNote, LoadingRow, UnreachableRow } from "./ScopedStatus";
import { chooseFolder } from "../tauri";
import type { SessionInfo } from "../types";
import { Icon } from "./Icon";
@@ -18,18 +22,26 @@ import { Toggle } from "./Toggle";
// per-coworker detail page. Unshipped coworkers (ships:false) and the installer are quiet
// text disclosures at the bottom; Folder/Zip install through native pickers.
const CARD = "rounded-xl2 border border-line bg-panel";
-const SELECT = "px-2.5 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink shrink-0";
+const SELECT = "px-2.5 py-2 rounded-lg border border-line bg-paper text-ui text-ink shrink-0";
const INPUT =
- "flex-1 min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent";
-const BTN_ACCENT = "text-[13px] px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
+ "flex-1 min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent";
+const BTN_ACCENT = "text-ui px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
const BTN_BORDERED =
- "text-[13px] px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0 disabled:opacity-40 disabled:hover:border-line";
+ "text-ui px-2.5 py-1.5 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0 disabled:opacity-40 disabled:hover:border-line";
const QUIET_ROW =
- "w-full flex items-center gap-2 px-4 pt-2 mt-6 text-[13px] text-muted select-none";
+ "w-full flex items-center gap-2 px-4 pt-2 mt-6 text-ui text-muted select-none";
-export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) => void }) {
+export function PersonasTab({
+ onOpenPersona,
+ machine,
+}: {
+ onOpenPersona?: (id: string) => void;
+ // UX-046 machine scope: manage THIS machine's coworkers through the proxy.
+ machine?: Machine | null;
+}) {
const { t } = useTranslation();
+ const mid = machine?.id ?? null;
const [personas, setPersonas] = useState<Persona[]>([]);
const [internal, setInternal] = useState(false);
const [mode, setMode] = useState<"git" | "dir" | "zip">("git");
@@ -58,18 +70,20 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
return () => window.removeEventListener("ocw-focus-import", focus);
}, []);
- const reload = () =>
- getPersonasIndex()
- .then((r) => {
- setPersonas(r.personas);
- setInternal(r.internal);
- })
- .catch(() => {});
- const reloadSessions = () => getSessions().then(setSessions).catch(() => {});
+ const index = useMachineData(`personas:${mid ?? "local"}`, () => getPersonasIndex(mid));
+ useEffect(() => {
+ if (index.data) {
+ setPersonas(index.data.personas);
+ setInternal(index.data.internal);
+ }
+ }, [index.data]);
+ const reload = index.refresh;
+ const reloadSessions = () =>
+ (mid ? getMachineSessionsList(mid) : getSessions()).then(setSessions).catch(() => {});
useEffect(() => {
- reload();
reloadSessions();
- }, []);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [mid]);
// Real conversations the disable would archive (unarchived; run sessions are server-hidden).
const liveCount = (id: string) =>
@@ -79,7 +93,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
id: string,
body: { enabled?: boolean; surfaced?: boolean; default?: boolean },
) => {
- const r = await updatePersona(id, body);
+ const r = await updatePersona(id, body, mid);
if (r.personas) setPersonas(r.personas);
else reload();
if (body.enabled === false) reloadSessions(); // counts just changed
@@ -109,7 +123,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
setBusy(true);
setMsg(null);
setConsent(null);
- finishInstall(await installPersona({ dir }));
+ finishInstall(await installPersona({ dir }, mid));
};
const installZip = async (file: File) => {
@@ -120,7 +134,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
let bin = "";
for (let i = 0; i < buf.length; i += 0x8000)
bin += String.fromCharCode(...buf.subarray(i, i + 0x8000));
- finishInstall(await installPersona({ zip_b64: btoa(bin), filename: file.name }));
+ finishInstall(await installPersona({ zip_b64: btoa(bin), filename: file.name }, mid));
};
const install = async () => {
@@ -128,7 +142,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
setBusy(true);
setMsg(null);
setConsent(null);
- const r = await installPersona({ git_url: src.trim() });
+ const r = await installPersona({ git_url: src.trim() }, mid);
setBusy(false);
if (!r.ok) {
setMsg(r.error || t("personas.install_failed"));
@@ -147,22 +161,22 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
return (
<div className={title ? "mt-7" : "mt-1.5"}>
{title && (
- <div className="text-[12px] font-semibold text-muted px-4 mb-1.5">{title}</div>
+ <div className="text-meta font-semibold text-muted px-4 mb-1.5">{title}</div>
)}
<div className={CARD + " divide-y divide-line"}>
{list.map((p) => (
<div key={p.id} className="px-[18px] py-4">
<div className="flex items-center gap-3">
<div className="min-w-0 flex-1">
- <div className="text-[14px] font-medium truncate">{p.name}</div>
- <div className="text-[12px] text-faint truncate mt-0.5">{p.tagline}</div>
+ <div className="text-body font-medium truncate">{p.name}</div>
+ <div className="text-meta text-faint truncate mt-0.5">{p.tagline}</div>
</div>
{p.default ? (
/* The default coworker cannot be disabled or hidden — no toggle, no
configure; a quiet tag says why (owner 2026-08-21). It regains its
controls the moment another coworker is made default. */
<span
- className="text-[11px] font-medium px-2 py-0.5 rounded-full bg-paper border border-lineStrong text-muted shrink-0"
+ className="text-label font-medium px-2 py-0.5 rounded-full bg-paper border border-lineStrong text-muted shrink-0"
title={t("personas.default_for_new")}
data-testid="persona-default-tag"
>
@@ -193,14 +207,14 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
</div>
{confirmOff === p.id && (
<div
- className="mt-2 flex items-center gap-2.5 text-[12px] text-muted"
+ className="mt-2 flex items-center gap-2.5 text-meta text-muted"
data-testid={`persona-disable-warning-${p.id}`}
>
<span className="min-w-0">
{t("personas.disable_warning", { count: liveCount(p.id) })}
</span>
<button
- className="text-[12px] px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0"
+ className="text-meta px-2.5 py-1.5 rounded-lg bg-accent text-white shrink-0"
data-testid={`persona-disable-confirm-${p.id}`}
onClick={() => {
setConfirmOff(null);
@@ -223,6 +237,18 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
return (
<div>
+ {index.cachedAt ? <CachedNote at={index.cachedAt} /> : null}
+ {index.loading && !index.data ? (
+ <LoadingRow
+ what={
+ machine
+ ? t("settingsx.personas.loading_what_on", { name: machine.name })
+ : t("settingsx.personas.loading_what")
+ }
+ />
+ ) : index.error && !index.data && machine ? (
+ <UnreachableRow machineName={machine.name} />
+ ) : null}
{/* One toggle per row (enable implies picker); ★ marks the default. Everything
else — in-picker nuance, default, export, delete — lives on the detail page. */}
{group(t("personas.group_general"), personas.filter((p) => p.ships !== false && p.group !== "security"))}
@@ -241,7 +267,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
className={"transition-transform" + (showUnshipped ? " rotate-90" : "")}
/>
<span>{t("personas.unshipped_row", { count: unshipped.length })}</span>
- <span className="ml-auto text-faint text-[12px]">
+ <span className="ml-auto text-faint text-meta">
{internal ? t("personas.internal_build") : t("personas.not_in_release")}
</span>
</button>
@@ -261,7 +287,9 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
className={"transition-transform" + (showInstall ? " rotate-90" : "")}
/>
<span>{t("personas.install_coworker")}</span>
- <span className="ml-auto text-faint text-[12px]">{t("personas.install_sources")}</span>
+ <span className="ml-auto text-faint text-meta">
+ {machine ? t("settingsx.personas.install_sources_machine") : t("personas.install_sources")}
+ </span>
</button>
{showInstall && (
<div className={CARD + " mt-1.5 p-4"}>
@@ -272,7 +300,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
onChange={(e) => setMode(e.target.value as "git" | "dir" | "zip")}
>
<option value="git">{t("personas.mode_github")}</option>
- <option value="dir">{t("personas.mode_local")}</option>
+ {!machine && <option value="dir">{t("personas.mode_local")}</option>}
<option value="zip">{t("personas.mode_zip")}</option>
</select>
{mode === "git" ? (
@@ -298,7 +326,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
>
{busy ? t("personas.installing") : t("personas.choose_folder")}
</button>
- <span className="text-[12px] text-faint">
+ <span className="text-meta text-faint">
{t("personas.dir_picker_note")}
</span>
</>
@@ -320,13 +348,13 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
</label>
)}
</div>
- <div className="flex items-start gap-2 mt-3 text-[12px] text-muted leading-relaxed">
+ <div className="flex items-start gap-2 mt-3 text-meta text-muted leading-relaxed">
<span className="text-warnInk shrink-0">⚠</span>
<span>{t("personas.install_trust_note")}</span>
</div>
</div>
)}
- {msg && <div className="text-[13px] text-muted mt-2.5">{msg}</div>}
+ {msg && <div className="text-ui text-muted mt-2.5">{msg}</div>}
{consent && consent.length > 0 && (
<div className="mt-4 space-y-2" data-testid="consent-review">
@@ -334,7 +362,7 @@ export function PersonasTab({ onOpenPersona }: { onOpenPersona?: (id: string) =>
are a one-line summary with the exact tools under a collapsed chevron. A
coworker runs no third-party code, so this list is complete — but a prompt
still steers an agent, so who it came from genuinely matters. */}
- <div className="flex items-start gap-2.5 rounded-xl border border-warnInk/30 bg-warnSoft px-3.5 py-2.5 text-[13px] text-warnInk">
+ <div className="flex items-start gap-2.5 rounded-xl border border-warnInk/30 bg-warnSoft px-3.5 py-2.5 text-ui text-warnInk">
<Icon name="shield" size={15} className="shrink-0 mt-0.5" />
<span>{t("personas.install_shield_warning")}</span>
</div>
@@ -382,13 +410,13 @@ function ConsentCard({
const recommends = c.recommends || [];
return (
<div className={CARD + " p-3.5"} data-testid={`consent-${c.id}`}>
- <div className="text-[13px] font-medium flex items-center gap-2">
+ <div className="text-ui font-medium flex items-center gap-2">
<span>{c.name}</span>
- {c.version && <span className="text-[11px] text-faint font-normal">v{c.version}</span>}
+ {c.version && <span className="text-label text-faint font-normal">v{c.version}</span>}
</div>
- {c.description && <div className="text-[12px] text-muted mt-0.5">{c.description}</div>}
+ {c.description && <div className="text-meta text-muted mt-0.5">{c.description}</div>}
{c.replaces && (
- <div className="text-[12px] text-muted mt-1.5" data-testid="replaces-note">
+ <div className="text-meta text-muted mt-1.5" data-testid="replaces-note">
{t("personas.consent_replaces", { name: c.name })}
{c.replaces.version ? ` v${c.replaces.version}` : ""}
{c.replaces.installed_at ? " " + t("personas.consent_installed_at", { date: c.replaces.installed_at }) : ""}.
@@ -397,7 +425,7 @@ function ConsentCard({
: " " + t("personas.consent_caps_same")}
</div>
)}
- <div className="text-[13px] text-ink mt-2">
+ <div className="text-ui text-ink mt-2">
{t("personas.consent_can", { summary })}
{c.connectors === "all"
? " " + t("personas.consent_all_connectors")
@@ -407,7 +435,7 @@ function ConsentCard({
{c.messaging ? " " + t("personas.consent_send_messages") : ""}
{c.mcp.length ? " " + t("personas.consent_use_mcp", { list: c.mcp.join(", ") }) : ""}
<button
- className="ml-2 text-accent text-[12px] hover:underline"
+ className="ml-2 text-accent text-meta hover:underline"
data-testid="consent-tools-toggle"
onClick={() => setShowTools((v) => !v)}
>
@@ -415,12 +443,12 @@ function ConsentCard({
</button>
</div>
{showTools && (
- <div className="text-[12px] text-muted mt-1 font-mono">{c.tools.join(" · ") || "—"}</div>
+ <div className="text-meta text-muted mt-1 font-mono">{c.tools.join(" · ") || "—"}</div>
)}
{recommends.length > 0 && (
<div className="mt-2 space-y-0.5">
{recommends.map((r) => (
- <div key={r.kind + r.ref} className="text-[12px] text-muted">
+ <div key={r.kind + r.ref} className="text-meta text-muted">
<span className="text-ink">{r.ref}</span>
{r.tier === "core"
? " " + t("personas.consent_recommended_tag")
@@ -434,7 +462,7 @@ function ConsentCard({
{/* Enable right here (owner ask 2026-08-11) — the old "enable it above" copy
sent the user hunting back up the list. */}
{enabled ? (
- <span className="text-[13px] text-muted" data-testid="consent-enabled">
+ <span className="text-ui text-muted" data-testid="consent-enabled">
{t("personas.consent_enabled_note")}
</span>
) : (
@@ -450,7 +478,7 @@ function ConsentCard({
{busy ? t("personas.enabling") : t("personas.enable_coworker")}
</button>
)}
- <span className="text-[12px] text-faint">
+ <span className="text-meta text-faint">
{t("personas.consent_recommended_mode", { mode: c.recommended_mode })}
</span>
</div>
diff --git a/surfaces/gui/src/components/RemoteConnectorsPanel.tsx b/surfaces/gui/src/components/RemoteConnectorsPanel.tsx
new file mode 100644
index 00000000..b2c8c7e8
--- /dev/null
+++ b/surfaces/gui/src/components/RemoteConnectorsPanel.tsx
@@ -0,0 +1,805 @@
+import { useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import {
+ beginBrowserManagedConnect,
+ beginManagedConnectOnMachine,
+ connectManagedGrantSealed,
+ getCloudBase,
+ isCloudMode,
+ connectConnectorSealed,
+ delegateConnection,
+ delegateConnector,
+ deployMachineSecrets,
+ deploySealedSecrets,
+ disconnectConnector,
+ forgetConnectorLocal,
+ forgetConnectorOnMachine,
+ forgetHolder,
+ getCloudConnections,
+ getConnectorHandoffInfo,
+ getConnectors,
+ getMachineConnectorsStrict,
+ getInboxRouting,
+ getMachines,
+ getRecentChannels,
+ handoffSealedFromMachine,
+ hasWallet,
+ revokeCloudConnections,
+ setInboxBinding,
+ updateConnectorTools,
+ type CloudConnection,
+ type Connector,
+ type Machine,
+} from "../api";
+import { sealTo } from "../seal";
+import { ConnectorBadge } from "../connectors/ConnectorIcon";
+import { useMachineData } from "../useMachineData";
+import { CachedNote, LoadingRow, UnreachableRow } from "./ScopedStatus";
+import { FOOT, GRP, GRP_H, PILL_ACCENT, PILL_LINE, TAG_QUIET } from "./connectors/ui";
+
+// Settings ▸ Connectors under a MACHINE scope (union view): that machine's
+// own connector list, with the flows a headless box can actually run.
+// Manual token connect seals the fields IN THIS TAB to the machine's pinned
+// key — the desktop's acceptor or our cloud only ever relays ciphertext, and
+// the box validates exactly as if the token were typed locally. Anything
+// needing a browser sign-in (managed OAuth, MCP OAuth) stays on the
+// controller's own scope; those connectors show why instead of a dead button.
+
+const ROW = "flex items-start gap-3 px-4 py-3";
+
+// Inbound connectors get a Configure link to their glance page (UX-049).
+const INBOUND = new Set(["slack", "github"]);
+
+/** The broker's machine id for a GUI machine row: cloud rows carry the
+ * `cloud:` prefix the broker never sees; local-registry machines are
+ * unknown to the broker (their delegation is the anonymous holder). */
+function brokerMachineId(m: Machine): string {
+ if (m.origin === "cloud") return m.id.replace(/^cloud:/, "");
+ // On the hosted dashboard every row is a cloud machine and ids carry no prefix.
+ return isCloudMode() ? m.id : "";
+}
+
+export function RemoteConnectorsPanel({
+ machine,
+ onConfigure,
+}: {
+ machine: Machine;
+ // Opens the connector's glance page (Settings ▸ Slack / GitHub).
+ onConfigure?: (name: string) => void;
+}) {
+ const { t } = useTranslation();
+ const { data, cachedAt, loading, error, refresh } = useMachineData<Connector[]>(
+ `connectors:${machine.id}`,
+ // Strict variant, and it must live in api.ts: a component-level fetch
+ // bypasses the module's auth wrapper (no sidecar token — found live).
+ () => getMachineConnectorsStrict(machine.id),
+ );
+ const [open, setOpen] = useState<string | null>(null);
+ // Which connectors THIS controller holds a grant for — feeds the "Move
+ // from This Mac" affordance on rows the machine doesn't have yet.
+ const [localConnected, setLocalConnected] = useState<Set<string>>(new Set());
+ // The cloud's view (UX-049): which of the user's machines hold each grant,
+ // so a connector held elsewhere offers Enable here instead of a new sign-in.
+ const [cloudConns, setCloudConns] = useState<Record<string, CloudConnection>>({});
+ const [machines, setMachines] = useState<Machine[]>([]);
+ const loadCloud = () => {
+ getCloudConnections()
+ .then((rows) => {
+ const map: Record<string, CloudConnection> = {};
+ for (const r of rows) if (r.status !== "disconnected") map[r.connector] = r;
+ setCloudConns(map);
+ })
+ .catch(() => {});
+ getMachines()
+ .then((r) => setMachines(r.machines))
+ .catch(() => {});
+ };
+ useEffect(() => {
+ getConnectors()
+ .then((cs) =>
+ setLocalConnected(new Set(cs.filter((c) => c.connected).map((c) => c.name))),
+ )
+ .catch(() => {});
+ loadCloud();
+ }, []);
+
+ if (loading && !data) return <LoadingRow what={t("machines.connectors.loading_what", { name: machine.name })} />;
+ if (error && !data) return <UnreachableRow machineName={machine.name} />;
+
+ const connectors = data ?? [];
+ const connected = connectors.filter((c) => c.connected);
+ const mine = brokerMachineId(machine);
+ // Held on another machine: the cloud lists a holder that is not this machine,
+ // or This Mac holds it. Those rows get Enable (copy) or Move here.
+ const heldElsewhere = (c: Connector): boolean => {
+ if (localConnected.has(c.name)) return true;
+ const cc = cloudConns[c.name];
+ return !!cc && cc.holders.some((h) => h.machine_id && h.machine_id !== mine);
+ };
+ const notHere = connectors.filter((c) => !c.connected && c.available);
+ const held = notHere.filter(heldElsewhere);
+ const available = notHere.filter((c) => !heldElsewhere(c));
+ const refreshAll = () => {
+ refresh();
+ loadCloud();
+ };
+
+ return (
+ <div>
+ {loading && cachedAt ? <CachedNote at={cachedAt} /> : null}
+
+ {connected.length > 0 && (
+ <>
+ <div className={GRP_H}>{t("machines.connectors.connected_here")}</div>
+ <div className={GRP}>
+ {connected.map((c) => (
+ <ConnectedRow
+ key={c.name}
+ c={c}
+ machine={machine}
+ cloud={cloudConns[c.name]}
+ machines={machines}
+ open={open === c.name}
+ onToggle={() => setOpen(open === c.name ? null : c.name)}
+ onChanged={refreshAll}
+ onConfigure={onConfigure}
+ />
+ ))}
+ </div>
+ </>
+ )}
+
+ {held.length > 0 && (
+ <>
+ <div className={GRP_H}>{t("machines.connectors.held_elsewhere")}</div>
+ <div className={GRP}>
+ {held.map((c) => (
+ <HeldRow
+ key={c.name}
+ c={c}
+ machine={machine}
+ cloud={cloudConns[c.name]}
+ machines={machines}
+ localConnected={localConnected.has(c.name)}
+ onConnected={refreshAll}
+ />
+ ))}
+ </div>
+ <div className={FOOT}>
+ {t("machines.connectors.held_foot")}
+ </div>
+ </>
+ )}
+
+ <div className={GRP_H}>{t("machines.connectors.available")}</div>
+ <div className={GRP}>
+ {available.map((c) => (
+ <AvailableRow
+ key={c.name}
+ c={c}
+ machine={machine}
+ localConnected={false}
+ open={open === c.name}
+ onToggle={() => setOpen(open === c.name ? null : c.name)}
+ onConnected={refreshAll}
+ />
+ ))}
+ </div>
+ <div className={FOOT}>
+ {t("machines.connectors.tokens_foot")}
+ </div>
+ </div>
+ );
+}
+
+function ConnectedRow({
+ c,
+ machine,
+ cloud,
+ machines,
+ open,
+ onToggle,
+ onChanged,
+ onConfigure,
+}: {
+ c: Connector;
+ machine: Machine;
+ cloud?: CloudConnection;
+ machines: Machine[];
+ open: boolean;
+ onToggle: () => void;
+ onChanged: () => void;
+ onConfigure?: (name: string) => void;
+}) {
+ const { t } = useTranslation();
+ const [busy, setBusy] = useState(false);
+ const tools = c.tools || [];
+ const mine = brokerMachineId(machine);
+ const nameOf = (id: string) =>
+ id === "desktop" ? t("machines.this_mac") : machines.find((m) => brokerMachineId(m) === id)?.name || id;
+ const others = (cloud?.holders || [])
+ .map((h) => h.machine_id)
+ .filter((id) => id && id !== mine)
+ .map(nameOf);
+ const defaultName = cloud?.default_machine_id
+ ? nameOf(cloud.default_machine_id)
+ : cloud?.holders?.[0]?.machine_id
+ ? nameOf(cloud.holders[0].machine_id)
+ : "";
+
+ const disconnect = async () => {
+ // Disconnect HERE (UX-049): this machine's copy goes and its holder note
+ // at the broker with it; other holders keep working. Only the last copy
+ // of a managed grant ends the connection at the broker.
+ const last = !cloud || cloud.holders.filter((h) => h.machine_id && h.machine_id !== mine).length === 0;
+ const what = last
+ ? t("machines.connectors.confirm_disconnect_last", { title: c.title, name: machine.name })
+ : t("machines.connectors.confirm_disconnect_here", { title: c.title, name: machine.name });
+ if (!window.confirm(what)) return;
+ setBusy(true);
+ await disconnectConnector(c.name, machine.id);
+ if (cloud && mine && !last) await forgetHolder(cloud.connection_id, mine).catch(() => {});
+ else if (c.managed_profile || c.managed) await revokeCloudConnections(c.name).catch(() => {});
+ setBusy(false);
+ onChanged();
+ };
+
+ const flipTool = async (name: string, enabled: boolean) => {
+ await updateConnectorTools(c.name, { [name]: enabled }, machine.id);
+ onChanged();
+ };
+
+ return (
+ <div data-testid={`remote-connector-${c.name}`}>
+ <div className={ROW}>
+ <ConnectorBadge connector={c} size={32} title={c.title} />
+ <div className="min-w-0 flex-1">
+ <div className="text-ui font-medium text-ink">{c.title}</div>
+ <div className="text-meta text-muted truncate" data-testid={`remote-holders-${c.name}`}>
+ {c.account ? c.account : t("machines.connectors.connected")}
+ {others.length > 0 &&
+ " · " + t("machines.connectors.also_on", { machines: others.join(", ") })}
+ {INBOUND.has(c.name) &&
+ defaultName &&
+ " · " + t("machines.connectors.answers_default", { name: defaultName })}
+ </div>
+ </div>
+ {tools.length > 0 && (
+ <button className={PILL_LINE} onClick={onToggle}>
+ {t("machines.connectors.tools", { count: tools.length })}
+ </button>
+ )}
+ {c.name === "slack" && <ApprovalsRouting machine={machine} />}
+ {INBOUND.has(c.name) && onConfigure && (
+ <button
+ className="text-ui text-accent px-2 py-1.5"
+ onClick={() => onConfigure(c.name)}
+ data-testid={`remote-configure-${c.name}`}
+ >
+ {t("inbox.configure_arrow")}
+ </button>
+ )}
+ <button
+ className="text-meta text-red-600 px-2 py-1.5"
+ onClick={() => void disconnect()}
+ disabled={busy}
+ data-testid={`remote-disconnect-${c.name}`}
+ >
+ {others.length > 0 ? t("machines.connectors.disconnect_here") : t("connector.disconnect")}
+ </button>
+ </div>
+ {open && tools.length > 0 && (
+ <div className="px-4 pb-3 space-y-1.5">
+ {tools.map((tool) => (
+ <label key={tool.name} className="flex items-start gap-2.5 text-meta">
+ <input
+ type="checkbox"
+ className="mt-0.5"
+ checked={tool.enabled}
+ onChange={(e) => void flipTool(tool.name, e.target.checked)}
+ />
+ <span>
+ <span className="text-ink">{tool.label}</span>
+ <span className="block text-muted">{tool.description}</span>
+ </span>
+ </label>
+ ))}
+ </div>
+ )}
+ </div>
+ );
+}
+
+/** Approvals routing is PER MACHINE (UX-049 third review): where this
+ * machine's sessions mirror their Inbox approvals — in-app, or a Slack
+ * channel the machine has seen. Lives on the row, not the glance page. */
+export function ApprovalsRouting({ machine }: { machine?: Machine | null }) {
+ const { t } = useTranslation();
+ const [target, setTarget] = useState<string>("");
+ const [channels, setChannels] = useState<{ channel: string; name?: string | null }[]>([]);
+ const mid = machine?.id ?? null;
+ const load = () => {
+ getInboxRouting(mid)
+ .then((bs) => {
+ const b = bs.find((x) => x.name === "slack");
+ setTarget(b && b.channel ? `slack:${b.target}` : "");
+ })
+ .catch(() => {});
+ getRecentChannels(mid).then(setChannels).catch(() => setChannels([]));
+ };
+ useEffect(load, [mid]);
+ const change = async (v: string) => {
+ setTarget(v);
+ if (!v) await setInboxBinding("slack", null, "", mid);
+ else await setInboxBinding("slack", "slack", v.replace(/^slack:/, ""), mid);
+ load();
+ };
+ return (
+ <span className="flex items-center gap-1.5 text-meta text-muted" title={t("machines.connectors.approvals_title")}>
+ {t("machines.connectors.approvals_arrow")}
+ <select
+ className="text-meta px-1.5 py-0.5 rounded-md border border-line bg-paper text-ink outline-none max-w-[140px]"
+ value={target}
+ onChange={(e) => void change(e.target.value)}
+ onClick={(e) => e.stopPropagation()}
+ onKeyDown={(e) => e.stopPropagation()}
+ data-testid="remote-approvals-slack"
+ >
+ <option value="">{t("machines.connectors.in_app")}</option>
+ {channels
+ .filter((ch) => ch.channel.startsWith("slack:"))
+ .map((ch) => (
+ <option key={ch.channel} value={ch.channel}>
+ {ch.name ? `#${ch.name}` : ch.channel}
+ </option>
+ ))}
+ {target && !channels.some((ch) => ch.channel === target) && <option value={target}>{target}</option>}
+ </select>
+ </span>
+ );
+}
+
+/** A connector another of the user's machines already holds (UX-049):
+ * Enable = copy it here, no sign-in; Move here = copy then the source
+ * forgets. Rotating providers cannot be copied and keep the sign-in. */
+function HeldRow({
+ c,
+ machine,
+ cloud,
+ machines,
+ localConnected,
+ onConnected,
+}: {
+ c: Connector;
+ machine: Machine;
+ cloud?: CloudConnection;
+ machines: Machine[];
+ localConnected: boolean;
+ onConnected: () => void;
+}) {
+ const { t } = useTranslation();
+ const [busy, setBusy] = useState<"" | "enable" | "move">("");
+ const [error, setError] = useState<string | null>(null);
+ const mine = brokerMachineId(machine);
+ const copyable = cloud ? cloud.copyable : true;
+ // Where the copy comes from: This Mac when it holds the grant (the wallet
+ // path), else the first other holder the broker lists (box-to-box).
+ const sourceHolder = (cloud?.holders || []).find((h) => h.machine_id && h.machine_id !== mine);
+ const sourceMachine = sourceHolder
+ ? machines.find((m) => brokerMachineId(m) === sourceHolder.machine_id)
+ : undefined;
+ const sourceName = localConnected
+ ? t("machines.this_mac")
+ : sourceMachine?.name || sourceHolder?.machine_id || t("machines.connectors.another_machine");
+ const account = cloud?.provider_account ? `${cloud.provider_account} · ` : "";
+
+ const enable = async (move: boolean) => {
+ setError(null);
+ const pub = machine.seal_pubkey || "";
+ if (!pub) {
+ setError(t("machines.connectors.no_seal_key"));
+ return;
+ }
+ setBusy(move ? "move" : "enable");
+ try {
+ if (localConnected) {
+ // Desktop → machine: the existing handoff, minus the forget for Enable.
+ const info = await getConnectorHandoffInfo(c.name);
+ if (!info.ok || !info.portable || !info.profiles?.length) {
+ setError(
+ info.reason === "refresh_binding"
+ ? t("machines.connectors.cant_copy_refresh", { title: c.title })
+ : t("machines.connectors.cant_copy", { title: c.title }),
+ );
+ return;
+ }
+ if (info.needs_delegation) {
+ const grant = await delegateConnector(c.name, pub, mine || undefined);
+ if (!grant.ok) {
+ setError(grant.error || t("machines.connectors.delegate_failed"));
+ return;
+ }
+ }
+ const res = await deployMachineSecrets(machine.id, info.profiles);
+ if (res.error) {
+ setError(res.error);
+ return;
+ }
+ if (move) await forgetConnectorLocal(c.name);
+ } else {
+ if (!cloud || !sourceHolder || !sourceMachine) {
+ setError(t("machines.connectors.holder_unreachable", { title: c.title }));
+ return;
+ }
+ // Machine → machine: a grant for this machine, then the source seals
+ // its copy to this machine's key; the cloud relays ciphertext only.
+ const grant = await delegateConnection(cloud.connection_id, pub, mine);
+ if (!grant.ok) {
+ setError(grant.error || t("machines.connectors.delegate_failed"));
+ return;
+ }
+ const sealed = await handoffSealedFromMachine(sourceMachine.id, c.name, pub, {
+ user_id: grant.user_id,
+ machine_credential: grant.machine_credential,
+ });
+ if (!sealed.ok || !sealed.sealed_b64) {
+ setError(sealed.error || t("machines.connectors.cant_copy_from", { title: c.title, source: sourceName }));
+ return;
+ }
+ const res = await deploySealedSecrets(machine.id, sealed.sealed_b64, sealed.profiles || [], {});
+ if (res.error) {
+ setError(res.error);
+ return;
+ }
+ if (move) {
+ await forgetConnectorOnMachine(sourceMachine.id, c.name).catch(() => {});
+ await forgetHolder(cloud.connection_id, sourceHolder.machine_id).catch(() => {});
+ }
+ }
+ onConnected();
+ } finally {
+ setBusy("");
+ }
+ };
+
+ return (
+ <div data-testid={`remote-held-${c.name}`}>
+ <div className={ROW}>
+ <ConnectorBadge connector={c} size={32} title={c.title} />
+ <div className="min-w-0 flex-1">
+ <div className="text-ui font-medium text-ink">{c.title}</div>
+ <div className="text-meta text-muted truncate">
+ {account}
+ {t("machines.connectors.held_on", { source: sourceName })}
+ {!copyable && " · " + t("machines.connectors.separate_signin")}
+ </div>
+ </div>
+ {copyable ? (
+ <>
+ <button
+ className={PILL_ACCENT}
+ onClick={() => void enable(false)}
+ disabled={!!busy}
+ title={t("machines.connectors.enable_title")}
+ data-testid={`remote-enable-${c.name}`}
+ >
+ {busy === "enable" ? t("machines.connectors.enabling") : t("machines.connectors.enable")}
+ </button>
+ <button
+ className="text-meta text-muted px-2 py-1.5"
+ onClick={() => void enable(true)}
+ disabled={!!busy}
+ data-testid={`remote-move-${c.name}`}
+ >
+ {busy === "move" ? t("machines.connectors.moving") : t("machines.connectors.move_here")}
+ </button>
+ </>
+ ) : (
+ <RotatingConnect c={c} machine={machine} onConnected={onConnected} />
+ )}
+ </div>
+ {error && <div className="px-4 pb-3 text-meta text-red-600">{error}</div>}
+ </div>
+ );
+}
+
+/** The sign-in for a provider that cannot be copied: the plain available
+ * row's connect affordances, nothing else. */
+function RotatingConnect({ c, machine, onConnected }: { c: Connector; machine: Machine; onConnected: () => void }) {
+ const [open, setOpen] = useState(false);
+ return (
+ <AvailableRow
+ c={c}
+ machine={machine}
+ localConnected={false}
+ open={open}
+ onToggle={() => setOpen(!open)}
+ onConnected={onConnected}
+ bare
+ />
+ );
+}
+
+function AvailableRow({
+ c,
+ machine,
+ localConnected,
+ open,
+ onToggle,
+ onConnected,
+ bare = false,
+}: {
+ c: Connector;
+ machine: Machine;
+ localConnected: boolean;
+ open: boolean;
+ onToggle: () => void;
+ onConnected: () => void;
+ // Render only the connect affordances (hosted inside another row).
+ bare?: boolean;
+}) {
+ const { t } = useTranslation();
+ const [values, setValues] = useState<Record<string, string>>({});
+ const [busy, setBusy] = useState(false);
+ const [moving, setMoving] = useState(false);
+ const [awaiting, setAwaiting] = useState(false);
+ const [error, setError] = useState<string | null>(null);
+ const manual = c.fields.length > 0;
+ // Connect-direct-to-machine: managed OAuth completes in this browser, and
+ // the sidecar ships the grant straight to the machine — so it's a desktop
+ // affordance (the sidecar owns the OAuth loopback). GitHub included: its
+ // callback stages every returned installation (the Move unit) — metadata
+ // plus the machine credential, no secrets.
+ // The hosted dashboard has no sidecar loopback; there the broker hands the
+ // result back to this tab by postMessage and the tab seals it to the
+ // machine (spec §Cloud-dashboard connect-direct).
+ const browserDirect = c.managed && !c.managed_paused && !hasWallet() && isCloudMode() && !!getCloudBase();
+ const directConnect = (c.managed && !c.managed_paused && hasWallet()) || browserDirect;
+
+ // Browser connect-direct: the broker's popup posts the grant back here,
+ // pinned to our origin. Seal it to the machine and relay ciphertext.
+ useEffect(() => {
+ if (!browserDirect || !awaiting) return;
+ const onMessage = async (ev: MessageEvent) => {
+ if (ev.origin !== getCloudBase()) return;
+ const d = ev.data;
+ if (!d || d.type !== "openworker-managed-grant" || d.connector !== c.name) return;
+ if (d.error) {
+ setAwaiting(false);
+ setError(String(d.error));
+ return;
+ }
+ const pub = machine.seal_pubkey || "";
+ const { type: _t, machine_credential, broker_user_id, machine_id: _m, ...form } = d as Record<string, string>;
+ const sealed = sealTo(
+ pub,
+ new TextEncoder().encode(JSON.stringify({ form, machine_credential, broker_user_id })),
+ );
+ const res = await connectManagedGrantSealed(machine.id, c.name, sealed);
+ setAwaiting(false);
+ if (!res.ok) setError(res.error || t("machines.connectors.store_failed"));
+ else onConnected();
+ };
+ window.addEventListener("message", onMessage);
+ return () => window.removeEventListener("message", onMessage);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [browserDirect, awaiting, c.name, machine.id, machine.seal_pubkey]);
+
+ // While the browser flow is out, poll the machine's list so the row flips
+ // to Connected on its own once the grant lands.
+ useEffect(() => {
+ if (!awaiting) return;
+ let ticks = 0;
+ const timer = window.setInterval(() => {
+ onConnected();
+ if (++ticks >= 45) setAwaiting(false); // ~3 min, then stop quietly
+ }, 4000);
+ return () => window.clearInterval(timer);
+ }, [awaiting]);
+
+ const connectInBrowser = async () => {
+ setError(null);
+ if (browserDirect) {
+ const pub = machine.seal_pubkey || "";
+ if (!pub) {
+ setError(t("machines.connectors.no_seal_key"));
+ return;
+ }
+ // Open the popup FIRST (same user gesture) so blockers let it through.
+ const popup = window.open("about:blank", "openworker-connect", "popup,width=640,height=760");
+ const res = await beginBrowserManagedConnect(c.name, machine.id, pub);
+ if (!res.ok || !res.authorize_url) {
+ popup?.close();
+ setError(
+ res.error === "not signed in"
+ ? t("machines.connectors.sign_in_first")
+ : res.error || t("machines.connectors.start_failed"),
+ );
+ return;
+ }
+ if (!popup) {
+ setError(t("machines.connectors.popup_blocked"));
+ return;
+ }
+ popup.location.href = res.authorize_url;
+ setAwaiting(true);
+ return;
+ }
+ const res = await beginManagedConnectOnMachine(machine.id, c.name, machine.name);
+ if (!res.ok) {
+ setError(
+ res.error === "not signed in"
+ ? t("machines.connectors.sign_in_cloud_first")
+ : res.error || t("machines.connectors.start_failed"),
+ );
+ return;
+ }
+ setAwaiting(true);
+ };
+
+ // Grant handoff (one grant, one holder): deploy the connector's profile
+ // keys sealed to this machine, then This Mac forgets its copy. Offered
+ // only when This Mac holds the grant; portability is the server's call
+ // (managed grants wait on the broker's machine-refresh ruling).
+ const move = async () => {
+ setError(null);
+ const info = await getConnectorHandoffInfo(c.name);
+ if (!info.ok || !info.portable || !info.profiles?.length) {
+ setError(
+ info.reason === "refresh_binding"
+ ? t("machines.connectors.cant_move_refresh", { title: c.title })
+ : t("machines.connectors.cant_move", { title: c.title }),
+ );
+ return;
+ }
+ if (
+ !window.confirm(
+ t("machines.connectors.confirm_move", { title: c.title, name: machine.name }),
+ )
+ )
+ return;
+ setMoving(true);
+ // Managed grants first get their broker connections marked machine-held,
+ // so the machine can renew them by possession after the move. The seal
+ // key mints the machine credential too (managed events) — Slack's
+ // inbound follows the grant onto the machine's sealed queue.
+ if (info.needs_delegation) {
+ const grant = await delegateConnector(
+ c.name,
+ machine.seal_pubkey || undefined,
+ machine.origin === "cloud" ? machine.id.replace(/^cloud:/, "") : undefined,
+ );
+ if (!grant.ok) {
+ setMoving(false);
+ setError(grant.error || t("machines.connectors.delegate_failed"));
+ return;
+ }
+ }
+ const res = await deployMachineSecrets(machine.id, info.profiles);
+ if (res.error) {
+ setMoving(false);
+ setError(res.error);
+ return;
+ }
+ // This Mac forgets — LOCAL deletion only; a broker disconnect here would
+ // revoke the delegation the machine now lives on.
+ await forgetConnectorLocal(c.name);
+ setMoving(false);
+ onConnected();
+ };
+
+ const submit = async () => {
+ const pub = machine.seal_pubkey || "";
+ if (!pub) {
+ setError(t("machines.connectors.no_seal_key"));
+ return;
+ }
+ setBusy(true);
+ setError(null);
+ const sealed = sealTo(pub, new TextEncoder().encode(JSON.stringify({ fields: values })));
+ const res = await connectConnectorSealed(machine.id, c.name, sealed);
+ setBusy(false);
+ if (res.ok) {
+ setValues({});
+ onToggle();
+ onConnected();
+ } else setError(res.error || t("machines.connectors.connect_failed"));
+ };
+
+ return (
+ <div data-testid={bare ? undefined : `remote-available-${c.name}`} className={bare ? "contents" : undefined}>
+ <div className={bare ? "contents" : ROW}>
+ {!bare && <ConnectorBadge connector={c} size={32} title={c.title} />}
+ {!bare && (
+ <div className="min-w-0 flex-1">
+ <div className="text-ui font-medium text-ink">{c.title}</div>
+ <div className="text-meta text-muted truncate">{c.blurb}</div>
+ </div>
+ )}
+ {localConnected && (
+ <button
+ className={PILL_LINE}
+ onClick={() => void move()}
+ disabled={moving}
+ data-testid={`remote-move-${c.name}`}
+ >
+ {moving ? t("machines.connectors.moving") : t("machines.connectors.move_from_mac")}
+ </button>
+ )}
+ {directConnect && (
+ <button
+ className={manual ? PILL_LINE : PILL_ACCENT}
+ onClick={() => void connectInBrowser()}
+ disabled={awaiting}
+ data-testid={`remote-connect-browser-${c.name}`}
+ >
+ {awaiting ? t("machines.connectors.waiting_browser") : t("machines.connectors.connect_in_browser")}
+ </button>
+ )}
+ {manual ? (
+ <button
+ className={PILL_ACCENT}
+ onClick={onToggle}
+ data-testid={`remote-connect-${c.name}`}
+ >
+ {t("connector.connect")}
+ </button>
+ ) : !localConnected && !directConnect ? (
+ <span
+ className={TAG_QUIET}
+ title={t("machines.connectors.browser_signin_title", { title: c.title })}
+ >
+ {t("machines.connectors.browser_signin")}
+ </span>
+ ) : null}
+ </div>
+ {awaiting && (
+ <div className="px-4 pb-3 text-meta text-muted">
+ {t("machines.connectors.awaiting_note", { name: machine.name })}
+ </div>
+ )}
+ {error && !open && <div className="px-4 pb-3 text-meta text-red-600">{error}</div>}
+ {open && manual && (
+ <div className="px-4 pb-3.5 space-y-2.5">
+ {c.instructions.length > 0 && (
+ <ol className="list-decimal pl-4 text-meta text-muted leading-relaxed space-y-1">
+ {c.instructions.map((step, i) => (
+ <li key={i}>{step}</li>
+ ))}
+ </ol>
+ )}
+ {c.fields.map((f) => (
+ <label className="conn-field" key={f.key}>
+ <span className="conn-field-label">
+ {f.label}
+ {!f.required && <em> {t("machines.connectors.optional")}</em>}
+ </span>
+ <input
+ type={f.secret ? "password" : "text"}
+ placeholder={f.placeholder}
+ value={values[f.key] || ""}
+ spellCheck={false}
+ onChange={(e) => setValues({ ...values, [f.key]: e.target.value })}
+ />
+ {f.help && <span className="conn-field-help">{f.help}</span>}
+ </label>
+ ))}
+ <div className="flex items-center gap-3">
+ <button
+ className={PILL_ACCENT}
+ onClick={() => void submit()}
+ disabled={busy}
+ data-testid={`remote-connect-submit-${c.name}`}
+ >
+ {busy ? t("modal.validating") : t("machines.connectors.connect_on", { name: machine.name })}
+ </button>
+ <span className="text-meta text-faint">
+ {t("machines.connectors.encrypted_note", { name: machine.name })}
+ </span>
+ </div>
+ {error && <div className="text-meta text-red-600">{error}</div>}
+ </div>
+ )}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/ScopedStatus.tsx b/surfaces/gui/src/components/ScopedStatus.tsx
new file mode 100644
index 00000000..1b63886c
--- /dev/null
+++ b/surfaces/gui/src/components/ScopedStatus.tsx
@@ -0,0 +1,44 @@
+// Shared status rows for machine-scoped Settings pages (UX-046): one loading
+// treatment, one cached-view line, one unreachable message — so every scoped
+// page speaks the same language.
+
+import { useTranslation } from "react-i18next";
+
+export function LoadingRow({ what }: { what: string }) {
+ const { t } = useTranslation();
+ return (
+ <div
+ className="flex items-center gap-2.5 px-4 py-3.5 text-meta text-muted"
+ data-testid="scoped-loading"
+ >
+ <span className="w-[11px] h-[11px] rounded-full border-[1.5px] border-faint border-t-transparent animate-spin shrink-0" />
+ {t("machines.status.loading", { what })}
+ </div>
+ );
+}
+
+export function CachedNote({ at }: { at: number }) {
+ const { t } = useTranslation();
+ const stamp = new Date(at).toLocaleTimeString(undefined, {
+ hour: "numeric",
+ minute: "2-digit",
+ });
+ return (
+ <div
+ className="flex items-center gap-2 mb-2.5 text-label text-faint"
+ data-testid="scoped-cached"
+ >
+ <span className="w-[9px] h-[9px] rounded-full border-[1.5px] border-faint border-t-transparent animate-spin shrink-0" />
+ {t("machines.status.cached", { stamp })}
+ </div>
+ );
+}
+
+export function UnreachableRow({ machineName }: { machineName: string }) {
+ const { t } = useTranslation();
+ return (
+ <div className="px-4 py-3.5 text-meta text-muted" data-testid="scoped-unreachable">
+ {t("machines.status.unreachable", { name: machineName })}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/SettingsView.tsx b/surfaces/gui/src/components/SettingsView.tsx
index 4c65970a..f4670d56 100644
--- a/surfaces/gui/src/components/SettingsView.tsx
+++ b/surfaces/gui/src/components/SettingsView.tsx
@@ -1,7 +1,24 @@
-import { useEffect, useState } from "react";
-import { getI18n, useTranslation } from "react-i18next";
+import { useEffect, useLayoutEffect, useRef, useState } from "react";
+import { getI18n, Trans, useTranslation } from "react-i18next";
import { getStoredLanguage, setLanguage as setI18nLanguage, type Lang } from "../i18n";
import {
+ announceCloudChanged,
+ CLOUD_CHANGED,
+ cloudLogin,
+ getCloudConnections,
+ getConnectors,
+ cloudLogout,
+ getActiveOrg,
+ getCloudMachines,
+ getCloudStatus,
+ getMachines,
+ MACHINES_CHANGED,
+ getMe,
+ isCloudMode,
+ waitForCloudSignIn,
+ type CloudStatus,
+ type Machine,
+ type MeInfo,
getSettings,
getTrustedWorkspaces,
setAutoApprove,
@@ -39,10 +56,19 @@ import {
type DictationDownloadProgress,
type DictationStatus,
} from "../tauri";
+import { canSignOut, cloudSignOut } from "../cloudAuth";
+import { reflectSettings, settingsMachineParam } from "../routes";
import { useThemePref } from "../theme";
+import { useTextSize } from "../textSize";
+import { createPortal } from "react-dom";
import { Icon } from "./Icon";
import { PanelHead } from "./IntegrationsView";
+import { ConnectorGlance } from "./connectors/ConnectorGlance";
import { ModelsTab } from "./ManageTabs";
+import { ConnectorsSection } from "./connectors/ConnectorsSection";
+import { MachineModelsPanel } from "./MachineModelsPanel";
+import { MachinesSection } from "./MachinesSection";
+import { RemoteConnectorsPanel } from "./RemoteConnectorsPanel";
import { MemorySection } from "./MemorySection";
import { PersonasTab } from "./PersonasTab";
import { SkillsTab } from "./SkillsTab";
@@ -55,103 +81,360 @@ import { showPersonas } from "../flags";
// Models + Personas host the existing tab components inside the page shell (field re-skin to follow).
// "appearance" is the General tab's stable key — callers deep-link with it, so the
// rename (UX-021) changed only the label. "files" folded into General as a card.
-type SetTab = "appearance" | "models" | "context" | "skills" | "voice" | "memory" | "personas";
+export type SetTab =
+ | "appearance"
+ | "account"
+ | "models"
+ | "context"
+ | "skills"
+ | "voice"
+ | "memory"
+ | "machines"
+ | "connectors"
+ | "personas"
+ // UX-049: per-connector glance pages (App group), shown once connected somewhere.
+ | "slack"
+ | "github";
const CARD = "rounded-xl2 border border-line bg-panel";
-const FIELD_LABEL = "text-[13px] font-medium text-ink";
-const FIELD_HELP = "text-[12px] text-muted mt-1.5 leading-relaxed";
+const FIELD_LABEL = "text-ui font-medium text-ink";
+const FIELD_HELP = "text-meta text-muted mt-1.5 leading-relaxed";
const INPUT =
- "flex-1 min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent";
-const BTN_ACCENT = "text-[13px] px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
+ "flex-1 min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent";
+const BTN_ACCENT = "text-ui px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
const BTN_BORDERED =
- "text-[13px] px-3 py-2 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
-
-const SET_TABS: {
- key: SetTab;
- labelKey: string;
- icon: "sliders" | "code" | "mic" | "archive" | "sparkle" | "book" | "refresh";
-}[] = [
- { key: "appearance", labelKey: "settings.tab.general", icon: "sliders" },
- { key: "models", labelKey: "settings.tab.models", icon: "code" },
- { key: "context", labelKey: "settings.tab.context", icon: "refresh" },
- { key: "skills", labelKey: "settings.tab.skills", icon: "book" },
- { key: "voice", labelKey: "settings.tab.voice", icon: "mic" },
- { key: "memory", labelKey: "settings.tab.memory", icon: "archive" },
- { key: "personas", labelKey: "settings.tab.personas", icon: "sparkle" },
+ "text-ui px-3 py-2 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
+
+// UX-046 (approved 2026-08-30): the rail is grouped by SCOPE. APP pages are
+// about where you sit; MACHINE pages are about one machine's engine — the
+// picker on that group header chooses which ("This Mac" is just the first
+// machine); INVENTORY is the fleet list itself, outside the picker. With no
+// enrolled machines the picker does not exist and the rail reads like before.
+type SetIcon =
+ | "sliders"
+ | "code"
+ | "mic"
+ | "archive"
+ | "sparkle"
+ | "book"
+ | "refresh"
+ | "plug"
+ | "user";
+// `labelKey` = the i18n key for the label; tabs without one yet show `label` as is.
+type TabDef = { key: SetTab; label: string; labelKey?: string; icon: SetIcon };
+
+const SET_GROUPS: { name: string; nameKey?: string; scope: "app" | "machine" | "inventory"; tabs: TabDef[] }[] = [
+ {
+ name: "App",
+ nameKey: "settingsx.group.app",
+ scope: "app",
+ tabs: [
+ { key: "appearance", label: "General", labelKey: "settings.tab.general", icon: "sliders" },
+ { key: "voice", label: "Voice input", labelKey: "settings.tab.voice", icon: "mic" },
+ { key: "account", label: "Account", labelKey: "settingsx.tab.account", icon: "user" },
+ { key: "slack", label: "Slack", labelKey: "settingsx.tab.slack", icon: "plug" },
+ { key: "github", label: "GitHub", labelKey: "settingsx.tab.github", icon: "plug" },
+ ],
+ },
+ {
+ name: "Machine",
+ nameKey: "settingsx.group.machine",
+ scope: "machine",
+ tabs: [
+ { key: "models", label: "Models & Keys", labelKey: "settings.tab.models", icon: "code" },
+ { key: "connectors", label: "Connectors", labelKey: "nav.connectors", icon: "plug" },
+ { key: "context", label: "Context optimization", labelKey: "settings.tab.context", icon: "refresh" },
+ { key: "skills", label: "Skills", labelKey: "settings.tab.skills", icon: "book" },
+ { key: "memory", label: "Memory", labelKey: "settings.tab.memory", icon: "archive" },
+ { key: "personas", label: "Coworkers", labelKey: "settings.tab.personas", icon: "sparkle" },
+ ],
+ },
+ {
+ name: "Inventory",
+ nameKey: "settingsx.group.inventory",
+ scope: "inventory",
+ tabs: [{ key: "machines", label: "Machines", labelKey: "settingsx.tab.machines", icon: "plug" }],
+ },
];
export function SettingsView({
initialTab,
onOpenPersona,
onCreateSkill,
+ onAskWorker,
+ onBack,
}: {
initialTab?: SetTab;
- onOpenPersona?: (id: string) => void;
+ // "Back to app" on the rail — returns to the conversation surface.
+ onBack?: () => void;
+ onOpenPersona?: (id: string, machineId?: string | null) => void;
// Skills doorway (SKILLS-SPEC §5.2): start a new conversation with the description
- // prefilled — the worker builds the skill and proposes it via save_skill.
- onCreateSkill?: (description: string) => void;
+ // prefilled — the worker builds the skill and proposes it via save_skill. Under a
+ // machine scope, that conversation runs ON the machine.
+ onCreateSkill?: (description: string, machineId?: string | null) => void;
+ // Memory's remote CTA: start a conversation ON that machine to change its memory.
+ onAskWorker?: (machineId: string) => void;
}) {
const { t } = useTranslation();
// Personas is flag-gated (hidden for launch) — filter the tab AND coerce a stale
// deep-link to it (openSettings("personas") callers) so the page never opens on a
// section with no nav entry.
const personas = showPersonas();
- const tabs = personas ? SET_TABS : SET_TABS.filter((tab) => tab.key !== "personas");
+ // UX-049: the Slack / GitHub glance pages appear once that connector is
+ // connected on any machine (the cloud's view) or on This Mac.
+ const [inbound, setInbound] = useState<Set<string>>(new Set());
+ useEffect(() => {
+ const seen = new Set<string>();
+ Promise.allSettled([
+ getCloudConnections().then((rows) => {
+ for (const r of rows) if (r.status !== "disconnected") seen.add(r.connector);
+ }),
+ getConnectors().then((cs) => {
+ for (const c of cs) if (c.connected) seen.add(c.name);
+ }),
+ ]).then(() => setInbound(new Set([...seen].filter((n) => n === "slack" || n === "github"))));
+ }, []);
+ // "Manage on This Mac" from a glance page opens that connector's local
+ // management page inside Connectors (one shot; the list is the default).
+ const [manageDetail, setManageDetail] = useState<string | null>(null);
+ const groups = SET_GROUPS.map((g) => ({
+ ...g,
+ tabs: g.tabs.filter(
+ (tb) =>
+ (personas || tb.key !== "personas") &&
+ (tb.key !== "slack" && tb.key !== "github" ? true : inbound.has(tb.key)),
+ ),
+ }));
const wanted = initialTab && (personas || initialTab !== "personas") ? initialTab : "appearance";
const [tab, setTab] = useState<SetTab>(wanted);
+ // The machine scope for the MACHINE group ("" = This Mac / the local engine).
+ // Cloud has no local engine, so the first enrolled machine is the scope there.
+ const [machines, setMachines] = useState<Machine[]>([]);
+ const [scopeId, setScopeId] = useState<string>("");
+ // The URL's ?m= names the scope (a deep link, or a remount of a page that
+ // was already scoped). Captured at FIRST RENDER — the reflect effect below
+ // rewrites the hash before the machines fetch could read it.
+ const [urlScope] = useState(() => settingsMachineParam());
+ useEffect(() => {
+ // Union view: the picker offers local rows plus (signed-in desktop) the
+ // cloud registry's, origin-tagged — scoped pages route by id prefix.
+ // Reloaded whenever the fleet changes under us (a sandbox joining, a
+ // machine removed) — the Machines page announces it (owner catch
+ // 2026-09-02: a new sandbox needed a hard refresh to reach the picker).
+ let first = true;
+ const load = () =>
+ Promise.all([
+ getMachines().catch(() => ({ machines: [] as Machine[] })),
+ isCloudMode()
+ ? Promise.resolve({ machines: [] as Machine[] })
+ : getCloudMachines().catch(() => ({ machines: [] as Machine[] })),
+ ])
+ .then(([local, cloud]) => {
+ const rows = [...(local.machines ?? []), ...(cloud.machines ?? [])];
+ setMachines(rows);
+ // A gone machine falls back to the default scope.
+ if (first && urlScope && rows.some((m) => m.id === urlScope)) setScopeId(urlScope);
+ else if (isCloudMode() && rows.length) setScopeId((cur) => (cur && rows.some((m) => m.id === cur) ? cur : rows[0].id));
+ first = false;
+ })
+ .catch(() => setMachines([]));
+ void load();
+ const onChange = () => void load();
+ window.addEventListener(MACHINES_CHANGED, onChange);
+ return () => window.removeEventListener(MACHINES_CHANGED, onChange);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+ const scoped = machines.find((m) => m.id === scopeId) ?? null;
+
+ // The open page (and its machine scope) rides the URL — #/settings/{page},
+ // bookmarkable. App pages carry no scope; the fleet page is outside it.
+ const machineScoped = SET_GROUPS[1].tabs.some((tb) => tb.key === tab);
+ useEffect(() => {
+ reflectSettings(tab, machineScoped ? scopeId || null : null);
+ }, [tab, scopeId, machineScoped]);
+
+ // The nav lives in the app's left column (App mounts #settings-rail in place of the
+ // session sidebar while Settings is open) — rendered there through a portal so this
+ // view keeps owning the page + scope state. Standalone mounts (tests) render it inline.
+ const [railSlot, setRailSlot] = useState<HTMLElement | null>(null);
+ useLayoutEffect(() => {
+ setRailSlot(document.getElementById("settings-rail"));
+ }, []);
+
+ const nav = (
+ <nav
+ className={
+ railSlot
+ ? "settings-rail flex-1 min-h-0 overflow-y-auto hairline-scroll px-2.5 pt-2 pb-2"
+ : "page-subnav w-[208px] shrink-0 border-r border-line bg-panel/40 px-3 py-4"
+ }
+ aria-label={t("nav.settings")}
+ >
+ <button
+ className="settings-rail-head w-full flex items-center gap-2 px-2 py-1.5 mb-3 rounded-[7px] text-ui text-muted hover:text-ink hover:bg-chromeHover text-left"
+ onClick={() => onBack?.()}
+ data-testid="settings-back"
+ >
+ <Icon name="arrowLeft" size={15} /> {t("settingsx.back_to_app")}
+ </button>
+ {groups.map((g) => (
+ <div key={g.name} className="mb-3.5">
+ <div className="px-2 pb-1 flex items-center gap-2">
+ <span className="text-label text-faint font-medium">
+ {g.nameKey ? t(g.nameKey) : g.name}
+ </span>
+ {/* The ONE picker (UX-046): appears only when there is a choice
+ to make — extra machines on desktop, several on cloud. */}
+ {g.scope === "machine" && machines.length > 0 && (
+ <select
+ className="ml-auto max-w-[110px] truncate text-label px-1.5 py-0.5 rounded-md border border-line bg-paper text-ink outline-none"
+ value={scopeId}
+ onChange={(e) => setScopeId(e.target.value)}
+ data-testid="machine-scope-picker"
+ aria-label={t("settingsx.machine_scope_aria")}
+ >
+ {!isCloudMode() && <option value="">{t("settingsx.this_mac_option")}</option>}
+ {machines
+ .filter((m) => m.origin !== "cloud")
+ .map((m) => (
+ <option key={m.id} value={m.id}>
+ ⌂ {m.name}
+ </option>
+ ))}
+ {machines.some((m) => m.origin === "cloud") && (
+ <optgroup label={t("settingsx.openworker_cloud")}>
+ {machines
+ .filter((m) => m.origin === "cloud")
+ .map((m) => (
+ <option key={m.id} value={m.id}>
+ ⌂ {m.name}
+ </option>
+ ))}
+ </optgroup>
+ )}
+ </select>
+ )}
+ </div>
+ {g.tabs.map((tb) => {
+ const active = tab === tb.key;
+ return (
+ <button
+ key={tb.key}
+ className={
+ "w-full text-left px-2 py-1.5 rounded-[7px] text-ui flex items-center gap-2 " +
+ (active ? "bg-chromeHover text-ink font-medium" : "text-ink hover:bg-chromeHover")
+ }
+ onClick={() => setTab(tb.key)}
+ >
+ <Icon name={tb.icon} size={15} className="text-muted" />{" "}
+ {tb.labelKey ? t(tb.labelKey) : tb.label}
+ </button>
+ );
+ })}
+ </div>
+ ))}
+ </nav>
+ );
+
return (
<main className="flex-1 min-w-0 flex bg-paper">
- <nav className="page-subnav w-[208px] shrink-0 border-r border-line bg-panel/40 px-3 py-4">
- <div className="px-2 text-[13px] font-semibold mb-3 flex items-center gap-2">
- <Icon name="gear" size={16} /> {t("nav.settings")}
- </div>
- {tabs.map((tb) => {
- const active = tab === tb.key;
- return (
- <button
- key={tb.key}
- className={
- "w-full text-left px-2.5 py-2 rounded-lg text-[13px] flex items-center gap-2 " +
- (active ? "bg-paper text-accent font-medium" : "text-muted hover:bg-paper hover:text-ink")
- }
- onClick={() => setTab(tb.key)}
- >
- <Icon name={tb.icon} size={15} /> {t(tb.labelKey)}
- </button>
- );
- })}
- </nav>
+ {railSlot ? createPortal(nav, railSlot) : nav}
<div className="flex-1 min-w-0 overflow-y-auto hairline-scroll">
<div className="max-w-3xl mx-auto px-7 py-6">
{tab === "appearance" ? (
<AppearanceSection />
+ ) : tab === "account" ? (
+ <AccountSection />
) : tab === "models" ? (
- <section>
- <PanelHead
- title={t("settings.tab.models")}
- sub={t("settings.models_sub")}
- />
- <ModelsTab />
- </section>
+ scoped ? (
+ <MachineModelsPanel machine={scoped} />
+ ) : (
+ <section>
+ <PanelHead
+ title={t("settings.tab.models")}
+ sub={t("settings.models_sub")}
+ />
+ <ModelsTab />
+ </section>
+ )
) : tab === "context" ? (
- <section>
+ <section key={scopeId || "local"}>
<PanelHead
- title="Context optimization"
- sub="How sessions spend tokens — attachment handling and long-history compaction."
+ title={t("settings.tab.context")}
+ sub={
+ scoped
+ ? t("settingsx.context.sub_machine", { name: scoped.name })
+ : t("settingsx.context.sub")
+ }
/>
- <TokenSavingsCard />
- <CompactionCard />
+ <TokenSavingsCard machine={scoped} />
+ <CompactionCard machine={scoped} />
</section>
) : tab === "skills" ? (
- <SkillsTab onCreateSkill={onCreateSkill} />
+ <SkillsTab
+ key={scopeId || "local"}
+ machine={scoped}
+ onCreateSkill={(description) => onCreateSkill?.(description, scoped?.id ?? null)}
+ />
) : tab === "voice" ? (
<VoiceInputSection />
) : tab === "memory" ? (
- <MemorySection />
+ <MemorySection
+ key={scopeId || "local"}
+ machine={scoped}
+ onAskWorker={(machineId) => onAskWorker?.(machineId)}
+ />
+ ) : tab === "machines" ? (
+ <MachinesSection />
+ ) : tab === "slack" || tab === "github" ? (
+ <ConnectorGlance
+ key={tab}
+ connector={tab}
+ onManage={(name) => {
+ setManageDetail(name);
+ setScopeId("");
+ setTab("connectors");
+ }}
+ />
+ ) : tab === "connectors" ? (
+ // Connectors moved here from its own surface (owner 2026-08-31):
+ // This-Mac scope = the full existing page; a machine scope = that
+ // machine's list with the flows a headless box can run (sealed
+ // manual connect; browser sign-ins stay on the controller).
+ <section>
+ <PanelHead
+ title={t("nav.connectors")}
+ sub={
+ scoped
+ ? t("settingsx.connectors.sub_machine", { name: scoped.name })
+ : t("integrations.connectors_sub")
+ }
+ />
+ {scoped ? (
+ <RemoteConnectorsPanel
+ key={scopeId}
+ machine={scoped}
+ onConfigure={(name) => setTab(name === "github" ? "github" : "slack")}
+ />
+ ) : (
+ <ConnectorsSection
+ key={manageDetail || "list"}
+ initialDetail={manageDetail}
+ onConfigure={(name) => {
+ setManageDetail(null);
+ setTab(name === "github" ? "github" : "slack");
+ }}
+ />
+ )}
+ </section>
) : (
- <PersonasSection onOpenPersona={onOpenPersona} />
+ <PersonasSection
+ key={scopeId || "local"}
+ machine={scoped}
+ onOpenPersona={(id) => onOpenPersona?.(id, scoped?.id ?? null)}
+ />
)}
</div>
</div>
@@ -296,10 +579,10 @@ function VoiceInputSection() {
/>
{!desktop ? (
- <div className={CARD + " p-4 text-[13px] text-muted"}>{t("settings.voice_desktop_only")}</div>
+ <div className={CARD + " p-4 text-ui text-muted"}>{t("settings.voice_desktop_only")}</div>
) : (
<div className="space-y-4">
- <div className="rounded-xl border border-green-200 bg-green-50/70 px-4 py-3 text-[13px] text-green-800">
+ <div className="rounded-xl border border-green-200 bg-green-50/70 px-4 py-3 text-ui text-green-800">
<span className="font-medium">{t("settings.voice_private_title")}</span>{" "}
{t("settings.voice_private_body")}
</div>
@@ -308,17 +591,17 @@ function VoiceInputSection() {
<div className="p-4 flex items-start gap-3">
<Icon name="code" size={18} className="text-accent mt-0.5" />
<div className="min-w-0 flex-1">
- <div className="text-[13px] font-medium">{t("settings.voice_device_title")}</div>
- <div className="text-[12px] text-muted mt-1">{status?.device_summary || t("settings.voice_checking")}</div>
- {status?.compatibility_reason && <div className="text-[12px] text-red-600 mt-1.5">{status.compatibility_reason}</div>}
+ <div className="text-ui font-medium">{t("settings.voice_device_title")}</div>
+ <div className="text-meta text-muted mt-1">{status?.device_summary || t("settings.voice_checking")}</div>
+ {status?.compatibility_reason && <div className="text-meta text-red-600 mt-1.5">{status.compatibility_reason}</div>}
</div>
{status && (
- <span className={"text-[12px] px-2 py-1 rounded-full " + (status.supported ? "bg-green-50 text-green-700" : "bg-red-50 text-red-600")}>
+ <span className={"text-meta px-2 py-1 rounded-full " + (status.supported ? "bg-green-50 text-green-700" : "bg-red-50 text-red-600")}>
{status.supported ? `● ${t("settings.voice_compatible")}` : t("settings.voice_unsupported")}
</span>
)}
</div>
- <div className="border-t border-line bg-paper/50 px-4 py-3 grid grid-cols-2 gap-3 text-[12px] text-muted">
+ <div className="border-t border-line bg-paper/50 px-4 py-3 grid grid-cols-2 gap-3 text-meta text-muted">
<div><span className="block text-ink font-medium">{t("settings.voice_mac")}</span>{t("settings.voice_mac_detail")}</div>
<div><span className="block text-ink font-medium">{t("settings.voice_windows")}</span>{t("settings.voice_windows_detail")}</div>
<div><span className="block text-ink font-medium">{t("settings.voice_memory")}</span>{t("settings.voice_memory_detail")}</div>
@@ -330,8 +613,8 @@ function VoiceInputSection() {
<div className="p-4 flex items-center gap-3">
<div className="w-9 h-9 rounded-lg bg-accentSoft text-accent grid place-items-center font-semibold">W</div>
<div className="min-w-0 flex-1">
- <div className="text-[13px] font-medium">{t("settings.voice_whisper_title")}</div>
- <div className="text-[12px] text-muted mt-0.5">
+ <div className="text-ui font-medium">{t("settings.voice_whisper_title")}</div>
+ <div className="text-meta text-muted mt-0.5">
{status?.model_verified
? t("settings.voice_installed", { size: formatBytes(status.model_bytes) })
: t("settings.voice_not_installed", { size: formatBytes(status?.model_bytes || 147_964_211) })}
@@ -339,14 +622,14 @@ function VoiceInputSection() {
</div>
{status?.model_verified ? (
<>
- <span className="text-[12px] px-2 py-1 rounded-full bg-green-50 text-green-700">{t("settings.voice_verified")}</span>
+ <span className="text-meta px-2 py-1 rounded-full bg-green-50 text-green-700">{t("settings.voice_verified")}</span>
<button className={BTN_BORDERED} onClick={() => void repair()}>{t("settings.voice_repair")}</button>
- <button className="text-[12px] text-red-600 px-2 py-2" onClick={() => void remove()}>{t("settings.voice_delete")}</button>
+ <button className="text-meta text-red-600 px-2 py-2" onClick={() => void remove()}>{t("settings.voice_delete")}</button>
</>
) : downloading ? (
<button className={BTN_BORDERED} onClick={() => void cancelDownload()}>{t("common.stop")}</button>
) : phase === "verifying" ? (
- <span className="text-[12px] text-muted">{t("settings.voice_verifying")}</span>
+ <span className="text-meta text-muted">{t("settings.voice_verifying")}</span>
) : (
<button className={BTN_ACCENT} disabled={!status?.supported} onClick={() => void download()}>{t("settings.voice_download")}</button>
)}
@@ -354,7 +637,7 @@ function VoiceInputSection() {
{downloading && (
<div className="border-t border-line px-4 py-3">
<div className="h-1.5 rounded-full bg-line overflow-hidden"><div className="h-full bg-accent transition-all" style={{ width: `${progressPercent}%` }} /></div>
- <div className="mt-1.5 text-[12px] text-muted flex"><span>{t("settings.voice_dl_progress", { done: formatBytes(progress?.downloaded_bytes || 0), total: formatBytes(progressTotal) })}</span><span className="ml-auto">{progressPercent}%</span></div>
+ <div className="mt-1.5 text-meta text-muted flex"><span>{t("settings.voice_dl_progress", { done: formatBytes(progress?.downloaded_bytes || 0), total: formatBytes(progressTotal) })}</span><span className="ml-auto">{progressPercent}%</span></div>
</div>
)}
</div>
@@ -363,12 +646,12 @@ function VoiceInputSection() {
<div className="p-4 flex items-center gap-3">
<Icon name="mic" size={18} className={ready ? "text-green-600" : "text-muted"} />
<div className="min-w-0 flex-1">
- <div className="text-[13px] font-medium">{t("settings.voice_mic_test_title")}</div>
- <div className="text-[12px] text-muted mt-0.5">
+ <div className="text-ui font-medium">{t("settings.voice_mic_test_title")}</div>
+ <div className="text-meta text-muted mt-0.5">
{ready ? t("settings.voice_mic_test_ready") : t("settings.voice_mic_test_pending")}
</div>
</div>
- {ready && <span className="text-[12px] px-2 py-1 rounded-full bg-green-50 text-green-700">● {t("settings.voice_ready_badge")}</span>}
+ {ready && <span className="text-meta px-2 py-1 rounded-full bg-green-50 text-green-700">● {t("settings.voice_ready_badge")}</span>}
<button className={BTN_BORDERED} disabled={!status?.supported || !status?.model_verified || phase === "transcribing"} onClick={() => void toggleTest()}>
{status?.recording
? t("settings.voice_stop_check")
@@ -379,11 +662,11 @@ function VoiceInputSection() {
: t("settings.voice_test_mic")}
</button>
</div>
- {status?.recording && <div className="border-t border-line px-4 py-3 text-[12px] text-accent" role="status">{t("settings.voice_listening")}</div>}
- {testTranscript && <div className="border-t border-line bg-paper/50 px-4 py-3 text-[13px]">“{testTranscript}”</div>}
+ {status?.recording && <div className="border-t border-line px-4 py-3 text-meta text-accent" role="status">{t("settings.voice_listening")}</div>}
+ {testTranscript && <div className="border-t border-line bg-paper/50 px-4 py-3 text-ui">“{testTranscript}”</div>}
</div>
- {error && <div role="alert" className="rounded-lg border border-red-200 bg-red-50 px-3 py-2.5 text-[12px] text-red-700">{error}</div>}
+ {error && <div role="alert" className="rounded-lg border border-red-200 bg-red-50 px-3 py-2.5 text-meta text-red-700">{error}</div>}
</div>
)}
</section>
@@ -396,23 +679,183 @@ function VoiceInputSection() {
// The Gallery entry point is GONE (owner 2026-08-21) — coworkers install from
// GitHub / folder / zip only. GalleryModal stays in the tree for the gallery's
// possible return as a first-class distribution surface, but nothing mounts it.
-function PersonasSection({ onOpenPersona }: { onOpenPersona?: (id: string) => void }) {
+function PersonasSection({
+ onOpenPersona,
+ machine,
+}: {
+ onOpenPersona?: (id: string) => void;
+ machine?: Machine | null;
+}) {
const { t } = useTranslation();
return (
<section>
- <PanelHead title={t("settings.tab.personas")} sub={t("settings.personas_intro")} />
- <p className="text-[13px] text-muted leading-relaxed max-w-[560px] mt-5 mb-1">
+ <PanelHead
+ title={t("settings.tab.personas")}
+ sub={
+ machine
+ ? t("settingsx.personas.machine_sub", { name: machine.name })
+ : t("settings.personas_intro")
+ }
+ />
+ <p className="text-ui text-muted leading-relaxed max-w-[560px] mt-5 mb-1">
{t("settings.personas_desc")}
</p>
- <PersonasTab onOpenPersona={onOpenPersona} />
+ <PersonasTab onOpenPersona={onOpenPersona} machine={machine} />
+ </section>
+ );
+}
+
+// -- Account -------------------------------------------------------------------
+// Two deployments, two meanings of "account". On the hosted dashboard the page
+// is the signed-in identity: who you are, the organization this browser acts
+// in, and the way out (moved here from the Machines page's inline bar). On
+// desktop and self-hosted browsers it is the optional OpenWorker Cloud
+// sign-in — the same one the sidebar's account menu offers, given a full page.
+function AccountSection() {
+ const { t } = useTranslation();
+ return (
+ <section>
+ <PanelHead
+ title={t("settingsx.tab.account")}
+ sub={
+ isCloudMode()
+ ? t("settingsx.account.sub_hosted")
+ : t("settingsx.account.sub_desktop")
+ }
+ />
+ {isCloudMode() ? <HostedAccountCards /> : <DesktopCloudCard />}
</section>
);
}
+function HostedAccountCards() {
+ const { t } = useTranslation();
+ // Fetched here rather than read from the boot gate: the page should show
+ // the identity as the API resolves it right now, under the active org.
+ const [me, setMe] = useState<MeInfo | null | undefined>(undefined);
+ useEffect(() => {
+ getMe()
+ .then(setMe)
+ .catch(() => setMe(null));
+ }, []);
+
+ if (me === undefined) return <div className="text-meta text-muted mt-3">{t("settingsx.account.loading")}</div>;
+ if (me === null)
+ return (
+ <div className={CARD + " p-4 text-ui text-muted"}>
+ {t("settingsx.account.no_signin_service")}
+ </div>
+ );
+ const active = getActiveOrg() || me.org_id;
+ const activeOrg = me.orgs.find((o) => o.id === active);
+ return (
+ <div data-testid="cloud-account-card">
+ <div className={CARD + " p-4 mb-4"}>
+ <div className={FIELD_LABEL}>{t("settingsx.account.signed_in_as")}</div>
+ <div className="mt-2 flex items-center gap-3">
+ <span className="w-8 h-8 rounded-full bg-accentSoft text-accent grid place-items-center text-ui font-semibold">
+ {(me.actor || "?").slice(0, 1).toUpperCase()}
+ </span>
+ <span className="text-ui text-ink min-w-0 truncate">{me.actor}</span>
+ {canSignOut() && (
+ <button
+ className={BTN_BORDERED + " ml-auto"}
+ onClick={() => void cloudSignOut()}
+ >
+ {t("sidebar.sign_out")}
+ </button>
+ )}
+ </div>
+ </div>
+
+ {/* One login, one org (spec 2026-08-31): the org is a function of the
+ identity — display only, never a choice made here. */}
+ <div className={CARD + " p-4 mb-4"}>
+ <div className={FIELD_LABEL}>{t("settingsx.account.organization")}</div>
+ <div className="mt-2 text-ui text-ink" data-testid="org-name">
+ {activeOrg?.name ?? active}
+ </div>
+ <div className={FIELD_HELP}>
+ {t("settingsx.account.organization_help")}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function DesktopCloudCard() {
+ const { t } = useTranslation();
+ const [status, setStatus] = useState<CloudStatus | null>(null);
+ const [waiting, setWaiting] = useState(false);
+ const cancelWait = useRef<(() => void) | null>(null);
+
+ useEffect(() => {
+ const load = () =>
+ getCloudStatus()
+ .then(setStatus)
+ .catch(() => setStatus({ signed_in: false, account: "", user_id: "" }));
+ load();
+ window.addEventListener(CLOUD_CHANGED, load);
+ return () => {
+ window.removeEventListener(CLOUD_CHANGED, load);
+ cancelWait.current?.();
+ };
+ }, []);
+
+ const signIn = async () => {
+ setWaiting(true);
+ await cloudLogin().catch(() => {});
+ cancelWait.current?.();
+ cancelWait.current = waitForCloudSignIn((s) => {
+ setWaiting(false);
+ if (s) setStatus(s);
+ if (s?.signed_in) announceCloudChanged();
+ });
+ };
+ const signOut = async () => {
+ await cloudLogout().catch(() => {});
+ announceCloudChanged();
+ };
+
+ return (
+ <div className={CARD + " p-4"} data-testid="cloud-signin-card">
+ <div className={FIELD_LABEL}>{t("settingsx.openworker_cloud")}</div>
+ {status === null ? (
+ <div className="text-meta text-muted mt-2">{t("settingsx.account.checking_signin")}</div>
+ ) : status.signed_in ? (
+ <div className="mt-2 flex items-center gap-3">
+ <span className="w-8 h-8 rounded-full bg-accentSoft text-accent grid place-items-center text-ui font-semibold">
+ {(status.account || "?").slice(0, 1).toUpperCase()}
+ </span>
+ <span className="text-ui text-ink min-w-0 truncate">{status.account}</span>
+ <button className={BTN_BORDERED + " ml-auto"} onClick={() => void signOut()}>
+ {t("sidebar.sign_out")}
+ </button>
+ </div>
+ ) : (
+ <>
+ <div className={FIELD_HELP}>
+ {t("settingsx.account.signin_help")}
+ </div>
+ <button
+ className={BTN_ACCENT + " mt-3"}
+ onClick={() => void signIn()}
+ disabled={waiting}
+ data-testid="account-page-sign-in"
+ >
+ {waiting ? t("cloud.check_browser") : t("cloud.sign_in")}
+ </button>
+ </>
+ )}
+ </div>
+ );
+}
+
// -- Appearance + app behaviour ------------------------------------------------
function AppearanceSection() {
const { t } = useTranslation();
const [theme, setTheme] = useThemePref();
+ const [textSize, setTextSizePref] = useTextSize();
const [autostart, setAuto] = useState(false);
const [keepAwake, setKeep] = useState(false);
const desktop = isTauri();
@@ -469,6 +912,29 @@ function AppearanceSection() {
<div className={FIELD_HELP}>{t("settings.language_help")}</div>
</div>
+ <div className={CARD + " p-4 mb-4"} data-testid="text-size-card">
+ <div className={FIELD_LABEL}>{t("settingsx.text_size.title")}</div>
+ <div className="seg mt-2.5" role="radiogroup" aria-label={t("settingsx.text_size.title")}>
+ {(["small", "default", "large"] as const).map((s) => (
+ <button
+ key={s}
+ className={s === textSize ? "active" : ""}
+ onClick={() => setTextSizePref(s)}
+ data-testid={`text-size-${s}`}
+ aria-checked={s === textSize}
+ role="radio"
+ >
+ {s === "small"
+ ? t("settingsx.text_size.small")
+ : s === "default"
+ ? t("settingsx.text_size.default")
+ : t("settingsx.text_size.large")}
+ </button>
+ ))}
+ </div>
+ <div className={FIELD_HELP}>{t("settingsx.text_size.help")}</div>
+ </div>
+
<SidebarCard />
<ContextBarCard />
@@ -485,15 +951,15 @@ function AppearanceSection() {
<label className="flex items-start gap-3 py-2">
<input type="checkbox" className="mt-0.5" checked={autostart} onChange={(e) => toggleAuto(e.target.checked)} />
<span>
- <span className="block text-[13px] text-ink">{t("settings.open_at_login")}</span>
- <span className="block text-[12px] text-muted">{t("settings.open_at_login_help")}</span>
+ <span className="block text-ui text-ink">{t("settings.open_at_login")}</span>
+ <span className="block text-meta text-muted">{t("settings.open_at_login_help")}</span>
</span>
</label>
<label className="flex items-start gap-3 py-2">
<input type="checkbox" className="mt-0.5" checked={keepAwake} onChange={(e) => toggleKeep(e.target.checked)} />
<span>
- <span className="block text-[13px] text-ink">{t("settings.keep_awake")}</span>
- <span className="block text-[12px] text-muted">{t("settings.keep_awake_help")}</span>
+ <span className="block text-ui text-ink">{t("settings.keep_awake")}</span>
+ <span className="block text-meta text-muted">{t("settings.keep_awake_help")}</span>
</span>
</label>
</div>
@@ -542,16 +1008,16 @@ function TrustedWorkspacesCard() {
{t("settings.trusted_workspaces_help")}
</div>
{workspaces === null ? (
- <div className="text-[12px] text-muted mt-3">{t("settings.trust_loading")}</div>
+ <div className="text-meta text-muted mt-3">{t("settings.trust_loading")}</div>
) : workspaces.length === 0 ? (
- <div className="text-[12px] text-muted mt-3">{t("settings.trust_empty")}</div>
+ <div className="text-meta text-muted mt-3">{t("settings.trust_empty")}</div>
) : (
<div className="mt-3 divide-y divide-line">
{workspaces.map((workspace) => (
<div key={workspace.workspace} className="py-2.5 flex items-start gap-3">
<div className="min-w-0 flex-1">
- <div className="text-[13px] text-ink break-all">{workspace.workspace}</div>
- <div className="text-[12px] text-muted mt-0.5">
+ <div className="text-ui text-ink break-all">{workspace.workspace}</div>
+ <div className="text-meta text-muted mt-0.5">
{workspace.requested_commands.length
? t("settings.trust_allowances", { count: workspace.requested_commands.length })
: t("settings.trust_no_allowances")}
@@ -559,7 +1025,7 @@ function TrustedWorkspacesCard() {
</div>
</div>
<button
- className="text-[12px] text-red-600 px-2 py-1"
+ className="text-meta text-red-600 px-2 py-1"
onClick={() => void revoke(workspace.workspace)}
>
{t("settings.trust_revoke")}
@@ -618,7 +1084,7 @@ function UpdateInline() {
</button>
)}
{(state === "none" || state === "error" || state === "installing") && (
- <span className="text-[12px] text-muted">
+ <span className="text-meta text-muted">
{state === "none"
? t("settings.update_latest")
: state === "error"
@@ -639,12 +1105,13 @@ function UpdateInline() {
// This card is the attachment dial: attach thresholds + the fallback for models
// without native PDF support. (Long-history spend is handled by auto-compaction —
// the CompactionCard below, OPE-27.)
-function TokenSavingsCard() {
+function TokenSavingsCard({ machine }: { machine?: Machine | null }) {
const { t } = useTranslation();
+ const mid = machine?.id ?? null;
const [pdf, setPdf] = useState<PdfSettings | null>(null);
useEffect(() => {
- getSettings()
+ getSettings(mid)
.then((s) =>
setPdf({
pdf_fallback: s.pdf_fallback || "text",
@@ -653,11 +1120,11 @@ function TokenSavingsCard() {
}),
)
.catch(() => setPdf({ pdf_fallback: "text", pdf_max_pages: 20, pdf_max_mb: 10 }));
- }, []);
+ }, [mid]);
const save = async (patch: Partial<PdfSettings>) => {
setPdf((p) => (p ? { ...p, ...patch } : p));
- await setPdfSettings(patch);
+ await setPdfSettings(patch, mid);
};
if (!pdf) return null;
@@ -668,7 +1135,7 @@ function TokenSavingsCard() {
{t("settings.token_savings_help")}
</div>
- <div className="mt-3 text-[13px] text-ink">{t("settings.pdf_fallback_label")}</div>
+ <div className="mt-3 text-ui text-ink">{t("settings.pdf_fallback_label")}</div>
<div className="seg mt-2" role="radiogroup" aria-label={t("settings.pdf_fallback_aria")} data-testid="pdf-fallback">
<button
className={pdf.pdf_fallback === "text" ? "active" : ""}
@@ -689,29 +1156,29 @@ function TokenSavingsCard() {
<div className="mt-3 flex items-center gap-5">
<label className="flex items-center gap-2.5">
- <span className="text-[13px] text-ink">{t("settings.pdf_max_pages")}</span>
+ <span className="text-ui text-ink">{t("settings.pdf_max_pages")}</span>
<input
type="number"
min={1}
max={100}
value={pdf.pdf_max_pages}
data-testid="pdf-max-pages"
- className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) => save({ pdf_max_pages: Math.max(1, Math.min(Number(e.target.value) || 20, 100)) })}
/>
</label>
<label className="flex items-center gap-2.5">
- <span className="text-[13px] text-ink">{t("settings.pdf_max_size")}</span>
+ <span className="text-ui text-ink">{t("settings.pdf_max_size")}</span>
<input
type="number"
min={1}
max={10}
value={pdf.pdf_max_mb}
data-testid="pdf-max-mb"
- className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) => save({ pdf_max_mb: Math.max(1, Math.min(Number(e.target.value) || 10, 10)) })}
/>
- <span className="text-[13px] text-muted">MB</span>
+ <span className="text-ui text-muted">MB</span>
</label>
</div>
<div className={FIELD_HELP}>
@@ -725,13 +1192,15 @@ function TokenSavingsCard() {
// Long sessions are summarized automatically when they approach the model's context
// limit, so work continues instead of hitting a raw provider error. Two spec'd
// overrides (trigger % + token cap) and the summarizer-model pin — nothing more.
-function CompactionCard() {
+function CompactionCard({ machine }: { machine?: Machine | null }) {
+ const { t } = useTranslation();
+ const mid = machine?.id ?? null;
const [cfg, setCfg] = useState<CompactionSettings | null>(null);
const [models, setModels] = useState<string[]>([]);
const [labels, setLabels] = useState<Record<string, string>>({});
useEffect(() => {
- getSettings()
+ getSettings(mid)
.then((s) => {
setCfg({
compaction_threshold_pct: s.compaction_threshold_pct ?? 0.8,
@@ -748,34 +1217,32 @@ function CompactionCard() {
compaction_model: "",
}),
);
- }, []);
+ }, [mid]);
const save = async (patch: Partial<CompactionSettings>) => {
setCfg((p) => (p ? { ...p, ...patch } : p));
- await setCompactionSettings(patch);
+ await setCompactionSettings(patch, mid);
};
if (!cfg) return null;
const modelLabel = (id: string) => labels[id]?.split(" · ")[0] || id;
return (
<div className={CARD + " p-4 mb-4"} data-testid="compaction-card">
- <div className={FIELD_LABEL}>Context compaction</div>
+ <div className={FIELD_LABEL}>{t("settingsx.compaction.title")}</div>
<div className={FIELD_HELP}>
- Long sessions are compacted automatically: older turns are summarized so the
- coworker keeps working instead of running out of context. Your visible transcript
- is never changed — a small marker shows where compaction happened.
+ {t("settingsx.compaction.help")}
</div>
<div className="mt-3 flex items-center gap-5 flex-wrap">
<label className="flex items-center gap-2.5">
- <span className="text-[13px] text-ink">Compact at</span>
+ <span className="text-ui text-ink">{t("settingsx.compaction.compact_at")}</span>
<input
type="number"
min={10}
max={95}
value={Math.round(cfg.compaction_threshold_pct * 100)}
data-testid="compaction-threshold"
- className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) =>
save({
compaction_threshold_pct:
@@ -783,10 +1250,10 @@ function CompactionCard() {
})
}
/>
- <span className="text-[13px] text-muted">% of the context window</span>
+ <span className="text-ui text-muted">{t("settingsx.compaction.pct_of_window")}</span>
</label>
<label className="flex items-center gap-2.5">
- <span className="text-[13px] text-ink">or at</span>
+ <span className="text-ui text-ink">{t("settingsx.compaction.or_at")}</span>
<input
type="number"
min={10_000}
@@ -794,7 +1261,7 @@ function CompactionCard() {
step={10_000}
value={cfg.compaction_cap_tokens}
data-testid="compaction-cap"
- className="w-28 px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-28 px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) =>
save({
compaction_cap_tokens: Math.max(
@@ -804,23 +1271,22 @@ function CompactionCard() {
})
}
/>
- <span className="text-[13px] text-muted">tokens, whichever is smaller</span>
+ <span className="text-ui text-muted">{t("settingsx.compaction.tokens_smaller")}</span>
</label>
</div>
<div className={FIELD_HELP}>
- The cap makes very-large-context models compact early — quality and speed degrade
- well before their nominal limit.
+ {t("settingsx.compaction.cap_help")}
</div>
<div className="mt-3 flex items-center gap-2.5">
- <span className="text-[13px] text-ink">Summarizer model</span>
+ <span className="text-ui text-ink">{t("settingsx.compaction.summarizer_model")}</span>
<select
value={cfg.compaction_model}
data-testid="compaction-model"
- className="px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) => save({ compaction_model: e.target.value })}
>
- <option value="">Session&rsquo;s own model (default)</option>
+ <option value="">{t("settingsx.compaction.own_model_default")}</option>
{models.map((m) => (
<option key={m} value={m}>
{modelLabel(m)}
@@ -829,8 +1295,7 @@ function CompactionCard() {
</select>
</div>
<div className={FIELD_HELP}>
- The summary is written by this model. The default follows whatever model the
- session is using.
+ {t("settingsx.compaction.summarizer_help")}
</div>
</div>
);
@@ -867,8 +1332,8 @@ function ContextBarCard() {
onChange={(e) => save(e.target.checked)}
/>
<span>
- <span className="block text-[13px] text-ink">{t("settings.context_bar_title")}</span>
- <span className="block text-[12px] text-muted">{t("settings.context_bar_desc")}</span>
+ <span className="block text-ui text-ink">{t("settings.context_bar_title")}</span>
+ <span className="block text-meta text-muted">{t("settings.context_bar_desc")}</span>
</span>
</label>
</div>
@@ -880,6 +1345,7 @@ function ContextBarCard() {
// user-global (a cloned repo can't turn either on). Shadow is nested under the main flag — it
// only makes sense to measure the reviewer once you know what it is.
function AutoApproveCard() {
+ const { t } = useTranslation();
const [on, setOn] = useState<boolean | null>(null);
const [shadow, setShadow] = useState(false);
@@ -904,7 +1370,7 @@ function AutoApproveCard() {
if (on === null) return null;
return (
<div className={CARD + " p-4 mb-4"} data-testid="auto-approve-card">
- <div className={FIELD_LABEL}>Auto-approve (experimental)</div>
+ <div className={FIELD_LABEL}>{t("settingsx.auto_approve.title")}</div>
<label className="flex items-start gap-3 py-2">
<input
type="checkbox"
@@ -914,12 +1380,9 @@ function AutoApproveCard() {
onChange={(e) => saveOn(e.target.checked)}
/>
<span>
- <span className="block text-[13px] text-ink">Enable Auto-approve mode</span>
- <span className="block text-[12px] text-muted">
- Adds an <em>Auto-approve</em> option to the mode picker. In that mode, your session
- model reviews each action that would normally need approval and clears the routine
- ones; anything doubtful still asks you. It can never allow something the rules
- block. One extra model call per check, billed to your usage.
+ <span className="block text-ui text-ink">{t("settingsx.auto_approve.enable")}</span>
+ <span className="block text-meta text-muted">
+ <Trans i18nKey="settingsx.auto_approve.enable_desc" components={{ em: <em /> }} />
</span>
</span>
</label>
@@ -932,13 +1395,14 @@ function AutoApproveCard() {
onChange={(e) => saveShadow(e.target.checked)}
/>
<span>
- <span className="block text-[13px] text-ink">
- Shadow evaluation <span className="text-faint">(for measuring)</span>
+ <span className="block text-ui text-ink">
+ <Trans
+ i18nKey="settingsx.auto_approve.shadow_title"
+ components={{ faint: <span className="text-faint" /> }}
+ />
</span>
- <span className="block text-[12px] text-muted">
- On any mode, the reviewer records what it <em>would</em> have decided next to your
- own choice — without changing anything. Lets you see how it would behave before
- trusting it. Also costs one model call per approval.
+ <span className="block text-meta text-muted">
+ <Trans i18nKey="settingsx.auto_approve.shadow_desc" components={{ em: <em /> }} />
</span>
</span>
</label>
@@ -967,13 +1431,13 @@ function SidebarCard() {
<div className={CARD + " p-4 mb-4"}>
<div className={FIELD_LABEL}>{t("settings.sidebar_card_title")}</div>
<label className="flex items-center gap-3 mt-2.5">
- <span className="text-[13px] text-ink">{t("settings.sidebar_per_coworker")}</span>
+ <span className="text-ui text-ink">{t("settings.sidebar_per_coworker")}</span>
<input
type="number"
min={1}
max={50}
value={peek}
- className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent"
+ className="w-16 px-2 py-1.5 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent"
onChange={(e) => save(Number(e.target.value))}
/>
</label>
@@ -1047,7 +1511,7 @@ function FilesCard() {
<div className={FIELD_HELP}>
{t("settings.files_help")}
</div>
- {scratchMsg && <div className="text-[13px] text-muted mt-2.5">{scratchMsg}</div>}
+ {scratchMsg && <div className="text-ui text-muted mt-2.5">{scratchMsg}</div>}
</div>
);
}
diff --git a/surfaces/gui/src/components/SkillsTab.tsx b/surfaces/gui/src/components/SkillsTab.tsx
index 7a28acfc..a8a49670 100644
--- a/surfaces/gui/src/components/SkillsTab.tsx
+++ b/surfaces/gui/src/components/SkillsTab.tsx
@@ -1,5 +1,4 @@
import { useRef, useState } from "react";
-import { useEffect } from "react";
import { Trans, useTranslation } from "react-i18next";
import {
createSkill,
@@ -9,9 +8,12 @@ import {
stageSkillUpload,
confirmSkillUpload,
updateSkill,
+ type Machine,
type SkillRow,
type SkillUploadPreview,
} from "../api";
+import { useMachineData } from "../useMachineData";
+import { CachedNote, LoadingRow, UnreachableRow } from "./ScopedStatus";
import { Icon } from "./Icon";
// Settings ▸ Skills (SKILLS-SPEC §5/§6) — the management home: the LIST is the page; every
@@ -23,15 +25,15 @@ import { Icon } from "./Icon";
// Persona-bundled skills arrive with personas (§10), managed on the persona page, not here.
const CARD = "rounded-xl2 border border-line bg-panel";
-const FIELD_LABEL = "text-[13px] font-medium text-ink";
+const FIELD_LABEL = "text-ui font-medium text-ink";
const INPUT =
- "w-full min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent";
+ "w-full min-w-0 px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent";
const BTN_ACCENT =
- "text-[13px] px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
+ "text-ui px-3 py-2 rounded-lg bg-accent text-white shrink-0 disabled:opacity-40";
const BTN_BORDERED =
- "text-[13px] px-3 py-2 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
+ "text-ui px-3 py-2 rounded-lg border border-line bg-paper hover:border-lineStrong shrink-0";
const BADGE =
- "text-[11px] px-2 py-0.5 rounded-full border border-line bg-paper text-muted shrink-0";
+ "text-label px-2 py-0.5 rounded-full border border-line bg-paper text-muted shrink-0";
type Editor = {
mode: "new" | "edit";
@@ -69,13 +71,17 @@ async function fileToB64(file: File): Promise<string> {
export function SkillsTab({
onCreateSkill,
+ machine,
}: {
// The doorway (SKILLS-SPEC §5.2): starts a new conversation with the description
// prefilled in the composer — the worker builds the skill and proposes it via save_skill.
+ // With a machine scope, that conversation runs ON the machine.
onCreateSkill?: (description: string) => void;
+ // UX-046 machine scope: manage THIS machine's skills through the proxy.
+ machine?: Machine | null;
}) {
const { t } = useTranslation();
- const [rows, setRows] = useState<SkillRow[]>([]);
+ const mid = machine?.id ?? null;
const [editor, setEditor] = useState<Editor | null>(null);
const [upload, setUpload] = useState<SkillUploadPreview | null>(null);
const [addOpen, setAddOpen] = useState(false);
@@ -97,10 +103,11 @@ export function SkillsTab({
const OFF_NOTE = t("skills.off_note");
const DELETE_NOTE = t("skills.delete_note");
- const refresh = () => listSkills().then(setRows);
- useEffect(() => {
- refresh();
- }, []);
+ const skills = useMachineData<SkillRow[]>(`skills:${mid ?? "local"}`, () =>
+ listSkills(undefined, mid),
+ );
+ const rows = skills.data ?? [];
+ const refresh = skills.refresh;
const fail = (res: { ok?: boolean; error?: string }) => {
setNotice(null);
@@ -116,15 +123,22 @@ export function SkillsTab({
if (!editor) return;
const res =
editor.mode === "new"
- ? await createSkill({
- name: editor.name.trim(),
- description: editor.description.trim(),
- instructions: editor.instructions,
- })
- : await updateSkill(editor.name, {
- description: editor.description.trim(),
- instructions: editor.instructions,
- });
+ ? await createSkill(
+ {
+ name: editor.name.trim(),
+ description: editor.description.trim(),
+ instructions: editor.instructions,
+ },
+ mid,
+ )
+ : await updateSkill(
+ editor.name,
+ {
+ description: editor.description.trim(),
+ instructions: editor.instructions,
+ },
+ mid,
+ );
if (fail(res)) return;
setEditor(null);
if (editor.mode === "new")
@@ -134,14 +148,14 @@ export function SkillsTab({
const onPickFile = async (file: File | undefined) => {
if (!file) return;
- const res = await stageSkillUpload(await fileToB64(file), file.name);
+ const res = await stageSkillUpload(await fileToB64(file), file.name, mid);
if (fail(res)) return;
setUpload(res);
};
const confirmUpload = async () => {
if (!upload?.token) return;
- const res = await confirmSkillUpload(upload.token);
+ const res = await confirmSkillUpload(upload.token, "global", undefined, mid);
if (fail(res)) return;
setUpload(null);
setNotice({ name: upload.name || t("skills.fallback_name"), text: CONFIRMATION, tone: "ok" });
@@ -154,7 +168,7 @@ export function SkillsTab({
return;
}
setArmedDelete(null);
- const res = await deleteSkill(row.name);
+ const res = await deleteSkill(row.name, undefined, mid);
if (fail(res)) return;
setNotice({ name: row.name, text: DELETE_NOTE, tone: "warn" });
refresh();
@@ -164,8 +178,12 @@ export function SkillsTab({
<section>
<div className="flex items-start justify-between gap-3 mb-4">
<div>
- <h2 className="text-[16px] font-semibold">{t("settings.tab.skills")}</h2>
- <p className="text-[13px] text-muted mt-1 leading-relaxed">{t("skills.subtitle")}</p>
+ <h2 className="text-body font-semibold">{t("settings.tab.skills")}</h2>
+ <p className="text-ui text-muted mt-1 leading-relaxed">
+ {machine
+ ? t("settingsx.skills.machine_subtitle", { name: machine.name })
+ : t("skills.subtitle")}
+ </p>
</div>
{/* One add-action, three doors behind it (SKILLS-SPEC §5): the list is the page. */}
<div className="relative shrink-0">
@@ -195,8 +213,8 @@ export function SkillsTab({
setEditor(emptyEditor());
}}
>
- <div className="text-[13px] font-medium">{t("skills.door_write")}</div>
- <div className="text-[12px] text-muted">{t("skills.door_write_sub")}</div>
+ <div className="text-ui font-medium">{t("skills.door_write")}</div>
+ <div className="text-meta text-muted">{t("skills.door_write_sub")}</div>
</button>
<button
role="menuitem"
@@ -206,8 +224,8 @@ export function SkillsTab({
fileInput.current?.click();
}}
>
- <div className="text-[13px] font-medium">{t("skills.door_import")}</div>
- <div className="text-[12px] text-muted">{t("skills.door_import_sub")}</div>
+ <div className="text-ui font-medium">{t("skills.door_import")}</div>
+ <div className="text-meta text-muted">{t("skills.door_import_sub")}</div>
</button>
<button
role="menuitem"
@@ -218,8 +236,8 @@ export function SkillsTab({
onCreateSkill?.("");
}}
>
- <div className="text-[13px] font-medium">{t("skills.door_ai")}</div>
- <div className="text-[12px] text-muted">{t("skills.door_ai_sub")}</div>
+ <div className="text-ui font-medium">{t("skills.door_ai")}</div>
+ <div className="text-meta text-muted">{t("skills.door_ai_sub")}</div>
</button>
</div>
</>
@@ -239,7 +257,7 @@ export function SkillsTab({
/>
{error ? (
- <div className="text-[13px] text-red-500 mb-3" role="alert">
+ <div className="text-ui text-red-500 mb-3" role="alert">
{error}
</div>
) : null}
@@ -247,7 +265,7 @@ export function SkillsTab({
<div
role="status"
className={
- "mb-3 flex items-start gap-2 rounded-lg border px-3 py-2 text-[13px] " +
+ "mb-3 flex items-start gap-2 rounded-lg border px-3 py-2 text-ui " +
(notice.tone === "ok"
? "bg-tealSoft/70 text-tealInk border-tealInk/20"
: "bg-warnSoft/70 text-warnInk border-warnInk/20")
@@ -268,17 +286,17 @@ export function SkillsTab({
{upload ? (
<div className={`${CARD} p-4 mb-4`}>
- <div className="text-[13px] font-medium mb-1">{t("skills.review_title")}</div>
- <p className="text-[13px] text-muted mb-3">{t("skills.review_sub")}</p>
- <div className="text-[13px] mb-1">
+ <div className="text-ui font-medium mb-1">{t("skills.review_title")}</div>
+ <p className="text-ui text-muted mb-3">{t("skills.review_sub")}</p>
+ <div className="text-ui mb-1">
<span className="font-medium">{upload.name}</span>
<span className="text-muted"> — {upload.description || t("skills.no_description")}</span>
</div>
- <pre className="text-[12px] bg-paper border border-line rounded-lg p-3 whitespace-pre-wrap max-h-64 overflow-y-auto mb-2">
+ <pre className="text-meta bg-paper border border-line rounded-lg p-3 whitespace-pre-wrap max-h-64 overflow-y-auto mb-2">
{upload.instructions}
</pre>
{upload.files?.length ? (
- <div className="text-[12px] text-muted mb-2">
+ <div className="text-meta text-muted mb-2">
{t("skills.bundled_files", { files: upload.files.join(", ") })}
</div>
) : null}
@@ -295,7 +313,7 @@ export function SkillsTab({
{editor ? (
<div className={`${CARD} p-4 mb-4`}>
- <div className="text-[13px] font-medium mb-3">
+ <div className="text-ui font-medium mb-3">
{editor.mode === "new"
? t("skills.editor_new")
: t("skills.editor_edit", { name: editor.name })}
@@ -346,9 +364,20 @@ export function SkillsTab({
</div>
) : null}
+ {skills.cachedAt ? <CachedNote at={skills.cachedAt} /> : null}
<div className={`${CARD} divide-y divide-line`}>
- {rows.length === 0 && !editor ? (
- <div className="p-5 text-[13px] text-muted">
+ {skills.loading && !skills.data ? (
+ <LoadingRow
+ what={
+ machine
+ ? t("settingsx.skills.loading_what_on", { name: machine.name })
+ : t("settingsx.skills.loading_what")
+ }
+ />
+ ) : skills.error && !skills.data && machine ? (
+ <UnreachableRow machineName={machine.name} />
+ ) : rows.length === 0 && !editor ? (
+ <div className="p-5 text-ui text-muted">
<Trans i18nKey="skills.empty" components={{ b: <b /> }} />
</div>
) : null}
@@ -356,7 +385,7 @@ export function SkillsTab({
<div key={row.name} className="flex items-center gap-3 px-4 py-3">
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
- <span className={`text-[13px] font-medium ${row.enabled ? "" : "text-muted"}`}>
+ <span className={`text-ui font-medium ${row.enabled ? "" : "text-muted"}`}>
{row.name}
</span>
{row.source !== "local" ? <span className={BADGE}>{row.source}</span> : null}
@@ -364,18 +393,27 @@ export function SkillsTab({
chip with a folder icon so it READS as clickable (live drive: plain
text hid the affordance). */}
{row.files ? (
- <button
- className="inline-flex items-center gap-1 text-[11px] px-1.5 py-0.5 rounded-md border border-line bg-paper text-muted hover:text-ink hover:border-lineStrong shrink-0"
- title={t("skills.show_folder")}
- onClick={() => revealSkill(row.name)}
- >
- <Icon name="folder" size={11} /> {t("skills.file_count", { count: row.files })}
- </button>
+ machine ? (
+ <span
+ className="inline-flex items-center gap-1 text-label px-1.5 py-0.5 rounded-md border border-line bg-paper text-muted shrink-0"
+ title={t("settingsx.skills.files_live_on", { name: machine.name })}
+ >
+ <Icon name="folder" size={11} /> {t("skills.file_count", { count: row.files })}
+ </span>
+ ) : (
+ <button
+ className="inline-flex items-center gap-1 text-label px-1.5 py-0.5 rounded-md border border-line bg-paper text-muted hover:text-ink hover:border-lineStrong shrink-0"
+ title={t("skills.show_folder")}
+ onClick={() => revealSkill(row.name)}
+ >
+ <Icon name="folder" size={11} /> {t("skills.file_count", { count: row.files })}
+ </button>
+ )
) : null}
</div>
{/* Full description, wrapping — a skill's one-liner is its menu entry; cutting
it mid-word hid what the skill does (live drive). */}
- <div className="text-[12px] text-muted leading-relaxed">{row.description}</div>
+ <div className="text-meta text-muted leading-relaxed">{row.description}</div>
</div>
<button
className={BTN_BORDERED}
@@ -403,7 +441,7 @@ export function SkillsTab({
<Icon name="trash" size={13} />
)}
</button>
- <label className="inline-flex items-center gap-1.5 text-[12px] text-muted">
+ <label className="inline-flex items-center gap-1.5 text-meta text-muted">
<input
type="checkbox"
role="switch"
@@ -411,7 +449,7 @@ export function SkillsTab({
checked={row.enabled}
onChange={(e) => {
const on = e.target.checked;
- updateSkill(row.name, { enabled: on }).then((res) => {
+ updateSkill(row.name, { enabled: on }, mid).then((res) => {
if (!fail(res))
setNotice({
name: row.name,
diff --git a/surfaces/gui/src/components/WalletChips.test.tsx b/surfaces/gui/src/components/WalletChips.test.tsx
new file mode 100644
index 00000000..8ba7a483
--- /dev/null
+++ b/surfaces/gui/src/components/WalletChips.test.tsx
@@ -0,0 +1,80 @@
+// Keys wallet W3: the "Available on" chips — deploy/revoke/stale-redeploy.
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
+import { WalletChips } from "./WalletChips";
+
+afterEach(cleanup);
+
+let deployCalls: string[][] = [];
+let revokeCalls: string[][] = [];
+let secretRows: { profile: string; deployed_at: number; stale: boolean; missing_from_wallet: boolean }[] = [];
+
+const machinesPayload = {
+ machines: [
+ { id: "m1", name: "demo-vm", fingerprint: "f", app_version: "0.2.0", created_at: 1, last_seen: 1, connected: true },
+ { id: "m2", name: "old-macpro", fingerprint: "g", app_version: "0.1.9", created_at: 1, last_seen: 1, connected: false },
+ ],
+ armed: false,
+};
+
+beforeEach(() => {
+ deployCalls = [];
+ revokeCalls = [];
+ secretRows = [];
+ vi.stubGlobal(
+ "fetch",
+ vi.fn(async (input: RequestInfo | URL, init?: RequestInit) => {
+ const url = String(input);
+ if (/\/v1\/machines$/.test(url)) return { json: async () => machinesPayload } as Response;
+ if (/\/v1\/machines\/[^/]+\/secrets$/.test(url)) {
+ if (init?.method === "POST") {
+ deployCalls.push(JSON.parse(String(init.body)).profiles);
+ return { json: async () => ({ ok: true }) } as Response;
+ }
+ if (init?.method === "DELETE") {
+ revokeCalls.push(JSON.parse(String(init.body)).profiles);
+ return { json: async () => ({ ok: true }) } as Response;
+ }
+ return { json: async () => ({ secrets: secretRows }) } as Response;
+ }
+ return { json: async () => ({}) } as Response;
+ }),
+ );
+});
+
+describe("WalletChips", () => {
+ it("renders This Mac + machine chips; offline machines are disabled", async () => {
+ render(<WalletChips profiles={["provider:openai"]} />);
+ await waitFor(() => expect(screen.getByTestId("wallet-chip-demo-vm")).toBeTruthy());
+ expect(screen.getByText("This Mac")).toBeTruthy();
+ expect((screen.getByTestId("wallet-chip-old-macpro") as HTMLButtonElement).disabled).toBe(true);
+ expect((screen.getByTestId("wallet-chip-demo-vm") as HTMLButtonElement).disabled).toBe(false);
+ });
+
+ it("clicking an undeployed chip deploys; a deployed chip revokes", async () => {
+ render(<WalletChips profiles={["provider:openai"]} />);
+ await waitFor(() => expect(screen.getByTestId("wallet-chip-demo-vm")).toBeTruthy());
+ fireEvent.click(screen.getByTestId("wallet-chip-demo-vm"));
+ await waitFor(() => expect(deployCalls).toEqual([["provider:openai"]]));
+
+ cleanup();
+ secretRows = [{ profile: "provider:openai", deployed_at: 1, stale: false, missing_from_wallet: false }];
+ render(<WalletChips profiles={["provider:openai"]} />);
+ await waitFor(() =>
+ expect(screen.getByTestId("wallet-chip-demo-vm").textContent).toContain("✓"),
+ );
+ fireEvent.click(screen.getByTestId("wallet-chip-demo-vm"));
+ await waitFor(() => expect(revokeCalls).toEqual([["provider:openai"]]));
+ });
+
+ it("a stale chip shows the rotate marker and re-deploys on click", async () => {
+ secretRows = [{ profile: "provider:openai", deployed_at: 1, stale: true, missing_from_wallet: false }];
+ render(<WalletChips profiles={["provider:openai"]} />);
+ await waitFor(() =>
+ expect(screen.getByTestId("wallet-chip-demo-vm").textContent).toContain("↻"),
+ );
+ fireEvent.click(screen.getByTestId("wallet-chip-demo-vm"));
+ await waitFor(() => expect(deployCalls).toEqual([["provider:openai"]]));
+ expect(revokeCalls).toEqual([]);
+ });
+});
diff --git a/surfaces/gui/src/components/WalletChips.tsx b/surfaces/gui/src/components/WalletChips.tsx
new file mode 100644
index 00000000..afaed38d
--- /dev/null
+++ b/surfaces/gui/src/components/WalletChips.tsx
@@ -0,0 +1,131 @@
+import { useCallback, useEffect, useState } from "react";
+import { useTranslation } from "react-i18next";
+import {
+ deployMachineSecrets,
+ getMachines,
+ getMachineSecrets,
+ revokeMachineSecrets,
+ type Machine,
+} from "../api";
+
+// Keys wallet (remote-home-design.md §Keys wallet W3): the "Available on" row a
+// provider/connector card grows once ≥1 machine is enrolled. This Mac is fixed
+// (the wallet lives here); each ⌂ chip toggles deploy/revoke for ONE profile on
+// ONE machine. Deploy = copy — the machine owns its copy; a wallet update after
+// deploy shows as a stale chip whose click re-deploys (rotate = deploy again).
+
+interface ChipState {
+ machine: Machine;
+ deployed: boolean;
+ stale: boolean;
+}
+
+export function WalletChips({
+ profiles,
+ caption,
+}: {
+ // Deployed/revoked as ONE unit; the first profile is the presence marker in
+ // the ledger (e.g. a connector account + its default pointer travel together).
+ profiles: string[];
+ caption?: string;
+}) {
+ const { t } = useTranslation();
+ const marker = profiles[0];
+ const [chips, setChips] = useState<ChipState[] | null>(null);
+ const [busy, setBusy] = useState<string | null>(null); // machine id in flight
+ const [error, setError] = useState<string | null>(null);
+
+ const refresh = useCallback(async () => {
+ try {
+ const { machines } = await getMachines();
+ if (!machines.length) {
+ setChips([]);
+ return;
+ }
+ const states = await Promise.all(
+ machines.map(async (m) => {
+ try {
+ const rows = await getMachineSecrets(m.id);
+ const row = rows.find((r) => r.profile === marker);
+ return { machine: m, deployed: !!row, stale: !!row?.stale };
+ } catch {
+ return { machine: m, deployed: false, stale: false };
+ }
+ }),
+ );
+ setChips(states);
+ } catch {
+ setChips([]);
+ }
+ }, [marker]);
+
+ useEffect(() => {
+ void refresh();
+ }, [refresh]);
+
+ const toggle = async (chip: ChipState) => {
+ setBusy(chip.machine.id);
+ setError(null);
+ try {
+ // Stale chip re-deploys (rotation); deployed+fresh revokes; absent deploys.
+ const r =
+ chip.deployed && !chip.stale
+ ? await revokeMachineSecrets(chip.machine.id, profiles)
+ : await deployMachineSecrets(chip.machine.id, profiles);
+ if (r.error) setError(r.error);
+ } finally {
+ setBusy(null);
+ void refresh();
+ }
+ };
+
+ if (!chips || chips.length === 0) return null; // zero machines ⇒ the row doesn't exist
+
+ return (
+ <div className="mt-4" data-testid="wallet-chips">
+ <div className="text-meta font-medium text-ink mb-1.5">{t("machines.wallet.available_on")}</div>
+ <div className="flex items-center gap-1.5 flex-wrap">
+ <span className="inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border border-line bg-paper text-meta text-muted">
+ {t("machines.this_mac")} <span className="text-ok">✓</span>
+ </span>
+ {chips.map((c) => (
+ <button
+ key={c.machine.id}
+ className={
+ "inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full border text-meta " +
+ (c.deployed
+ ? "border-okLine bg-okSoft text-ink"
+ : "border-line bg-paper text-muted hover:text-ink hover:border-lineStrong") +
+ (!c.machine.connected ? " opacity-45 cursor-not-allowed" : "")
+ }
+ disabled={!c.machine.connected || busy === c.machine.id}
+ title={
+ !c.machine.connected
+ ? t("machines.wallet.offline")
+ : c.stale
+ ? t("machines.wallet.stale_click")
+ : c.deployed
+ ? t("machines.wallet.deployed_click")
+ : t("machines.wallet.deploy_click")
+ }
+ data-testid={`wallet-chip-${c.machine.name}`}
+ onClick={() => void toggle(c)}
+ >
+ ⌂ {c.machine.name}
+ {busy === c.machine.id ? (
+ <span className="w-[9px] h-[9px] rounded-full border-[1.5px] border-faint border-t-transparent animate-spin" />
+ ) : c.stale ? (
+ <span className="text-warnInk" title={t("machines.wallet.stale")}>↻</span>
+ ) : c.deployed ? (
+ <span className="text-ok">✓</span>
+ ) : null}
+ </button>
+ ))}
+ </div>
+ <p className="text-label text-faint mt-1.5 leading-relaxed">
+ {caption || t("machines.wallet.caption")}
+ </p>
+ {error && <div className="text-meta text-warnInk mt-1">{error}</div>}
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/connectors/AccountsDetail.tsx b/surfaces/gui/src/components/connectors/AccountsDetail.tsx
index a42372fa..8c512b39 100644
--- a/surfaces/gui/src/components/connectors/AccountsDetail.tsx
+++ b/surfaces/gui/src/components/connectors/AccountsDetail.tsx
@@ -10,6 +10,7 @@ import { ConnectorBadge } from "../../connectors/ConnectorIcon";
import { ConnectSetup } from "../ManageTabs";
import type { DetailProps } from "./ConnectorsSection";
import { ToolsDisclosure } from "./ToolsDisclosure";
+import { WalletChips } from "../WalletChips";
import { FOOT, GRP, GRP_H, PILL_ACCENT, ROW, TAG_ACCENT, XBTN } from "./ui";
// The generic detail page for multi-account connectors on the accounts layer
@@ -37,10 +38,10 @@ export function AccountsDetail({ c, cloud, slack: _slack, onChanged }: DetailPro
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title={c.title} />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">
{c.title}
</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span className="w-2 h-2 rounded-full bg-ok" />
@@ -76,6 +77,22 @@ export function AccountsDetail({ c, cloud, slack: _slack, onChanged }: DetailPro
<Row key={a.account_id} connector={c.name} a={a} onChanged={onChanged} />
))}
</div>
+ {/* Keys wallet: the DEFAULT token account (never a managed OAuth grant —
+ refresh tokens don't share; each home consents on its own) can deploy
+ to machines. The account travels with the default pointer so the box
+ actually uses it. */}
+ {(() => {
+ const deployable = accounts.find((a) => a.default && !a.managed);
+ return deployable ? (
+ <WalletChips
+ profiles={[
+ `${c.name}:account:${deployable.account_id}`,
+ `${c.name}:default`,
+ ]}
+ caption={t("settingsx.accounts.wallet_caption")}
+ />
+ ) : null;
+ })()}
</>
)}
@@ -121,9 +138,9 @@ function Row({
return (
<div className={ROW} data-testid={`account-${a.account_id}`}>
<span className="min-w-0 flex-1 flex items-center gap-2">
- <span className="text-[13px] font-medium truncate">{a.name}</span>
+ <span className="text-ui font-medium truncate">{a.name}</span>
{a.name !== a.account_id && (
- <span className="text-[11px] text-faint truncate" title={a.account_id}>
+ <span className="text-label text-faint truncate" title={a.account_id}>
{a.account_id}
</span>
)}
@@ -135,7 +152,7 @@ function Row({
</span>
{!a.default && (
<button
- className="text-[12px] text-muted hover:text-ink shrink-0"
+ className="text-meta text-muted hover:text-ink shrink-0"
title={t("accounts.default_tip")}
data-testid={`account-make-default-${a.account_id}`}
onClick={async () => {
diff --git a/surfaces/gui/src/components/connectors/AddConnectionModal.tsx b/surfaces/gui/src/components/connectors/AddConnectionModal.tsx
index 61783405..303b88c2 100644
--- a/surfaces/gui/src/components/connectors/AddConnectionModal.tsx
+++ b/surfaces/gui/src/components/connectors/AddConnectionModal.tsx
@@ -19,7 +19,7 @@ import { PILL_ACCENT, PILL_LINE, TAG_ACCENT } from "./ui";
// existing ConnectSetup directly (Gmail's managed flow skips the modal entirely).
const INPUT =
- "w-full px-3 py-2 rounded-lg border border-line bg-paper text-[13px] text-ink outline-none focus:border-accent";
+ "w-full px-3 py-2 rounded-lg border border-line bg-paper text-ui text-ink outline-none focus:border-accent";
export function AddConnectionModal({
c,
@@ -66,10 +66,10 @@ export function AddConnectionModal({
>
<div className="flex items-center gap-3 px-5 pt-5">
<ConnectorBadge connector={c} size={34} title={c.title} />
- <div className="flex-1 font-semibold text-[16px] tracking-tight">
+ <div className="flex-1 font-semibold text-body tracking-tight">
{title || defaultTitle}
</div>
- <button className="text-faint hover:text-ink text-[20px] leading-none" onClick={onClose} title={t("modal.close")}>
+ <button className="text-faint hover:text-ink text-title leading-none" onClick={onClose} title={t("modal.close")}>
×
</button>
</div>
@@ -77,7 +77,7 @@ export function AddConnectionModal({
{twoModes ? (
<>
<div className="px-5 pt-4">
- <div className="inline-flex rounded-full p-0.5 bg-paper text-[13px] font-medium">
+ <div className="inline-flex rounded-full p-0.5 bg-paper text-ui font-medium">
{(["one", "manual"] as const).map((p) => (
<button
key={p}
@@ -155,7 +155,7 @@ function McpOneClick({ c, onConnected }: { c: Connector; onConnected: () => void
};
return (
<div className="px-5 py-4 space-y-3">
- <p className="text-[13px] text-muted">
+ <p className="text-ui text-muted">
{tt("modal.mcp_blurb", { title: c.title })}
</p>
<button
@@ -166,8 +166,8 @@ function McpOneClick({ c, onConnected }: { c: Connector; onConnected: () => void
>
{waiting ? tt("cloud.check_browser") : tt("modal.connect_title", { title: c.title })}
</button>
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-faint text-center flex items-center justify-center gap-1.5">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-faint text-center flex items-center justify-center gap-1.5">
<span className={TAG_ACCENT}>{tt("modal.recommended")}</span> {tt("modal.mcp_recommended_foot", { title: c.title })}
</p>
</div>
@@ -188,7 +188,7 @@ function GenericOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
};
return (
<div className="px-5 py-4 space-y-3">
- <p className="text-[13px] text-muted">
+ <p className="text-ui text-muted">
{tt("modal.generic_blurb", { title: c.title })}
</p>
{cloud?.signed_in ? (
@@ -205,8 +205,8 @@ function GenericOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
) : (
<CloudStatusPending />
)}
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-faint text-center flex items-center justify-center gap-1.5">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-faint text-center flex items-center justify-center gap-1.5">
<span className={TAG_ACCENT}>{tt("modal.recommended")}</span> {tt("modal.tokens_stay_local")}
</p>
</div>
@@ -225,7 +225,7 @@ function SlackOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null }
};
return (
<div className="px-5 py-4 space-y-3">
- <p className="text-[13px] text-muted">
+ <p className="text-ui text-muted">
{tt("modal.slack_blurb")}
</p>
{cloud?.signed_in ? (
@@ -237,8 +237,8 @@ function SlackOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null }
) : (
<CloudStatusPending />
)}
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-faint text-center flex items-center justify-center gap-1.5">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-faint text-center flex items-center justify-center gap-1.5">
<span className={TAG_ACCENT}>{tt("modal.recommended")}</span> {tt("modal.slack_recommended_foot")}
</p>
</div>
@@ -257,7 +257,7 @@ function GithubOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
};
return (
<div className="px-5 py-4 space-y-3">
- <p className="text-[13px] text-muted">
+ <p className="text-ui text-muted">
{tt("modal.github_blurb")}
</p>
{cloud?.signed_in ? (
@@ -272,8 +272,8 @@ function GithubOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
) : (
<CloudStatusPending />
)}
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-faint text-center flex items-center justify-center gap-1.5">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-faint text-center flex items-center justify-center gap-1.5">
<span className={TAG_ACCENT}>{tt("modal.recommended")}</span> {tt("modal.github_recommended_foot")}
</p>
</div>
@@ -293,7 +293,7 @@ function HubSpotOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
};
return (
<div className="px-5 py-4 space-y-3">
- <p className="text-[13px] text-muted">
+ <p className="text-ui text-muted">
{tt("modal.hubspot_blurb")}
</p>
<div className="space-y-1.5" data-testid="hubspot-access">
@@ -303,7 +303,7 @@ function HubSpotOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
["write", tt("modal.hubspot_readwrite"), tt("modal.hubspot_readwrite_blurb")],
] as const
).map(([value, label, blurb]) => (
- <label key={value} className="flex items-start gap-2 text-[13px] cursor-pointer">
+ <label key={value} className="flex items-start gap-2 text-ui cursor-pointer">
<input
type="radio"
name="hubspot-access"
@@ -314,7 +314,7 @@ function HubSpotOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
/>
<span>
<span className="font-medium">{label}</span>
- <span className="block text-[12px] text-muted">{blurb}</span>
+ <span className="block text-meta text-muted">{blurb}</span>
</span>
</label>
))}
@@ -328,8 +328,8 @@ function HubSpotOneClick({ c, cloud }: { c: Connector; cloud: CloudStatus | null
) : (
<CloudStatusPending />
)}
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-faint text-center">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-faint text-center">
{tt("modal.hubspot_foot")}
</p>
</div>
@@ -352,7 +352,7 @@ function SlackManual({ onConnected }: { onConnected: () => void }) {
};
return (
<div className="px-5 py-4 space-y-3">
- <ol className="list-decimal pl-4 text-[13px] text-muted space-y-1">
+ <ol className="list-decimal pl-4 text-ui text-muted space-y-1">
<li>{tt("modal.slack_manual_step1")}</li>
<li>{tt("modal.slack_manual_step2")}</li>
<li>{tt("modal.slack_manual_step3")}</li>
@@ -362,8 +362,8 @@ function SlackManual({ onConnected }: { onConnected: () => void }) {
<button className={PILL_LINE + " w-full !py-2"} onClick={submit} disabled={busy || !bot.trim() || !app.trim()}>
{busy ? tt("modal.validating") : tt("modal.connect")}
</button>
- {error && <div className="text-[13px] text-danger">{error}</div>}
- <p className="text-[12px] text-warnInk text-center">
+ {error && <div className="text-ui text-danger">{error}</div>}
+ <p className="text-meta text-warnInk text-center">
{tt("modal.slack_manual_pause_note")}
</p>
</div>
diff --git a/surfaces/gui/src/components/connectors/AvailableDetail.tsx b/surfaces/gui/src/components/connectors/AvailableDetail.tsx
index a59616f0..cff539ad 100644
--- a/surfaces/gui/src/components/connectors/AvailableDetail.tsx
+++ b/surfaces/gui/src/components/connectors/AvailableDetail.tsx
@@ -31,8 +31,8 @@ export function AvailableDetail({
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title={c.title} />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">{c.title}</h2>
- <div className="text-[13px] text-muted">{c.blurb}</div>
+ <h2 className="text-title font-semibold tracking-tight leading-tight">{c.title}</h2>
+ <div className="text-ui text-muted">{c.blurb}</div>
</div>
<button
className={PILL_ACCENT}
@@ -43,14 +43,14 @@ export function AvailableDetail({
</button>
</div>
- {c.about && <p className="text-[13px] text-ink/90 leading-relaxed mb-1 px-0.5">{c.about}</p>}
+ {c.about && <p className="text-ui text-ink/90 leading-relaxed mb-1 px-0.5">{c.about}</p>}
{(c.access?.length ?? 0) > 0 && (
<>
<div className={GRP_H}>{tt("available.access")}</div>
<div className={GRP} data-testid="available-access">
{c.access!.map((line) => (
- <div key={line} className={ROW + " !min-h-[36px] !py-2 text-[13px]"}>
+ <div key={line} className={ROW + " !min-h-[36px] !py-2 text-ui"}>
{line}
</div>
))}
@@ -66,21 +66,21 @@ export function AvailableDetail({
<div className={GRP_H}>{tt("available.tools")}</div>
<div className={GRP}>
<button
- className={ROW + " w-full text-left hover:bg-paper/60 text-[13px]"}
+ className={ROW + " w-full text-left hover:bg-paper/60 text-ui"}
data-testid="available-tools-toggle"
onClick={() => setShowTools((v) => !v)}
>
<span className="min-w-0 flex-1 text-muted">
{tt("available.tools_added", { count: tools.length })}
</span>
- <span className="text-faint text-[13px] shrink-0">{showTools ? tt("available.hide") : tt("available.view")}</span>
+ <span className="text-faint text-ui shrink-0">{showTools ? tt("available.hide") : tt("available.view")}</span>
</button>
{showTools &&
tools.map((tool) => (
<div key={tool.name} className={ROW + " !min-h-[38px]"}>
<span className="min-w-0 flex-1">
- <span className="text-[13px]">{tool.label}</span>
- <span className="block text-[12px] text-muted">{tool.description}</span>
+ <span className="text-ui">{tool.label}</span>
+ <span className="block text-meta text-muted">{tool.description}</span>
</span>
{/* Same chip, same tooltip, as the connected page's tool list. */}
<ApprovalChip kind={tool.kind !== "read" ? "asks_first" : "read"} />
diff --git a/surfaces/gui/src/components/connectors/CalendarDetail.tsx b/surfaces/gui/src/components/connectors/CalendarDetail.tsx
index f11019ab..986a9a10 100644
--- a/surfaces/gui/src/components/connectors/CalendarDetail.tsx
+++ b/surfaces/gui/src/components/connectors/CalendarDetail.tsx
@@ -31,10 +31,10 @@ export function CalendarDetail({ c, cloud, slack: _slack, onChanged }: DetailPro
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title={t("calendar.google_calendar")} />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">
Google Calendar
</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span className="w-2 h-2 rounded-full bg-ok" />
@@ -66,7 +66,7 @@ export function CalendarDetail({ c, cloud, slack: _slack, onChanged }: DetailPro
{!c.connected && (
<div className={GRP}>
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("calendar.setup_blurb")}
{cloud?.signed_in ? "" : " " + t("calendar.requires_cloud")}
</div>
@@ -98,13 +98,13 @@ function AccountRow({ a, onChanged }: { a: GmailAccount; onChanged: () => void }
return (
<div className={ROW} data-testid={`gcal-account-${a.email}`}>
<span className="min-w-0 flex-1 flex items-center gap-2">
- <span className="text-[13px] font-medium truncate">{a.email}</span>
+ <span className="text-ui font-medium truncate">{a.email}</span>
{a.default && <span className={TAG_ACCENT}>{t("connector.default")}</span>}
{a.needs_reauth && <span className={TAG_WARN}>{t("calendar.sign_in_again")}</span>}
</span>
{!a.default && (
<button
- className="text-[12px] text-muted hover:text-ink shrink-0"
+ className="text-meta text-muted hover:text-ink shrink-0"
data-testid={`gcal-make-default-${a.email}`}
onClick={async () => {
await setGcalDefaultAccount(a.email);
diff --git a/surfaces/gui/src/components/connectors/CloudSignIn.tsx b/surfaces/gui/src/components/connectors/CloudSignIn.tsx
index 4b3c2e2e..febec650 100644
--- a/surfaces/gui/src/components/connectors/CloudSignIn.tsx
+++ b/surfaces/gui/src/components/connectors/CloudSignIn.tsx
@@ -16,7 +16,7 @@ export function CloudSignInInline({ blurb }: { blurb?: string }) {
return (
<div className="space-y-1.5">
<button
- className="w-full px-3 py-2 rounded-lg border border-accent text-accent text-[13px] font-medium hover:bg-accentSoft/40"
+ className="w-full px-3 py-2 rounded-lg border border-accent text-accent text-ui font-medium hover:bg-accentSoft/40"
data-testid="inline-cloud-sign-in"
onClick={async () => {
setWaiting(true);
@@ -30,8 +30,8 @@ export function CloudSignInInline({ blurb }: { blurb?: string }) {
>
{waiting ? t("cloud.check_browser") : t("cloud.sign_in")}
</button>
- <div className="text-[12px] text-faint">
- {blurb || "Sign-in unlocks one-click connects — or switch to Manual, which works without it."}
+ <div className="text-meta text-faint">
+ {blurb || t("misc.cloud_signin.blurb")}
</div>
</div>
);
@@ -44,7 +44,7 @@ export function CloudStatusPending() {
const { t } = useTranslation();
return (
<div
- className="text-[12px] text-faint py-2 text-center"
+ className="text-meta text-faint py-2 text-center"
data-testid="cloud-status-pending"
>
{t("cloud.checking")}
diff --git a/surfaces/gui/src/components/connectors/ConfigurationsSection.tsx b/surfaces/gui/src/components/connectors/ConfigurationsSection.tsx
new file mode 100644
index 00000000..c5553825
--- /dev/null
+++ b/surfaces/gui/src/components/connectors/ConfigurationsSection.tsx
@@ -0,0 +1,682 @@
+import { useEffect, useMemo, useState } from "react";
+import type { TFunction } from "i18next";
+import { useTranslation } from "react-i18next";
+import {
+ addConfiguration,
+ deleteConfiguration,
+ editConfiguration,
+ getAllSessions,
+ getConfigurations,
+ getMachineSettings,
+ getPersonasIndex,
+ getSettings,
+ listSkills,
+ removeCloudSubscription,
+ type CloudSubscription,
+ type Configuration,
+ type ConfigurationTarget,
+ type Persona,
+} from "../../api";
+import type { SessionInfo } from "../../types";
+type SessionRow = SessionInfo;
+import { FOOT, GRP, GRP_H, PILL_ACCENT, PILL_LINE, ROW, XBTN } from "./ui";
+
+// UX-050 (owner, 2026-09-04): the GitHub glance page IS its configurations.
+// A row = repositories × event × who may trigger it × where it goes. Add and
+// Delete; Edit changes who and the target only (repositories and the event
+// are fixed — delete and add). A session's own repo subscription (from its
+// Access panel) shows here as "Mention → existing session". The installation
+// default (the routing line + People) is the first row; it is what answers a
+// plain @mention nothing else covers.
+
+// label / hint are locale keys (hint "" = none).
+export const EVENTS: { value: string; label: string; hint: string }[] = [
+ { value: "mention", label: "connconfig.event_mention", hint: "connconfig.event_mention_hint" },
+ { value: "named_mention", label: "connconfig.event_named_mention", hint: "connconfig.event_named_mention_hint" },
+ { value: "pr_open", label: "connconfig.event_pr_open", hint: "connconfig.event_pr_open_hint" },
+ { value: "pr_merge", label: "connconfig.event_pr_merge", hint: "" },
+ { value: "issue_open", label: "connconfig.event_issue_open", hint: "" },
+];
+
+// Spec §11.5: the three approval modes a configuration may pick for the sessions it spawns
+// (Custom is not offered). Wire values match the box's Mode enum. label / hint are locale keys.
+const APPROVAL_MODES: { value: string; label: string; hint: string }[] = [
+ { value: "auto-approve", label: "composer.mode.auto_approve", hint: "connconfig.mode_auto_approve_hint" },
+ { value: "interactive", label: "connconfig.mode_manual", hint: "connconfig.mode_manual_hint" },
+ { value: "bypass-approvals", label: "composer.mode.auto", hint: "connconfig.mode_bypass_hint" },
+];
+
+const eventLabel = (e: string, t: TFunction) => {
+ const ev = EVENTS.find((x) => x.value === e);
+ return ev ? t(ev.label) : e;
+};
+const shortModel = (m: string) => (m.includes(":") ? m.split(":").slice(1).join(":") : m);
+const INPUT = "text-ui px-2 py-1 rounded-lg border border-line bg-paper text-ink outline-none";
+const NAME_RE = /^[a-z0-9][a-z0-9-]{0,31}$/;
+
+export interface MachineRef {
+ id: string; // broker id ("desktop" | machine id)
+ name: string;
+ glyph: string;
+ guiId: string | null; // the GUI id for proxied reads (null = the local engine)
+}
+
+export function ConfigurationsSection({
+ holders,
+ installationId,
+ owner,
+ cloudSubs,
+ onChanged,
+}: {
+ holders: MachineRef[];
+ installationId: string;
+ owner: string; // the installation's account login ("All repositories in <owner>")
+ cloudSubs: CloudSubscription[]; // legacy repo subscriptions (github:*)
+ onChanged: () => void;
+}) {
+ const { t } = useTranslation();
+ const [rows, setRows] = useState<Configuration[]>([]);
+ const [dialog, setDialog] = useState<{ mode: "add" } | { mode: "edit"; cfg: Configuration } | null>(null);
+ const [err, setErr] = useState<string | null>(null);
+ const load = () => {
+ getConfigurations("github").then(setRows).catch(() => setRows([]));
+ };
+ useEffect(load, [installationId]);
+ const reload = () => {
+ load();
+ onChanged();
+ };
+ const holderName = (id: string) => holders.find((h) => h.id === id);
+ // The " · " line is a list of independent segments, each one its own key.
+ const targetLine = (tg: ConfigurationTarget) => {
+ const m = holderName(tg.machine_id);
+ const where = m ? `${m.glyph} ${m.name}` : tg.machine_id;
+ if (tg.kind === "existing") return [t("connconfig.existing"), tg.title || tg.session_id, where].join(" · ");
+ const modeKey = APPROVAL_MODES.find((x) => x.value === (tg.approval_mode || "auto-approve"))?.label;
+ const mode = modeKey ? t(modeKey) : tg.approval_mode;
+ return [
+ t("connconfig.new_session"),
+ tg.persona || t("connconfig.default_coworker_lower"),
+ ...(tg.models?.[0] ? [shortModel(tg.models[0])] : []),
+ where,
+ ...(tg.base_dir ? [t(tg.worktree === false ? "connconfig.target_in_dir" : "connconfig.target_worktree_under", { dir: tg.base_dir })] : []),
+ tg.unattended === false ? mode : t("connconfig.target_mode_to_inbox", { mode }),
+ ].join(" · ");
+ };
+ const repoLabel = (r: string) => (r.includes("/") ? r.split("/")[1] : t("connconfig.all_repos"));
+ // The installation default: the owner-level Mention row, created at connect.
+ const isDefault = (c: Configuration) => c.event === "mention" && c.repos.length === 1 && !c.repos[0].includes("/");
+ const subRows = cloudSubs.filter((s) => s.source.startsWith("github:"));
+
+ return (
+ <>
+ <div className={GRP_H + " flex items-center"}>
+ <span>{t("connconfig.heading", { n: rows.length + subRows.length })}</span>
+ <button className={PILL_LINE + " ml-auto !py-0.5"} data-testid="cfg-add" onClick={() => setDialog({ mode: "add" })}>
+ {t("connconfig.add_configuration_btn")}
+ </button>
+ </div>
+ <div className={GRP} data-testid="glance-configurations">
+ {rows.map((c) => (
+ <div className={ROW} key={c.config_id} data-testid={`glance-cfg-${c.config_id}`}>
+ <div className="min-w-0 flex-1">
+ <div className="text-ui text-ink truncate">
+ <span className="font-medium">{c.repos.map(repoLabel).join(", ")}</span>
+ <span className="text-muted"> · {eventLabel(c.event, t)}</span>
+ {c.event === "named_mention" && <code className="ml-1 text-meta bg-paper rounded px-1">{c.name}</code>}
+ {isDefault(c) && <span className="text-muted"> · {t("connconfig.default_tag")}</span>}
+ </div>
+ <div className="text-meta text-muted truncate">
+ {c.state === "orphan" ? (
+ <span className="text-warnInk">{t("connconfig.orphan_notice", { name: c.target.title || c.target.session_id })} · </span>
+ ) : null}
+ {targetLine(c.target)} · {c.who.length ? t("connconfig.who_you_plus", { n: c.who.length }) : t("connconfig.who_you")}
+ </div>
+ </div>
+ <button className={PILL_LINE + " !py-1"} data-testid={`cfg-edit-${c.config_id}`} onClick={() => setDialog({ mode: "edit", cfg: c })}>
+ {t("connconfig.edit")}
+ </button>
+ <button
+ className={XBTN}
+ title={t("connconfig.delete")}
+ data-testid={`cfg-delete-${c.config_id}`}
+ onClick={async () => {
+ await deleteConfiguration(c.config_id);
+ reload();
+ }}
+ >
+ ×
+ </button>
+ </div>
+ ))}
+ {subRows.map((s) => {
+ const m = holderName(s.machine_id);
+ return (
+ <div className={ROW} key={s.source} data-testid={`glance-sub-${s.source}`}>
+ <div className="min-w-0 flex-1">
+ <div className="text-ui text-ink truncate">
+ <span className="font-medium">{s.source.slice("github:".length).includes("/") ? s.source.slice("github:".length).split("/")[1] : t("connconfig.all_repos")}</span>
+ <span className="text-muted"> · {t("connconfig.event_mention")}</span>
+ </div>
+ <div className="text-meta text-muted truncate">
+ {t("connconfig.existing")} · {s.state === "orphan" ? <span className="text-warnInk">{t("connconfig.session_gone")}</span> : s.title || s.session_id} · {m ? `${m.glyph} ${m.name}` : s.machine_id} · {t("connconfig.subscribed_from_session")}
+ </div>
+ </div>
+ <button
+ className={PILL_LINE + " !py-1"}
+ data-testid={`glance-unsub-${s.source}`}
+ onClick={async () => {
+ await removeCloudSubscription(s.source);
+ reload();
+ }}
+ >
+ {s.state === "orphan" ? t("common.remove") : t("connconfig.unsubscribe")}
+ </button>
+ </div>
+ );
+ })}
+ {rows.length + subRows.length === 0 ? (
+ <div className={ROW}>
+ <span className="text-meta text-muted">{t("connconfig.empty")}</span>
+ </div>
+ ) : null}
+ </div>
+ <div className={FOOT}>
+ {t("connconfig.foot")}
+ </div>
+ {err && <div className="text-meta text-red-600 mt-2">{err}</div>}
+ {dialog && (
+ <ConfigurationDialog
+ mode={dialog.mode}
+ cfg={dialog.mode === "edit" ? dialog.cfg : undefined}
+ holders={holders}
+ installationId={installationId}
+ owner={owner}
+ onClose={() => setDialog(null)}
+ onSaved={() => {
+ setDialog(null);
+ setErr(null);
+ reload();
+ }}
+ />
+ )}
+ </>
+ );
+}
+
+// --- the dialog --------------------------------------------------------------
+
+function ConfigurationDialog({
+ mode,
+ cfg,
+ holders,
+ installationId,
+ owner,
+ onClose,
+ onSaved,
+}: {
+ mode: "add" | "edit";
+ cfg?: Configuration;
+ holders: MachineRef[];
+ installationId: string;
+ owner: string;
+ onClose: () => void;
+ onSaved: () => void;
+}) {
+ const { t } = useTranslation();
+ const [repos, setRepos] = useState<string[]>(cfg?.repos ?? []);
+ const [repoDraft, setRepoDraft] = useState("");
+ const [event, setEvent] = useState<string>(cfg?.event ?? "mention");
+ const [name, setName] = useState(cfg?.name ?? "");
+ const [who, setWho] = useState<string[]>(cfg?.who ?? []);
+ const [whoDraft, setWhoDraft] = useState("");
+ const [kind, setKind] = useState<"new" | "existing">(cfg?.target.kind ?? "new");
+ const [machineId, setMachineId] = useState(cfg?.target.machine_id || holders[0]?.id || "desktop");
+ const [persona, setPersona] = useState(cfg?.target.persona ?? "");
+ const [models, setModels] = useState<string[]>(cfg?.target.models ?? []);
+ const [baseDir, setBaseDir] = useState(cfg?.target.base_dir ?? "");
+ const [worktree, setWorktree] = useState(cfg?.target.worktree ?? true);
+ // Spec §11.5 (owner rulings): Approval mode defaults to Auto-approve; "Send approvals to
+ // Inbox" (the Unattended dial) defaults on — nobody is at the keyboard for these sessions.
+ const [approvalMode, setApprovalMode] = useState(cfg?.target.approval_mode ?? "auto-approve");
+ const [unattended, setUnattended] = useState(cfg?.target.unattended ?? true);
+ const [skills, setSkills] = useState<string[]>(cfg?.target.skills ?? []);
+ const [instructions, setInstructions] = useState(cfg?.target.instructions ?? "");
+ const [advanced, setAdvanced] = useState(false);
+ const [board, setBoard] = useState(cfg?.target.board ?? "");
+ const [memory, setMemory] = useState(cfg?.target.memory ?? "");
+ const [sessionId, setSessionId] = useState(cfg?.target.session_id ?? "");
+ const [sessionTitle, setSessionTitle] = useState(cfg?.target.title ?? "");
+ const [personas, setPersonas] = useState<Persona[]>([]);
+ const [selectable, setSelectable] = useState<string[]>([]);
+ const [skillRows, setSkillRows] = useState<string[]>([]);
+ const [busy, setBusy] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ const machine = holders.find((h) => h.id === machineId);
+ const eventHint = EVENTS.find((e) => e.value === event)?.hint;
+ const modeHint = APPROVAL_MODES.find((m) => m.value === approvalMode)?.hint;
+
+ // What the chosen machine has: its coworkers, its runnable models, its skills.
+ useEffect(() => {
+ let live = true;
+ const gui = machine?.guiId ?? null;
+ getPersonasIndex(gui).then((r) => live && setPersonas(r.personas.filter((p) => p.enabled))).catch(() => live && setPersonas([]));
+ (gui ? getMachineSettings(gui) : getSettings())
+ .then((s) => live && setSelectable(s.models || []))
+ .catch(() => live && setSelectable([]));
+ listSkills(undefined, gui).then((rows) => live && setSkillRows(rows.filter((r) => r.enabled).map((r) => r.name))).catch(() => live && setSkillRows([]));
+ return () => {
+ live = false;
+ };
+ }, [machineId]);
+ const personaRow = personas.find((p) => p.id === persona);
+ // The coworker's own list when it has one, else the machine's selectable models.
+ const offered = useMemo(() => (personaRow?.models?.length ? personaRow.models : selectable), [personaRow, selectable]);
+ useEffect(() => {
+ // Keep the chosen models within what is offered; default to the first runnable.
+ const kept = models.filter((m) => offered.includes(m));
+ if (kept.length !== models.length) setModels(kept);
+ if (kept.length === 0 && offered.length) {
+ const first = offered.find((m) => selectable.includes(m)) ?? offered[0];
+ setModels([first]);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [offered.join("|")]);
+
+ const addRepo = (raw: string) => {
+ const r = raw.trim().replace(/^https?:\/\/github\.com\//, "").replace(/\.git$/, "").replace(/\/$/, "");
+ if (!r) return;
+ if (!/^[A-Za-z0-9_.-]+(\/[A-Za-z0-9_.-]+)?$/.test(r)) {
+ setErr(t("connconfig.err_repo_format"));
+ return;
+ }
+ setErr(null);
+ setRepos((list) => (list.includes(r) ? list : [...list, r]));
+ setRepoDraft("");
+ };
+ const addWho = (raw: string) => {
+ const w = raw.trim().replace(/^@/, "");
+ if (!w) return;
+ setWho((list) => (list.includes(w) ? list : [...list, w]));
+ setWhoDraft("");
+ };
+ const target = (): ConfigurationTarget =>
+ kind === "existing"
+ ? { kind: "existing", machine_id: machineId, session_id: sessionId, title: sessionTitle }
+ : { kind: "new", machine_id: machineId, persona, models, base_dir: baseDir.trim(), worktree, skills, instructions: instructions.trim(), board: board.trim(), memory: memory.trim(), approval_mode: approvalMode, unattended };
+
+ const save = async () => {
+ setErr(null);
+ if (mode === "add" && repos.length === 0) return setErr(t("connconfig.err_pick_repo"));
+ if (event === "named_mention" && !NAME_RE.test(name.trim().toLowerCase())) return setErr(t("connconfig.err_name_format"));
+ if (kind === "existing" && !sessionId) return setErr(t("connconfig.err_pick_session"));
+ setBusy(true);
+ const r =
+ mode === "add"
+ ? await addConfiguration({ installation_id: installationId, repos, event, name: name.trim().toLowerCase(), who, target: target() })
+ : await editConfiguration(cfg!.config_id, { who, target: target() });
+ setBusy(false);
+ if (r.ok) return onSaved();
+ const held = (r as { held_by?: Record<string, unknown> }).held_by as { key?: string; title?: string; source?: string; configuration?: { key?: string } } | undefined;
+ if (r.error === "name_taken") setErr(t("connconfig.err_name_taken", { name: name.trim().toLowerCase() }));
+ else if (r.error === "subscribed") setErr(t("connconfig.err_subscribed", { repo: held?.source?.replace(/^github:/, "") || t("connconfig.that_repository") }));
+ else if (r.error === "held") setErr(t("connconfig.err_held", { key: held?.key || held?.configuration?.key || t("connconfig.that_repository_and_event") }));
+ else setErr(r.error);
+ };
+
+ return (
+ <div className="fixed inset-0 z-40" data-testid="cfg-dialog">
+ <div className="absolute inset-0 bg-black/30" onClick={onClose} />
+ <div
+ className="absolute left-1/2 top-[6%] -translate-x-1/2 w-[560px] max-w-[calc(100vw-2rem)] max-h-[88vh] overflow-auto bg-panel rounded-2xl border border-line shadow-2xl p-5"
+ role="dialog"
+ aria-label={mode === "add" ? t("connconfig.add_title") : t("connconfig.edit_title")}
+ >
+ <div className="text-heading font-semibold mb-1">{mode === "add" ? t("connconfig.add_title") : t("connconfig.edit_title")}</div>
+ <div className="text-ui text-muted mb-4">
+ {mode === "add"
+ ? t("connconfig.add_blurb")
+ : t("connconfig.edit_blurb", { repos: cfg?.repos.join(", "), event: eventLabel(cfg?.event ?? "", t) })}
+ </div>
+
+ <div className="grid grid-cols-[130px_1fr] gap-x-3 gap-y-3 items-start">
+ {mode === "add" && (
+ <>
+ <Label>{t("connconfig.label_repositories")}</Label>
+ <div>
+ <div className="flex flex-wrap gap-1.5 mb-1.5">
+ {repos.map((r) => (
+ <Chip key={r} onRemove={() => setRepos((l) => l.filter((x) => x !== r))} testId={`cfg-repo-${r}`}>
+ {r.includes("/") ? r : t("connconfig.all_repos_in", { owner: r })}
+ </Chip>
+ ))}
+ </div>
+ <div className="flex gap-1.5">
+ <input
+ className={INPUT + " flex-1"}
+ placeholder={t("connconfig.repo_placeholder")}
+ value={repoDraft}
+ onChange={(e) => setRepoDraft(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === ",") {
+ e.preventDefault();
+ addRepo(repoDraft);
+ }
+ }}
+ data-testid="cfg-repo-input"
+ />
+ {owner && !repos.includes(owner) && (
+ <button className={PILL_LINE + " !py-1"} data-testid="cfg-all-repos" onClick={() => addRepo(owner)}>
+ {t("connconfig.all_repos_in", { owner })}
+ </button>
+ )}
+ </div>
+ </div>
+
+ <Label>{t("connconfig.label_event")}</Label>
+ <div>
+ <select className={INPUT} value={event} onChange={(e) => setEvent(e.target.value)} data-testid="cfg-event">
+ {EVENTS.map((e) => (
+ <option key={e.value} value={e.value}>
+ {t(e.label)}
+ </option>
+ ))}
+ </select>
+ {eventHint ? <div className="text-meta text-faint mt-1">{t(eventHint)}</div> : null}
+ </div>
+ {event === "named_mention" && (
+ <>
+ <Label>{t("connconfig.label_name")}</Label>
+ <div>
+ <input className={INPUT + " font-mono w-60"} value={name} onChange={(e) => setName(e.target.value)} placeholder={t("connconfig.name_placeholder")} data-testid="cfg-name" />
+ <div className="text-meta text-faint mt-1">{t("connconfig.name_hint", { name: name || t("connconfig.name_fallback") })}</div>
+ </div>
+ </>
+ )}
+ </>
+ )}
+
+ <Label>{t("connconfig.label_who")}</Label>
+ <div>
+ <div className="flex flex-wrap gap-1.5 items-center">
+ <span className="inline-flex items-center text-ui border border-line rounded-full px-2.5 py-0.5 text-muted">{t("connconfig.you")}</span>
+ {who.map((w) => (
+ <Chip key={w} onRemove={() => setWho((l) => l.filter((x) => x !== w))} testId={`cfg-who-${w}`}>
+ {w}
+ </Chip>
+ ))}
+ <input
+ className={INPUT + " w-40"}
+ placeholder={t("connconfig.who_placeholder")}
+ value={whoDraft}
+ onChange={(e) => setWhoDraft(e.target.value)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === ",") {
+ e.preventDefault();
+ addWho(whoDraft);
+ }
+ }}
+ data-testid="cfg-who-input"
+ />
+ </div>
+ <div className="text-meta text-faint mt-1">{t("connconfig.who_hint")}</div>
+ </div>
+
+ <Label>{t("connconfig.label_send_to")}</Label>
+ <div className="space-y-1.5">
+ <Radio checked={kind === "new"} onChange={() => setKind("new")} testId="cfg-target-new" label={t("connconfig.new_session")} hint={event === "mention" || event === "named_mention" ? t("connconfig.one_per_thread") : t("connconfig.one_per_pr_or_issue")} />
+ <Radio checked={kind === "existing"} onChange={() => setKind("existing")} testId="cfg-target-existing" label={t("connconfig.existing_session")} hint="" />
+ </div>
+
+ <Label>{t("connconfig.label_machine")}</Label>
+ <select className={INPUT} value={machineId} onChange={(e) => setMachineId(e.target.value)} data-testid="cfg-machine">
+ {holders.map((h) => (
+ <option key={h.id} value={h.id}>
+ {h.glyph} {h.name}
+ </option>
+ ))}
+ </select>
+
+ {kind === "new" ? (
+ <>
+ <Label>{t("connconfig.label_coworker")}</Label>
+ <select className={INPUT} value={persona} onChange={(e) => setPersona(e.target.value)} data-testid="cfg-coworker">
+ <option value="">{t("connconfig.default_coworker")}</option>
+ {personas.map((p) => (
+ <option key={p.id} value={p.id}>
+ {p.name}
+ </option>
+ ))}
+ </select>
+
+ <Label>{t("connconfig.label_models")}</Label>
+ <div>
+ <div className="flex flex-wrap gap-1.5">
+ {offered.map((m) => {
+ const i = models.indexOf(m);
+ const on = i >= 0;
+ const runnable = selectable.includes(m);
+ return (
+ <button
+ key={m}
+ className={"inline-flex items-center gap-1.5 text-meta rounded-full px-2 py-0.5 border " + (on ? "border-accent text-ink" : "border-line text-muted") + (runnable ? "" : " border-dashed")}
+ title={runnable ? m : t("connconfig.model_unavailable", { model: m, machine: machine?.name ?? t("connconfig.this_machine") })}
+ onClick={() => setModels((l) => (on ? l.filter((x) => x !== m) : [...l, m]))}
+ data-testid={`cfg-model-${m}`}
+ >
+ {on && <span className="text-[10px] font-medium bg-accent text-white rounded-full px-1.5">{i + 1}</span>}
+ {shortModel(m)}
+ {!runnable && <span className="text-faint">· {t("connconfig.not_here")}</span>}
+ </button>
+ );
+ })}
+ {offered.length === 0 && <span className="text-meta text-faint">{t("connconfig.no_models")}</span>}
+ </div>
+ <div className="text-meta text-faint mt-1">{t("connconfig.models_hint")}</div>
+ </div>
+
+ <Label>{t("connconfig.label_base_dir")}</Label>
+ <div>
+ <input className={INPUT + " w-full"} value={baseDir} onChange={(e) => setBaseDir(e.target.value)} placeholder={t("connconfig.base_dir_placeholder", { machine: machine?.name ?? t("connconfig.the_machine") })} data-testid="cfg-base-dir" />
+ <label className="flex items-start gap-2 mt-2 text-ui">
+ <input type="checkbox" checked={worktree} onChange={(e) => setWorktree(e.target.checked)} data-testid="cfg-worktree" className="mt-1" />
+ <span>
+ {t("connconfig.worktree_per_session")}
+ <span className="block text-meta text-faint">
+ {t("connconfig.worktree_hint", { dir: baseDir || "~/work" })}
+ </span>
+ </span>
+ </label>
+ </div>
+
+ <Label>{t("connconfig.label_approvals")}</Label>
+ <div>
+ <select className={INPUT} value={approvalMode} onChange={(e) => setApprovalMode(e.target.value)} data-testid="cfg-approval-mode">
+ {APPROVAL_MODES.map((m) => (
+ <option key={m.value} value={m.value}>
+ {t(m.label)}
+ </option>
+ ))}
+ </select>
+ <span className="block text-meta text-faint mt-1">
+ {modeHint ? t(modeHint) : null}
+ {approvalMode === "bypass-approvals" && (personaRow?.tools ?? []).includes("shell") ? " " + t("connconfig.shell_warning") : ""}
+ </span>
+ <label className="flex items-start gap-2 mt-2 text-ui">
+ <input type="checkbox" checked={unattended} onChange={(e) => setUnattended(e.target.checked)} data-testid="cfg-unattended" className="mt-1" />
+ <span>
+ {t("connconfig.approvals_to_inbox")}
+ <span className="block text-meta text-faint">
+ {t("connconfig.approvals_to_inbox_hint")}
+ </span>
+ </span>
+ </label>
+ </div>
+
+ <Label>{t("connconfig.label_skills")}</Label>
+ <div className="flex flex-wrap gap-1.5">
+ {skillRows.map((sname) => {
+ const on = skills.includes(sname);
+ return (
+ <button
+ key={sname}
+ className={"text-meta rounded-full px-2 py-0.5 border " + (on ? "border-accent text-ink" : "border-line text-muted")}
+ onClick={() => setSkills((l) => (on ? l.filter((x) => x !== sname) : [...l, sname]))}
+ data-testid={`cfg-skill-${sname}`}
+ >
+ {sname}
+ </button>
+ );
+ })}
+ {skillRows.length === 0 && <span className="text-meta text-faint">{t("connconfig.no_skills")}</span>}
+ </div>
+
+ <Label>{t("connconfig.label_instructions")}</Label>
+ <textarea className={INPUT + " w-full min-h-[64px]"} value={instructions} onChange={(e) => setInstructions(e.target.value)} placeholder={t("connconfig.instructions_placeholder")} data-testid="cfg-instructions" />
+
+ <div className="col-span-2 border-t border-line pt-2">
+ <button className="text-ui text-muted" onClick={() => setAdvanced((a) => !a)} data-testid="cfg-advanced">
+ {advanced ? "▾" : "▸"} {t("connconfig.advanced")} <span className="text-faint">{t("connconfig.advanced_hint")}</span>
+ </button>
+ {advanced && (
+ <div className="grid grid-cols-[130px_1fr] gap-x-3 gap-y-2 mt-2">
+ <Label>{t("connconfig.label_board")}</Label>
+ <input className={INPUT} value={board} onChange={(e) => setBoard(e.target.value)} placeholder={t("connconfig.board_placeholder")} data-testid="cfg-board" />
+ <Label>{t("connconfig.label_memory")}</Label>
+ <input className={INPUT} value={memory} onChange={(e) => setMemory(e.target.value)} placeholder={t("connconfig.memory_placeholder")} data-testid="cfg-memory" />
+ </div>
+ )}
+ </div>
+ </>
+ ) : (
+ <>
+ <Label>{t("connconfig.label_session")}</Label>
+ <SessionPicker
+ holders={holders}
+ machineId={machineId}
+ value={sessionId}
+ onPick={(row, brokerMachine) => {
+ setSessionId(row.session_id);
+ setSessionTitle(row.title || "");
+ setMachineId(brokerMachine);
+ }}
+ />
+ </>
+ )}
+ </div>
+
+ {err && <div className="text-meta text-red-600 mt-3" data-testid="cfg-error">{err}</div>}
+ <div className="flex justify-end gap-2 mt-4">
+ <button className={PILL_LINE} onClick={onClose}>
+ {t("connconfig.cancel")}
+ </button>
+ <button className={PILL_ACCENT} onClick={() => void save()} disabled={busy} data-testid="cfg-save">
+ {mode === "add" ? t("connconfig.add") : t("connconfig.save")}
+ </button>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function Label({ children }: { children: React.ReactNode }) {
+ return <span className="text-ui text-muted pt-1">{children}</span>;
+}
+
+function Chip({ children, onRemove, testId }: { children: React.ReactNode; onRemove: () => void; testId?: string }) {
+ const { t } = useTranslation();
+ return (
+ <span className="inline-flex items-center gap-1 text-ui border border-line rounded-full pl-2.5 pr-1 py-0.5" data-testid={testId}>
+ {children}
+ <button className={XBTN} onClick={onRemove} title={t("common.remove")}>
+ ×
+ </button>
+ </span>
+ );
+}
+
+function Radio({ checked, onChange, testId, label, hint }: { checked: boolean; onChange: () => void; testId: string; label: string; hint: string }) {
+ return (
+ <label className={"flex items-center gap-2 px-2.5 py-1.5 rounded-lg border cursor-pointer " + (checked ? "border-accent bg-accentSoft/40" : "border-line")}>
+ <input type="radio" checked={checked} onChange={onChange} data-testid={testId} />
+ <span className="text-ui">{label}</span>
+ {hint && <span className="text-meta text-faint ml-auto">{hint}</span>}
+ </label>
+ );
+}
+
+// The Existing-session picker (UX-050 third pass): search; grouped by machine,
+// most recent first; pinned and lead sessions float to the top; sessions a
+// mention started sit behind "Show all"; eight per machine before "Show all".
+function SessionPicker({
+ holders,
+ machineId,
+ value,
+ onPick,
+}: {
+ holders: MachineRef[];
+ machineId: string;
+ value: string;
+ onPick: (row: SessionRow, brokerMachine: string) => void;
+}) {
+ const { t } = useTranslation();
+ const [rows, setRows] = useState<SessionInfo[] | null>(null); // null = still loading
+ const [q, setQ] = useState("");
+ const [showAll, setShowAll] = useState<Record<string, boolean>>({});
+ useEffect(() => {
+ getAllSessions().then(setRows).catch(() => setRows([]));
+ }, []);
+ // GUI machine id → broker id, through the holders the page knows.
+ const brokerOf = (s: SessionInfo): string | null => {
+ if (!s.machine) return holders.find((h) => h.id === "desktop") ? "desktop" : null;
+ return holders.find((h) => h.guiId === s.machine)?.id ?? null;
+ };
+ const needle = q.trim().toLowerCase();
+ const groups = holders
+ .map((h) => {
+ const all = (rows ?? [])
+ .filter((s) => !s.archived && brokerOf(s) === h.id)
+ .filter((s) => !needle || (s.title || "").toLowerCase().includes(needle) || (s.agent || "").toLowerCase().includes(needle) || h.name.toLowerCase().includes(needle))
+ .sort((a, b) => Number(!!b.pinned || !!(b as SessionRow & { lead?: boolean }).lead) - Number(!!a.pinned || !!(a as SessionRow & { lead?: boolean }).lead) || String(b.updated_at || "").localeCompare(String(a.updated_at || "")));
+ const primary = all.filter((s) => !s.origin);
+ const rest = all.filter((s) => !!s.origin);
+ const open = !!showAll[h.id] || !!needle;
+ const shown = open ? [...primary, ...rest] : primary.slice(0, 8);
+ const hidden = all.length - shown.length;
+ return { h, shown, hidden, open };
+ })
+ .filter((g) => g.shown.length || g.hidden);
+ return (
+ <div className="border border-line rounded-lg overflow-hidden" data-testid="cfg-session-picker">
+ <input className="w-full px-2.5 py-1.5 text-ui bg-transparent outline-none border-b border-line" placeholder={t("connconfig.session_search_placeholder")} value={q} onChange={(e) => setQ(e.target.value)} data-testid="cfg-session-search" />
+ <div className="max-h-56 overflow-auto">
+ {rows === null && <div className="px-2.5 py-2 text-meta text-faint">{t("connconfig.loading_sessions")}</div>}
+ {rows !== null && groups.length === 0 && <div className="px-2.5 py-2 text-meta text-faint">{t("connconfig.no_sessions")}</div>}
+ {groups.map(({ h, shown, hidden, open }) => (
+ <div key={h.id}>
+ <div className="px-2.5 pt-1.5 text-meta text-faint">
+ {h.glyph} {h.name}
+ {h.id === machineId ? "" : ""}
+ </div>
+ {shown.map((s) => (
+ <button
+ key={s.session_id}
+ className={"w-full text-left px-4 py-1 text-ui hover:bg-paper " + (s.session_id === value ? "bg-accentSoft/40" : "")}
+ onClick={() => onPick(s as SessionRow, h.id)}
+ data-testid={`cfg-session-${s.session_id}`}
+ >
+ {s.pinned || (s as SessionRow & { lead?: boolean }).lead ? "📌 " : ""}
+ {s.title || s.session_id} <span className="text-faint">· {s.agent}</span>
+ </button>
+ ))}
+ {!open && hidden > 0 && (
+ <button className="px-4 pb-1.5 text-meta text-faint" onClick={() => setShowAll((x) => ({ ...x, [h.id]: true }))} data-testid={`cfg-session-more-${h.id}`}>
+ {t("connconfig.show_all_more", { n: hidden })}
+ </button>
+ )}
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/connectors/ConnectorGlance.tsx b/surfaces/gui/src/components/connectors/ConnectorGlance.tsx
new file mode 100644
index 00000000..d21eb79c
--- /dev/null
+++ b/surfaces/gui/src/components/connectors/ConnectorGlance.tsx
@@ -0,0 +1,494 @@
+import { useEffect, useState } from "react";
+import type { TFunction } from "i18next";
+import { useTranslation } from "react-i18next";
+import {
+ addPerson,
+ allowUser,
+ disallowUser,
+ getCloudConnections,
+ getCloudStatus,
+ getCloudSubscriptions,
+ getConnectors,
+ getMachines,
+ getPeople,
+ getPersonasIndex,
+ getSlackStatus,
+ getSubscriptions,
+ isCloudMode,
+ removeCloudSubscription,
+ removePerson,
+ resolveUnauthorized,
+ setScopeRouting,
+ unsubscribeChannel,
+ type CloudConnection,
+ type CloudStatus,
+ type CloudSubscription,
+ type Connector,
+ type Machine,
+ type ParkedMessage,
+ type Person,
+ type Persona,
+ type SlackStatus,
+ type Subscription,
+} from "../../api";
+import { ConnectorBadge } from "../../connectors/ConnectorIcon";
+import { AddConnectionModal } from "./AddConnectionModal";
+import { ConfigurationsSection, type MachineRef } from "./ConfigurationsSection";
+import { SlackHowItWorks } from "./SlackHowItWorks";
+import { FOOT, GRP, GRP_H, PILL_ACCENT, PILL_LINE, ROW, XBTN } from "./ui";
+
+// UX-049 (owner, 2026-09-03/04): the per-connector glance page under Settings ▸ App.
+// Everything on it is true for all of the user's machines. Per workspace (or
+// GitHub installation): ONE routing line — mentions nobody subscribed to go to
+// this machine and start a session with this coworker — and ONE People list:
+// everyone on it may post and approve; the user is pinned. Below, who answers
+// each channel. Moves are pulls (from a session's Access panel), so the table
+// lists and unsubscribes only. Approvals routing is per machine and lives on
+// that machine's Connectors row.
+
+const TITLES: Record<string, string> = { slack: "Slack", github: "GitHub" };
+const LABEL = "text-ui text-muted w-28 shrink-0";
+
+function brokerId(m: Machine): string {
+ if (m.origin === "cloud") return m.id.replace(/^cloud:/, "");
+ return isCloudMode() ? m.id : "";
+}
+
+function glyph(m: Machine | undefined, id: string): string {
+ if (id === "desktop") return "💻";
+ return m?.provenance === "fly" ? "☁" : "🖥";
+}
+
+function relayLine(slack: SlackStatus | null, t: TFunction): string {
+ if (!slack) return t("slack.relay_live");
+ if (!slack.signed_in) return t("slack.relay_signin_needed");
+ if (slack.relay.state === "offline") return t("slack.relay_offline");
+ if (slack.relay.state === "reconnecting") return t("slack.relay_reconnecting");
+ return t("slack.relay_live");
+}
+
+export function ConnectorGlance({
+ connector,
+ onManage,
+}: {
+ connector: "slack" | "github";
+ // Opens this Mac's management page for the connector (add / disconnect a
+ // workspace or installation, token health, the people picker).
+ onManage?: (name: string) => void;
+}) {
+ const { t } = useTranslation();
+ const [conn, setConn] = useState<CloudConnection | null>(null);
+ const [machines, setMachines] = useState<Machine[]>([]);
+ const [cloudSubs, setCloudSubs] = useState<CloudSubscription[]>([]);
+ const [localSubs, setLocalSubs] = useState<Subscription[]>([]);
+ const [people, setPeople] = useState<Person[]>([]);
+ const [local, setLocal] = useState<Connector | null>(null);
+ const [cloud, setCloud] = useState<CloudStatus | null>(null);
+ const [slack, setSlack] = useState<SlackStatus | null>(null);
+ const [personas, setPersonas] = useState<Record<string, Persona[]>>({});
+ const [draft, setDraft] = useState<Record<string, string>>({});
+ const [adding, setAdding] = useState(false);
+ const [err, setErr] = useState<string | null>(null);
+ // The dashboard has no engine of its own: a holder's box supplies the
+ // workspace / installation list and the channel names (through the proxy).
+ const [remote, setRemote] = useState<Connector | null>(null);
+ const [remoteSubs, setRemoteSubs] = useState<Subscription[]>([]);
+ // The page renders in one go once the holder read has settled — the
+ // workspace section arrives after the cloud rows, and showing the table
+ // first made it jump (owner report 2026-09-04).
+ const [ready, setReady] = useState(false);
+ const [settled, setSettled] = useState({ cloud: false, local: false, machines: false });
+ const desktop = !isCloudMode();
+
+ const load = () => {
+ getCloudConnections()
+ .then((rows) => setConn(rows.find((r) => r.connector === connector && r.status !== "disconnected") ?? null))
+ .catch(() => setConn(null))
+ .finally(() => setSettled((x) => ({ ...x, cloud: true })));
+ getMachines()
+ .then((r) => setMachines(r.machines))
+ .catch(() => setMachines([]))
+ .finally(() => setSettled((x) => ({ ...x, machines: true })));
+ getCloudSubscriptions(connector).then(setCloudSubs).catch(() => setCloudSubs([]));
+ getPeople(connector).then(setPeople).catch(() => setPeople([]));
+ getConnectors()
+ .then((cs) => setLocal(cs.find((c) => c.name === connector) ?? null))
+ .catch(() => setLocal(null))
+ .finally(() => setSettled((x) => ({ ...x, local: true })));
+ if (desktop) {
+ getSubscriptions().then(setLocalSubs).catch(() => setLocalSubs([]));
+ getCloudStatus().then(setCloud).catch(() => setCloud(null));
+ if (connector === "slack") getSlackStatus().then(setSlack).catch(() => setSlack(null));
+ }
+ };
+ useEffect(load, [connector]);
+
+ const title = TITLES[connector] ?? connector;
+ const nameOf = (id: string): string => {
+ if (id === "desktop" || !id) return desktop ? t("connglance.this_mac") : t("connglance.the_desktop");
+ return machines.find((m) => brokerId(m) === id)?.name || id;
+ };
+ const machineOf = (id: string) => machines.find((m) => brokerId(m) === id);
+ const guiIdOf = (id: string): string | null => (id === "desktop" ? null : machineOf(id)?.id ?? null);
+ const holders = conn?.holders.map((h) => h.machine_id).filter(Boolean) ?? [];
+ const heldHere = !!local?.connected && desktop;
+ const holderIds = [...(heldHere ? ["desktop"] : []), ...holders.filter((h) => h !== "desktop")];
+ // Where the workspace list comes from: This Mac when it holds the grant,
+ // else the first holder's box.
+ const source: Connector | null = heldHere ? local : remote;
+ useEffect(() => {
+ if (!(settled.cloud && settled.local && settled.machines)) return; // first paint waits for the three reads
+ const boxes = holders.filter((h) => h !== "desktop").map((h) => machineOf(h)?.id).filter((x): x is string => !!x);
+ if (heldHere || boxes.length === 0) {
+ setReady(true);
+ return;
+ }
+ let live = true;
+ Promise.allSettled([
+ getConnectors(boxes[0]).then((cs) => live && setRemote(cs.find((c) => c.name === connector) ?? null)),
+ // Channel names live on whichever box holds the subscription: read them all.
+ Promise.all(boxes.map((b) => getSubscriptions(b).catch(() => [] as Subscription[]))).then(
+ (lists) => live && setRemoteSubs(lists.flat()),
+ ),
+ ]).then(() => live && setReady(true));
+ return () => {
+ live = false;
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [conn, machines, local, settled]);
+ const channelName = (source_: string): string | null =>
+ [...localSubs, ...remoteSubs].find((s) => s.channel === source_)?.channel_name ?? null;
+
+ // Scopes: the workspaces / installations the local engine knows, then any
+ // the cloud rows mention.
+ const scopes: { id: string; label: string; installer?: string; localAllowed: string[]; names: Record<string, string | null> }[] =
+ connector === "slack"
+ ? (source?.workspaces ?? []).map((w) => ({
+ id: w.team_id,
+ label: w.account || w.team_id,
+ installer: w.installer_user_id,
+ localAllowed: w.allowed_users,
+ names: w.allowed_user_names ?? {},
+ }))
+ : (source?.installations ?? []).map((i) => ({
+ id: i.installation_id,
+ label: i.account_login || i.installation_id,
+ installer: i.github_login,
+ localAllowed: i.allowed_users,
+ names: {},
+ }));
+ for (const p of people) if (!scopes.some((s) => s.id === p.scope)) scopes.push({ id: p.scope, label: p.scope, localAllowed: [], names: {} });
+ for (const k of Object.keys(conn?.routing ?? {})) if (!scopes.some((s) => s.id === k)) scopes.push({ id: k, label: k, localAllowed: [], names: {} });
+
+ // The coworker picker lists what the routed machine has installed.
+ const routingFor = (scope: string) => {
+ const r = conn?.routing?.[scope];
+ return { machine_id: r?.machine_id || conn?.default_machine_id || holderIds[0] || "", persona: r?.persona || "" };
+ };
+ useEffect(() => {
+ const wanted = new Set(scopes.map((s) => routingFor(s.id).machine_id).filter(Boolean));
+ for (const id of wanted) {
+ if (personas[id] !== undefined) continue;
+ getPersonasIndex(guiIdOf(id))
+ .then((r) => setPersonas((p) => ({ ...p, [id]: r.personas })))
+ .catch(() => setPersonas((p) => ({ ...p, [id]: [] })));
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [conn, machines, local]);
+
+ const setRouting = async (scope: string, machineId: string, persona?: string) => {
+ if (!conn) return;
+ setErr(null);
+ const r = await setScopeRouting(conn.connection_id, scope, machineId, persona);
+ if (!r.ok) setErr(r.error || t("connglance.err_routing"));
+ load();
+ };
+ const add = async (scope: string) => {
+ const member = (draft[scope] || "").trim();
+ if (!member) return;
+ setErr(null);
+ const r = await addPerson(connector, scope, member);
+ if (!r.ok && !desktop) setErr(r.error || t("connglance.err_add_person"));
+ if (desktop && local?.connected) await allowUser(connector, member, scope).catch(() => {});
+ setDraft((d) => ({ ...d, [scope]: "" }));
+ load();
+ };
+ const drop = async (scope: string, member: string) => {
+ await removePerson(connector, scope, member).catch(() => {});
+ if (desktop && local?.connected) await disallowUser(connector, member, scope).catch(() => {});
+ load();
+ };
+ const unsubscribeCloud = async (s: CloudSubscription) => {
+ await removeCloudSubscription(s.source);
+ load();
+ };
+ const unsubscribeLocal = async (s: Subscription) => {
+ await unsubscribeChannel(s.session_id, s.channel);
+ load();
+ };
+
+ const channelLabel = (source_: string): string => {
+ const [, rest = ""] = source_.split(":", 2);
+ if (connector === "slack") {
+ const chan = rest.includes("/") ? rest.split("/")[1] : rest;
+ if (chan.startsWith("T") || chan.startsWith("E")) return t("connglance.whole_workspace", { id: chan });
+ const name = channelName(source_);
+ return name ? `#${name}` : `#${chan}`;
+ }
+ return rest.includes("/") ? rest : t("connglance.org", { name: rest });
+ };
+ // Local-only subscriptions (Socket Mode, offline) that the cloud does not list.
+ const localOnly = localSubs.filter(
+ (s) => s.channel.startsWith(`${connector}:`) && !cloudSubs.some((c) => c.source === s.channel),
+ );
+
+ return (
+ <div data-testid={`glance-${connector}`}>
+ <div className="flex items-center gap-3.5 mb-5">
+ {local ? <ConnectorBadge connector={local} size={44} title={title} /> : null}
+ <div className="min-w-0 flex-1">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">{title}</h2>
+ <div className="text-ui text-muted" data-testid="glance-holders">
+ {connector === "slack" && heldHere && local?.mode === "relay" ? (
+ <span data-testid="slack-mode-badge">{relayLine(slack, t)} · </span>
+ ) : null}
+ {holderIds.length === 0
+ ? t("connglance.not_connected_anywhere")
+ : t("connglance.on_machines", { machines: holderIds.map((id) => `${glyph(machineOf(id), id)} ${nameOf(id)}`).join(" · ") })}
+ </div>
+ </div>
+ {desktop && local && onManage && (
+ <button className={PILL_LINE} data-testid={`manage-local-${connector}`} onClick={() => onManage(connector)}>
+ {t("connglance.manage_on_this_mac")}
+ </button>
+ )}
+ {desktop && local && connector === "slack" && (
+ <button className={PILL_ACCENT} data-testid="add-workspace-btn" onClick={() => setAdding(true)}>
+ {t("slack.add_workspace")}
+ </button>
+ )}
+ </div>
+
+ {!ready && <div className={FOOT} data-testid="glance-loading">{t("connector.loading")}</div>}
+ {ready && connector === "slack" && source?.workspaces?.length ? <SlackHowItWorks workspaces={source.workspaces} /> : null}
+
+ {ready && scopes.length === 0 && holderIds.length === 0 ? (
+ <div className={FOOT}>{t("connglance.connect_first", { title })}</div>
+ ) : null}
+
+ {ready && connector === "github" && (
+ // One mechanism (owner, 2026-09-04): the GitHub page IS its
+ // configurations; the installation default is a row like any other.
+ <ConfigurationsSection
+ holders={holderIds.map((id): MachineRef => ({ id, name: nameOf(id), glyph: glyph(machineOf(id), id), guiId: guiIdOf(id) }))}
+ installationId={scopes[0]?.id ?? ""}
+ owner={scopes[0]?.label ?? ""}
+ cloudSubs={cloudSubs}
+ onChanged={load}
+ />
+ )}
+
+ {ready && connector === "slack" && scopes.map((scope) => {
+ const routing = routingFor(scope.id);
+ const list = personas[routing.machine_id] ?? [];
+ const missing = !!routing.persona && list.length > 0 && !list.some((p) => p.id === routing.persona);
+ // One list: the cloud's rows, plus anything only this Mac knows (Socket Mode).
+ const members = new Map<string, { name: string; pinned: boolean; cloud: boolean }>();
+ for (const p of people.filter((x) => x.scope === scope.id)) members.set(p.member, { name: p.name, pinned: !!p.pinned, cloud: true });
+ if (desktop) for (const u of scope.localAllowed) if (!members.has(u)) members.set(u, { name: scope.names[u] || "", pinned: u === scope.installer, cloud: false });
+ if (scope.installer && !members.has(scope.installer)) members.set(scope.installer, { name: "you", pinned: true, cloud: false });
+ return (
+ <div key={scope.id} data-testid={connector === "slack" ? `slack-workspace-${scope.id}` : `github-install-${scope.id}`}>
+ <div className={GRP_H}>{scope.label}</div>
+ <div className={GRP}>
+ {conn && holderIds.length > 0 && (
+ <div className={ROW} data-testid={`glance-routing-${scope.id}`}>
+ <span className={LABEL}>{t("connglance.mentions_go_to")}</span>
+ <select
+ className="text-ui px-2 py-1 rounded-lg border border-line bg-paper text-ink outline-none"
+ value={routing.machine_id}
+ onChange={(e) => void setRouting(scope.id, e.target.value)}
+ data-testid={`glance-machine-${scope.id}`}
+ aria-label={t("connconfig.label_machine")}
+ >
+ {holderIds.map((id) => (
+ <option key={id} value={id}>
+ {glyph(machineOf(id), id)} {nameOf(id)}
+ </option>
+ ))}
+ </select>
+ <span className="text-meta text-muted">·</span>
+ <select
+ className="text-ui px-2 py-1 rounded-lg border border-line bg-paper text-ink outline-none max-w-[200px]"
+ value={missing ? "" : routing.persona}
+ onChange={(e) => void setRouting(scope.id, "", e.target.value)}
+ data-testid={`glance-coworker-${scope.id}`}
+ aria-label={t("connconfig.label_coworker")}
+ >
+ <option value="">{t("connconfig.default_coworker")}</option>
+ {list.map((p) => (
+ <option key={p.id} value={p.id}>
+ {p.icon ? `${p.icon} ` : ""}{p.name}
+ </option>
+ ))}
+ </select>
+ <span className="text-meta text-muted">
+ {missing
+ ? t("connglance.coworker_missing", { coworker: routing.persona, machine: nameOf(routing.machine_id) })
+ : t("connglance.one_session_per_thread")}
+ </span>
+ </div>
+ )}
+ <div className={ROW}>
+ <span className={LABEL}>{t("connector.people")}</span>
+ <div className="flex flex-wrap items-center gap-1.5 min-w-0 flex-1" data-testid={`glance-people-${scope.id}`}>
+ {[...members.entries()].map(([member, m]) => (
+ <span key={member} className="inline-flex items-center gap-1 text-ui border border-line rounded-full pl-2.5 pr-1 py-0.5" title={member}>
+ {m.pinned ? t("slack.you") : m.name || member}
+ {m.pinned ? (
+ <span className="pr-1.5" />
+ ) : (
+ <button className={XBTN} title={t("common.remove")} onClick={() => void drop(scope.id, member)} data-testid={`glance-person-x-${member}`}>
+ ×
+ </button>
+ )}
+ </span>
+ ))}
+ <input
+ className="text-ui px-2 py-0.5 rounded-full border border-dashed border-lineStrong bg-transparent outline-none w-44"
+ placeholder={connector === "slack" ? t("connglance.add_person_placeholder") : t("connglance.add_login_placeholder")}
+ value={draft[scope.id] || ""}
+ onChange={(e) => setDraft((d) => ({ ...d, [scope.id]: e.target.value }))}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") void add(scope.id);
+ }}
+ data-testid={`glance-person-input-${scope.id}`}
+ />
+ </div>
+ </div>
+ {/* Parked senders and local-only listening rows are per machine (this Mac). */}
+ {desktop && local &&
+ (local.unauthorized ?? [])
+ .filter((m) => m.team_id === scope.id)
+ .map((m) => <WaitingRow key={m.id} connector={connector} m={m} onChanged={load} />)}
+ {desktop && (() => {
+ const here = localOnly.filter((s) => s.channel.startsWith(`${connector}:${scope.id}/`));
+ return here.length ? <LocalListening subs={here} onChanged={load} /> : null;
+ })()}
+ </div>
+ </div>
+ );
+ })}
+ {ready && connector === "slack" && scopes.length > 0 && (
+ <div className={FOOT}>
+ {connector === "slack" ? t("connglance.people_foot_workspace") : t("connglance.people_foot_installation")}
+ </div>
+ )}
+
+ {ready && connector === "slack" && (
+ <>
+ <div className={GRP_H}>
+ {t(connector === "slack" ? "connglance.subscribed_channels" : "connglance.subscribed_repos", { n: cloudSubs.length + localOnly.length })}
+ </div>
+ <div className={GRP} data-testid="glance-subscriptions">
+ {cloudSubs.length + localOnly.length === 0 ? (
+ <div className={ROW}>
+ <span className="text-meta text-muted">{connector === "slack" ? t("connglance.none_claimed_channel") : t("connglance.none_claimed_repo")}</span>
+ </div>
+ ) : null}
+ {cloudSubs.map((s) => (
+ <div className={ROW} key={s.source} data-testid={`glance-sub-${s.source}`}>
+ <div className="min-w-0 flex-1">
+ <div className="text-ui text-ink truncate">{channelLabel(s.source)}</div>
+ <div className="text-meta text-muted truncate">
+ {glyph(machineOf(s.machine_id), s.machine_id)} {nameOf(s.machine_id)} ·{" "}
+ {s.state === "orphan" ? <span className="text-warnInk">{t("connconfig.session_gone")}</span> : s.title || s.session_id}
+ </div>
+ </div>
+ <button className={PILL_LINE} onClick={() => void unsubscribeCloud(s)} data-testid={`glance-unsub-${s.source}`}>
+ {s.state === "orphan" ? t("common.remove") : t("connconfig.unsubscribe")}
+ </button>
+ </div>
+ ))}
+ {localOnly.filter((s) => !scopes.some((sc) => s.channel.startsWith(`${connector}:${sc.id}/`))).map((s) => (
+ <div className={ROW} key={`local-${s.session_id}-${s.channel}`} data-testid="listening-local">
+ <div className="min-w-0 flex-1">
+ <div className="text-ui text-ink truncate">{s.channel_name ? `#${s.channel_name}` : channelLabel(s.channel)}</div>
+ <div className="text-meta text-muted truncate">💻 {t("connglance.this_mac")} · {s.session_title || s.session_id} · {t("connglance.local_only")}</div>
+ </div>
+ <button className={XBTN} title={t("connector.unsubscribe_title")} onClick={() => void unsubscribeLocal(s)}>
+ ×
+ </button>
+ </div>
+ ))}
+ </div>
+ <div className={FOOT}>
+ {connector === "slack" ? t("connglance.move_foot_channel") : t("connglance.move_foot_repo")}
+ </div>
+ </>
+ )}
+ {err && <div className="text-meta text-red-600 mt-2">{err}</div>}
+ {adding && local && (
+ <AddConnectionModal c={local} cloud={cloud} title={t("slack.add_workspace_title")} onClose={() => setAdding(false)} onChanged={load} />
+ )}
+ </div>
+ );
+}
+
+
+function WaitingRow({ connector, m, onChanged }: { connector: string; m: ParkedMessage; onChanged: () => void }) {
+ const { t } = useTranslation();
+ const act = async (action: "dismiss" | "allow" | "allow_deliver") => {
+ await resolveUnauthorized(connector, m.id, action);
+ onChanged();
+ };
+ return (
+ <div className={ROW + " bg-warnSoft/25"} data-testid={`waiting-${m.id}`}>
+ <span className={LABEL}>{t("connector.waiting")}</span>
+ <span className="min-w-0 flex-1">
+ <span className="font-medium text-ui">{m.user_name || m.user_id}</span>{" "}
+ <span className="text-ui text-muted">{t("connector.in_channel", { name: m.chat_name || m.chat_id })}</span>
+ <span className="block text-ui text-muted truncate">“{m.text}”</span>
+ </span>
+ <button className={PILL_ACCENT + " !py-1"} data-testid={`parked-allow-deliver-${m.id}`} title={t("slack.allow_deliver_title")} onClick={() => act("allow_deliver")}>
+ {t("connector.allow_deliver")}
+ </button>
+ <button className={PILL_LINE + " !py-1"} data-testid={`parked-allow-${m.id}`} title={t("slack.allow_discard_title")} onClick={() => act("allow")}>
+ {t("connector.allow")}
+ </button>
+ <button className={XBTN + " px-1"} data-testid={`parked-dismiss-${m.id}`} title={t("connector.dismiss")} onClick={() => act("dismiss")}>
+ ×
+ </button>
+ </div>
+ );
+}
+
+/** Subscriptions only this Mac knows (Socket Mode, or not yet registered). */
+function LocalListening({ subs, onChanged }: { subs: Subscription[]; onChanged: () => void }) {
+ const { t } = useTranslation();
+ return (
+ <div className={ROW} data-testid="listening-slack">
+ <span className={LABEL}>{t("connector.listening")}</span>
+ <span className="min-w-0 flex-1 space-y-1">
+ {subs.map((s) => (
+ <span key={s.session_id + s.channel} className="flex items-center gap-2 text-ui">
+ <span className="font-medium truncate" title={s.session_id}>{s.session_title || s.session_id}</span>
+ <span className="text-faint">←</span>
+ <span className="text-muted truncate" title={s.channel}>{s.channel_name ? `#${s.channel_name}` : s.channel}</span>
+ <span className="text-label text-faint">{t("connglance.this_mac_only")}</span>
+ <button
+ className={XBTN + " ml-auto"}
+ title={t("connector.unsubscribe_title")}
+ onClick={async () => {
+ await unsubscribeChannel(s.session_id, s.channel);
+ onChanged();
+ }}
+ >
+ ×
+ </button>
+ </span>
+ ))}
+ </span>
+ </div>
+ );
+}
diff --git a/surfaces/gui/src/components/connectors/ConnectorsList.tsx b/surfaces/gui/src/components/connectors/ConnectorsList.tsx
index 597475f2..d1b3730b 100644
--- a/surfaces/gui/src/components/connectors/ConnectorsList.tsx
+++ b/surfaces/gui/src/components/connectors/ConnectorsList.tsx
@@ -2,6 +2,7 @@ import { useState } from "react";
import { useTranslation } from "react-i18next";
import { type CloudStatus, type Connector, type McpServer, type SlackStatus } from "../../api";
import { ConnectorBadge } from "../../connectors/ConnectorIcon";
+import { ApprovalsRouting } from "../RemoteConnectorsPanel";
import { AddConnectionModal } from "./AddConnectionModal";
import { AddMcpModal, CustomMcpGroup, McpPresetRows, mcpPresetOffers } from "./CustomMcp";
import { CHIP_OK, CHIP_OFF, CHIP_WARN, GRP, GRP_H, FOOT, PILL_QUIET, ROW } from "./ui";
@@ -57,7 +58,7 @@ export function ConnectorsList({
placeholder={t("connector.search")}
value={filter}
onChange={(e) => setFilter(e.target.value)}
- className="w-44 px-3.5 py-1.5 rounded-full border border-line bg-panel text-[13px] outline-none focus:border-accent"
+ className="w-44 px-3.5 py-1.5 rounded-full border border-line bg-panel text-ui outline-none focus:border-accent"
/>
</div>
@@ -72,20 +73,28 @@ export function ConnectorsList({
<div className={GRP_H + " !mt-0"}>{t("connector.connected_count", { count: connected.length })}</div>
<div className={GRP}>
{connected.map((c) => (
- <button
+ // A div, not a button: the Slack row hosts the per-machine approvals
+ // control (UX-049), and a select cannot live inside a button.
+ <div
key={c.name}
+ role="button"
+ tabIndex={0}
data-testid={`connector-${c.name}`}
- className={ROW + " w-full text-left hover:bg-paper/60"}
+ className={ROW + " w-full text-left hover:bg-paper/60 cursor-pointer"}
onClick={() => onOpen(c.name)}
+ onKeyDown={(e) => {
+ if (e.key === "Enter" || e.key === " ") onOpen(c.name);
+ }}
>
<ConnectorBadge connector={c} size={34} title={c.title} />
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{c.title}</span>
- <span className="block text-[12px] text-muted">{statusLine(c, t)}</span>
+ <span className="font-medium text-ui">{c.title}</span>
+ <span className="block text-meta text-muted">{statusLine(c, t)}</span>
</span>
+ {c.name === "slack" && <ApprovalsRouting />}
{healthChip(c, slack, t)}
- <span className="text-faint text-[14px] shrink-0">›</span>
- </button>
+ <span className="text-faint text-body shrink-0">›</span>
+ </div>
))}
</div>
</>
@@ -112,8 +121,8 @@ export function ConnectorsList({
>
<ConnectorBadge connector={c} size={34} title={c.title} />
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{c.title}</span>
- <span className="block text-[12px] text-muted truncate">{c.blurb}</span>
+ <span className="font-medium text-ui">{c.title}</span>
+ <span className="block text-meta text-muted truncate">{c.blurb}</span>
</span>
<span
className={PILL_QUIET + " cursor-pointer"}
@@ -135,7 +144,7 @@ export function ConnectorsList({
onChanged={onChanged}
/>
{shown.length === 0 && mcpPresetOffers(mcpServers, filter).length === 0 && (
- <div className={ROW + " text-[13px] text-muted"}>{t("connector.nothing_matches")}</div>
+ <div className={ROW + " text-ui text-muted"}>{t("connector.nothing_matches")}</div>
)}
</div>
{!showAll && !q && available.length > AVAILABLE_FOLD && (
diff --git a/surfaces/gui/src/components/connectors/ConnectorsSection.tsx b/surfaces/gui/src/components/connectors/ConnectorsSection.tsx
index 9d64aa0a..3004c923 100644
--- a/surfaces/gui/src/components/connectors/ConnectorsSection.tsx
+++ b/surfaces/gui/src/components/connectors/ConnectorsSection.tsx
@@ -53,9 +53,15 @@ const DETAIL_PAGES: Record<string, (p: DetailProps) => JSX.Element> = {
hunter: (p) => <AccountsDetail {...p} />,
};
-export function ConnectorsSection() {
+export function ConnectorsSection({
+ onConfigure,
+ initialDetail = null,
+}: { onConfigure?: (name: string) => void; initialDetail?: string | null } = {}) {
const { t: tt } = useTranslation();
- const [detail, setDetail] = useState<string | null>(null);
+ // The per-machine management page (workspaces / installations on THIS Mac:
+ // add, disconnect, token health, people picker). Slack/GitHub rows open the
+ // account-wide glance page instead (UX-049); the glance page links here.
+ const [detail, setDetail] = useState<string | null>(initialDetail);
const [connectors, setConnectors] = useState<Connector[]>([]);
const [mcpServers, setMcpServers] = useState<McpServer[]>([]);
const [cloud, setCloud] = useState<CloudStatus | null>(null);
@@ -91,14 +97,14 @@ export function ConnectorsSection() {
return (
<div>
<button
- className="text-[13px] text-accent mb-3"
+ className="text-ui text-accent mb-3"
data-testid="connectors-breadcrumb"
onClick={() => setDetail(null)}
>
- ‹ Connectors
+ {tt("connector.back_to_connectors")}
</button>
{!s ? (
- <div className="text-[13px] text-muted">Loading…</div>
+ <div className="text-ui text-muted">{tt("connector.loading")}</div>
) : (
<McpServerDetail server={s} onChanged={refresh} onGone={() => setDetail(null)} />
)}
@@ -112,14 +118,14 @@ export function ConnectorsSection() {
return (
<div>
<button
- className="text-[13px] text-accent mb-3"
+ className="text-ui text-accent mb-3"
data-testid="connectors-breadcrumb"
onClick={() => setDetail(null)}
>
{tt("connector.back_to_connectors")}
</button>
{!c ? (
- <div className="text-[13px] text-muted">{tt("connector.loading")}</div>
+ <div className="text-ui text-muted">{tt("connector.loading")}</div>
) : !c.connected ? (
/* Pre-connect page (§38). When a connect completes, the poll flips
c.connected and this same route re-renders as the connected page. */
@@ -145,7 +151,7 @@ export function ConnectorsSection() {
mcpServers={mcpServers}
cloud={cloud}
slack={slack}
- onOpen={setDetail}
+ onOpen={(name) => (onConfigure && (name === "slack" || name === "github") ? onConfigure(name) : setDetail(name))}
onChanged={refresh}
/>
);
@@ -167,15 +173,15 @@ function GenericDetail({
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title={c.title} />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">{c.title}</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">{c.title}</h2>
+ <div className="text-ui text-muted flex items-center gap-1.5">
<span className="w-2 h-2 rounded-full bg-ok" />
{c.account || (c.auth === "none" ? t("connector.built_in") : t("connector.connected"))}
</div>
</div>
{c.auth !== "none" && (
<button
- className="text-[13px] text-danger/80 hover:text-danger shrink-0"
+ className="text-ui text-danger/80 hover:text-danger shrink-0"
onClick={async () => {
await disconnectConnector(c.name);
onChanged();
diff --git a/surfaces/gui/src/components/connectors/CustomMcp.tsx b/surfaces/gui/src/components/connectors/CustomMcp.tsx
index 5e030bf1..3e5e74e6 100644
--- a/surfaces/gui/src/components/connectors/CustomMcp.tsx
+++ b/surfaces/gui/src/components/connectors/CustomMcp.tsx
@@ -85,7 +85,7 @@ export function mcpStatusLine(s: McpServer): string {
// Live servers show it too — the visible receipt that clicking Test did
// something (it re-round-trips the connection and refreshes the tool count).
if (s.last_test_at) {
- const rel = relTime(s.last_test_at);
+ const rel = relTime(s.last_test_at, t);
if (rel) bits.push(t("mcp.tested_rel", { rel }));
}
return bits.join(" · ");
@@ -156,11 +156,11 @@ export function CustomMcpGroup({
>
<McpGlyph />
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{s.name}</span>
- <span className="block text-[12px] text-muted truncate">{mcpStatusLine(s)}</span>
+ <span className="font-medium text-ui">{s.name}</span>
+ <span className="block text-meta text-muted truncate">{mcpStatusLine(s)}</span>
</span>
{mcpChip(s)}
- <span className="text-faint text-[14px] shrink-0">›</span>
+ <span className="text-faint text-body shrink-0">›</span>
</button>
))}
</div>
@@ -199,8 +199,8 @@ export function McpPresetRows({
<div key={p.name} className={ROW} data-testid={`mcp-preset-${p.name}`}>
<McpGlyph />
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{p.label}</span>
- <span className="block text-[12px] text-muted truncate">{t(p.blurb)}</span>
+ <span className="font-medium text-ui">{p.label}</span>
+ <span className="block text-meta text-muted truncate">{t(p.blurb)}</span>
</span>
<span
className={PILL_QUIET + " cursor-pointer"}
@@ -231,7 +231,7 @@ const EXAMPLE = `{
}`;
const INPUT =
- "w-full text-[13px] px-3 py-2 rounded-lg border border-line bg-paper text-ink outline-none focus:border-accent";
+ "w-full text-ui px-3 py-2 rounded-lg border border-line bg-paper text-ink outline-none focus:border-accent";
// A friendly default server name from its URL: walk the hostname's labels left to
// right, skip the generic ones (mcp/api/data/www…), take the first distinctive label
@@ -324,7 +324,7 @@ export function AddMcpModal({
};
const tabBtn = (active: boolean) =>
- "text-[12px] px-2.5 py-1 rounded-md border shrink-0 " +
+ "text-meta px-2.5 py-1 rounded-md border shrink-0 " +
(active ? "border-accent text-accent font-medium" : "border-line text-muted hover:text-ink");
return (
@@ -332,8 +332,8 @@ export function AddMcpModal({
<div className="absolute inset-0 bg-black/30" onClick={onClose} />
<div className="absolute left-1/2 top-24 -translate-x-1/2 w-[540px] max-w-[92vw] rounded-xl2 border border-line bg-panel shadow-xl p-5 space-y-3">
<div className="flex items-center justify-between">
- <div className="text-[14px] font-semibold">{t("mcp.add_title")}</div>
- <button className="text-faint hover:text-ink text-[16px] leading-none" onClick={onClose}>
+ <div className="text-body font-semibold">{t("mcp.add_title")}</div>
+ <button className="text-faint hover:text-ink text-body leading-none" onClick={onClose}>
×
</button>
</div>
@@ -347,7 +347,7 @@ export function AddMcpModal({
</div>
{tab === "url" ? (
<>
- <div className="text-[13px] text-muted">{t("mcp.add_url_blurb")}</div>
+ <div className="text-ui text-muted">{t("mcp.add_url_blurb")}</div>
<input
value={name}
onChange={(e) => setName(e.target.value)}
@@ -366,19 +366,19 @@ export function AddMcpModal({
}}
placeholder="https://mcp.example.com/mcp"
spellCheck={false}
- className={INPUT + " font-mono text-[12px]"}
+ className={INPUT + " font-mono text-meta"}
data-testid="mcp-add-url"
/>
</>
) : (
<>
- <div className="text-[13px] text-muted">{t("mcp.add_json_blurb")}</div>
+ <div className="text-ui text-muted">{t("mcp.add_json_blurb")}</div>
<textarea
value={text}
onChange={(e) => setText(e.target.value)}
spellCheck={false}
rows={9}
- className="w-full font-mono text-[12px] px-3 py-2.5 rounded-lg border border-line bg-paper text-ink outline-none focus:border-accent resize-y"
+ className="w-full font-mono text-meta px-3 py-2.5 rounded-lg border border-line bg-paper text-ink outline-none focus:border-accent resize-y"
/>
</>
)}
@@ -386,11 +386,11 @@ export function AddMcpModal({
<button className={PILL_ACCENT} onClick={tab === "url" ? saveUrl : saveJson}>
{tab === "url" ? t("mcp.add_and_test") : t("manage.add_btn")}
</button>
- <button className="text-[13px] text-muted hover:text-ink" onClick={onClose}>
+ <button className="text-ui text-muted hover:text-ink" onClick={onClose}>
{t("manage.cancel")}
</button>
</div>
- {error && <div className="text-[13px] text-danger">{error}</div>}
+ {error && <div className="text-ui text-danger">{error}</div>}
</div>
</div>
);
@@ -533,9 +533,9 @@ export function McpToolReview({
<span className="text-warnInk shrink-0">
<Icon name="warning" size={15} />
</span>
- <span className="min-w-0 flex-1 text-[13px]">
+ <span className="min-w-0 flex-1 text-ui">
<span className="font-medium block">{t("mcp.legacy_warn_title")}</span>
- <span className="block text-[12px] text-muted">{t("mcp.legacy_warn_body")}</span>
+ <span className="block text-meta text-muted">{t("mcp.legacy_warn_body")}</span>
</span>
<span
className={PILL_ACCENT + " cursor-pointer shrink-0" + (converting ? " opacity-50" : "")}
@@ -589,13 +589,13 @@ export function McpToolReview({
);
const errLine = err && (
- <div className="px-4 py-2.5 text-[13px] text-danger">{err}</div>
+ <div className="px-4 py-2.5 text-ui text-danger">{err}</div>
);
const list = offered && checked && (
<div className="py-1 max-h-[320px] overflow-y-auto hairline-scroll">
{offered.length === 0 && (
- <div className="text-[12px] text-faint px-4 py-1">{t("manage.mcp_no_tools")}</div>
+ <div className="text-meta text-faint px-4 py-1">{t("manage.mcp_no_tools")}</div>
)}
{offered.map((tool) => {
// "new" = the SERVER's menu grew: a name neither list has ever seen.
@@ -617,7 +617,7 @@ export function McpToolReview({
badge={
isNew ? (
<span
- className="ml-1.5 text-[11px] px-1.5 rounded-full bg-warnSoft text-warnInk"
+ className="ml-1.5 text-label px-1.5 rounded-full bg-warnSoft text-warnInk"
data-testid={`mcp-tool-new-${tool.name}`}
>
{t("mcp.tools_new_badge")}
@@ -626,7 +626,7 @@ export function McpToolReview({
}
description={
tool.description ? (
- <span className="block text-[12px] text-muted truncate" title={tool.description}>
+ <span className="block text-meta text-muted truncate" title={tool.description}>
“{tool.description}”
</span>
) : undefined
@@ -657,7 +657,7 @@ export function McpToolReview({
{t("mcp.trust_marker")}
</span>
<button
- className="text-[11px] underline text-muted hover:text-danger"
+ className="text-label underline text-muted hover:text-danger"
data-testid={`mcp-tool-revoke-${tool.name}`}
onClick={async (e) => {
e.preventDefault();
@@ -680,10 +680,10 @@ export function McpToolReview({
return (
<details>
<summary className={ROW + " cursor-pointer hover:bg-paper/60 list-none [&::-webkit-details-marker]:hidden"}>
- <span className="text-[13px] text-muted w-24 shrink-0">
+ <span className="text-ui text-muted w-24 shrink-0">
{t("connector.tools_label")}
</span>
- <span className="min-w-0 flex-1 text-[13px] text-muted">
+ <span className="min-w-0 flex-1 text-ui text-muted">
{t("tools.enabled_count", { checked: checked!.size, total: offered!.length })}
{/* Granted authority stays advertised even while collapsed. */}
{trustCount > 0 && <> · {t("mcp.trust_count", { count: trustCount })}</>}
@@ -699,7 +699,7 @@ export function McpToolReview({
return (
<>
<div className={ROW}>
- <span className="text-[13px] flex-1">
+ <span className="text-ui flex-1">
{t("available.tools")}
{offered && checked && (
<ToolsCountLine
@@ -716,7 +716,7 @@ export function McpToolReview({
</span>
{offered === null && (
<button
- className="text-[13px] text-muted hover:text-ink"
+ className="text-ui text-muted hover:text-ink"
onClick={load}
disabled={busy}
data-testid={`mcp-tools-load-${server.name}`}
@@ -801,15 +801,15 @@ export function McpServerDetail({
<div className="flex items-center gap-3">
<McpGlyph />
<div className="flex-1 min-w-0">
- <div className="text-[16px] font-semibold">{server.name}</div>
- <div className="text-[12px] text-muted">{mcpStatusLine(server)}</div>
+ <div className="text-body font-semibold">{server.name}</div>
+ <div className="text-meta text-muted">{mcpStatusLine(server)}</div>
</div>
{mcpChip(server)}
</div>
<div className={GRP}>
<div className={ROW}>
- <span className="text-[13px] flex-1">{t("persona.enabled")}</span>
+ <span className="text-ui flex-1">{t("persona.enabled")}</span>
<Toggle
checked={server.enabled}
onChange={async () => {
@@ -820,9 +820,9 @@ export function McpServerDetail({
/>
</div>
<div className={ROW}>
- <span className="text-[13px] flex-1">
+ <span className="text-ui flex-1">
{t("mcp.test_connection")}
- <span className="block text-[12px] text-faint">{t("mcp.test_desc")}</span>
+ <span className="block text-meta text-faint">{t("mcp.test_desc")}</span>
</span>
{server.auth_hint && !isOauth ? (
<span
@@ -861,14 +861,14 @@ export function McpServerDetail({
durable receipt stays in the header. Failures stay persistent in red. */}
{freshResult && server.status === "connected" && server.last_test_at ? (
<div
- className="px-4 py-2 text-[12px] text-ok"
+ className="px-4 py-2 text-meta text-ok"
data-testid={`mcp-test-ok-${server.name}`}
>
- ✓ {t("mcp.test_ok", { count: server.tool_count ?? 0, rel: relTime(server.last_test_at) })}
+ ✓ {t("mcp.test_ok", { count: server.tool_count ?? 0, rel: relTime(server.last_test_at, t) })}
</div>
) : null}
{server.last_error && server.status !== "connected" && (
- <div className="px-4 py-2.5 text-[13px] text-danger break-words">
+ <div className="px-4 py-2.5 text-ui text-danger break-words">
{server.last_error}
</div>
)}
@@ -886,7 +886,7 @@ export function McpServerDetail({
<div className="flex items-center gap-4">
{isOauth && server.status === "connected" && (
<button
- className="text-[13px] text-muted hover:text-ink"
+ className="text-ui text-muted hover:text-ink"
onClick={async () => {
await signoutMcp(server.name);
onChanged();
@@ -898,7 +898,7 @@ export function McpServerDetail({
</button>
)}
<button
- className="text-[13px] text-danger/80 hover:text-danger"
+ className="text-ui text-danger/80 hover:text-danger"
onClick={async () => {
await deleteMcpServer(server.name);
onChanged();
diff --git a/surfaces/gui/src/components/connectors/GithubDetail.tsx b/surfaces/gui/src/components/connectors/GithubDetail.tsx
index b7b86e52..99d2caaf 100644
--- a/surfaces/gui/src/components/connectors/GithubDetail.tsx
+++ b/surfaces/gui/src/components/connectors/GithubDetail.tsx
@@ -26,7 +26,7 @@ import { FOOT, GRP, GRP_H, PILL_ACCENT, PILL_LINE, ROW, TAG_WARN, XBTN } from ".
// thread, which the GUI can't map back to an installation). Adding an
// installation goes through the ONE entry point: header button → modal.
-const LABEL = "text-[13px] text-muted w-24 shrink-0";
+const LABEL = "text-ui text-muted w-24 shrink-0";
/** The relay status line, one honest layer at a time (the Slack rule). */
function relayHealth(gh: GithubStatus | null, t: (k: string) => string): { dot: string; text: string } {
@@ -66,8 +66,8 @@ export function GithubDetail({ c, cloud, onChanged }: DetailProps) {
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title="GitHub" />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">GitHub</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">GitHub</h2>
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span
@@ -99,7 +99,7 @@ export function GithubDetail({ c, cloud, onChanged }: DetailProps) {
{!c.connected && (
<div className={GRP}>
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("github.setup_blurb")}
{cloud?.signed_in ? "" : " " + t("github.setup_cloud_note")}
</div>
@@ -120,7 +120,7 @@ export function GithubDetail({ c, cloud, onChanged }: DetailProps) {
{/* Manual PAT: request/response tools only — no inbound triggers. */}
{c.connected && !relay && (
<div className={GRP} data-testid="github-manual-card">
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("github.manual_card_note")}
</div>
</div>
@@ -196,7 +196,7 @@ function InstallationGroup({
<div className={GRP}>
{empty ? (
<div className={ROW}>
- <span className="min-w-0 flex-1 text-[13px] text-muted">
+ <span className="min-w-0 flex-1 text-ui text-muted">
{t("github.empty_parked_note")}
</span>
<DisconnectBtn id={inst.installation_id} busy={busy} onClick={disconnect} />
@@ -226,7 +226,7 @@ function DisconnectBtn({ id, busy, onClick }: { id: string; busy: boolean; onCli
const { t } = useTranslation();
return (
<button
- className="text-[13px] text-danger/80 hover:text-danger shrink-0"
+ className="text-ui text-danger/80 hover:text-danger shrink-0"
data-testid={`disconnect-install-${id}`}
title={t("github.disconnect_install_title")}
onClick={onClick}
@@ -252,12 +252,12 @@ function PeopleRow({
<span className={LABEL}>{t("connector.people")}</span>
<span className="min-w-0 flex-1 flex flex-wrap items-center gap-1.5">
{allowed.length === 0 && (
- <span className="text-[12px] text-faint">{t("github.nobody_yet")}</span>
+ <span className="text-meta text-faint">{t("github.nobody_yet")}</span>
)}
{allowed.map((login) => (
<span
key={login}
- className="inline-flex items-center gap-1.5 pl-2 pr-2 py-0.5 rounded-full bg-paper border border-line text-[13px]"
+ className="inline-flex items-center gap-1.5 pl-2 pr-2 py-0.5 rounded-full bg-paper border border-line text-ui"
>
{/* GitHub logins ARE the readable identity — no resolution needed. */}
@{login}
@@ -285,9 +285,9 @@ function WaitingRow({ m, onChanged }: { m: ParkedMessage; onChanged: () => void
<div className={ROW + " bg-warnSoft/25"} data-testid={`waiting-${m.id}`}>
<span className={LABEL}>{t("connector.waiting")}</span>
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">@{m.user_name || m.user_id}</span>{" "}
- <span className="text-[13px] text-muted">{t("connector.in_channel", { name: m.chat_name || m.chat_id })}</span>
- <span className="block text-[13px] text-muted truncate">“{m.text}”</span>
+ <span className="font-medium text-ui">@{m.user_name || m.user_id}</span>{" "}
+ <span className="text-ui text-muted">{t("connector.in_channel", { name: m.chat_name || m.chat_id })}</span>
+ <span className="block text-ui text-muted truncate">“{m.text}”</span>
</span>
<button
className={PILL_ACCENT + " !py-1"}
@@ -319,7 +319,7 @@ function ListeningRows({ subs, onChanged }: { subs: Subscription[]; onChanged: (
<span className={LABEL}>{t("connector.listening")}</span>
<span className="min-w-0 flex-1 space-y-1">
{subs.map((s) => (
- <span key={s.session_id + s.channel} className="flex items-center gap-2 text-[13px]">
+ <span key={s.session_id + s.channel} className="flex items-center gap-2 text-ui">
<span className="font-medium truncate" title={s.session_id}>
{s.session_title || s.session_id}
</span>
diff --git a/surfaces/gui/src/components/connectors/GmailDetail.tsx b/surfaces/gui/src/components/connectors/GmailDetail.tsx
index 5fafd589..aa9a5228 100644
--- a/surfaces/gui/src/components/connectors/GmailDetail.tsx
+++ b/surfaces/gui/src/components/connectors/GmailDetail.tsx
@@ -17,7 +17,7 @@ import { FOOT, GRP, GRP_H, PILL_ACCENT, ROW, TAG_ACCENT, TAG_WARN, XBTN } from "
// Adding an account launches managed OAuth DIRECTLY — Gmail has one connect mode,
// so no modal (the pill-modal is only for ≥2-mode connectors like Slack).
-const LABEL = "text-[13px] text-muted w-24 shrink-0";
+const LABEL = "text-ui text-muted w-24 shrink-0";
export function GmailDetail({ c, cloud, slack: _slack, onChanged }: DetailProps) {
const { t } = useTranslation();
@@ -35,8 +35,8 @@ export function GmailDetail({ c, cloud, slack: _slack, onChanged }: DetailProps)
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title="Gmail" />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">Gmail</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">Gmail</h2>
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span className="w-2 h-2 rounded-full bg-ok" />
@@ -68,7 +68,7 @@ export function GmailDetail({ c, cloud, slack: _slack, onChanged }: DetailProps)
{!c.connected && (
<div className={GRP}>
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("gmail.setup_blurb")}
{cloud?.signed_in ? "" : " " + t("gmail.requires_cloud")}
</div>
@@ -102,13 +102,13 @@ function AccountRow({ a, onChanged }: { a: GmailAccount; onChanged: () => void }
return (
<div className={ROW} data-testid={`gmail-account-${a.email}`}>
<span className="min-w-0 flex-1 flex items-center gap-2">
- <span className="text-[13px] font-medium truncate">{a.email}</span>
+ <span className="text-ui font-medium truncate">{a.email}</span>
{a.default && <span className={TAG_ACCENT}>{t("connector.default")}</span>}
{a.needs_reauth && <span className={TAG_WARN}>{t("gmail.sign_in_again")}</span>}
</span>
{!a.default && (
<button
- className="text-[12px] text-muted hover:text-ink shrink-0"
+ className="text-meta text-muted hover:text-ink shrink-0"
data-testid={`gmail-make-default-${a.email}`}
onClick={async () => {
await setGmailDefaultAccount(a.email);
@@ -199,7 +199,7 @@ function ChipListRow({
{values.map((v) => (
<span
key={v}
- className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-paper border border-line text-[13px]"
+ className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-paper border border-line text-ui"
>
{v}
<button
@@ -212,7 +212,7 @@ function ChipListRow({
</span>
))}
<input
- className="flex-1 min-w-[140px] bg-transparent text-[13px] outline-none placeholder:text-faint"
+ className="flex-1 min-w-[140px] bg-transparent text-ui outline-none placeholder:text-faint"
placeholder={placeholder}
value={draft}
onChange={(e) => setDraft(e.target.value)}
diff --git a/surfaces/gui/src/components/connectors/HubSpotDetail.tsx b/surfaces/gui/src/components/connectors/HubSpotDetail.tsx
index de74f59e..4db64409 100644
--- a/surfaces/gui/src/components/connectors/HubSpotDetail.tsx
+++ b/surfaces/gui/src/components/connectors/HubSpotDetail.tsx
@@ -18,7 +18,7 @@ import { FOOT, GRP, GRP_H, PILL_ACCENT, ROW, TAG_ACCENT, TAG_QUIET, TAG_WARN, XB
// are the ACL against humans) + collapsed Tools. Adding a portal goes through
// the ONE entry point: header button → modal (One click w/ access radios | Manual).
-const LABEL = "text-[13px] text-muted w-24 shrink-0";
+const LABEL = "text-ui text-muted w-24 shrink-0";
export function HubSpotDetail({ c, cloud, slack: _slack, onChanged }: DetailProps) {
const { t } = useTranslation();
@@ -30,8 +30,8 @@ export function HubSpotDetail({ c, cloud, slack: _slack, onChanged }: DetailProp
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title="HubSpot" />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">HubSpot</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">HubSpot</h2>
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span className="w-2 h-2 rounded-full bg-ok" />
@@ -51,7 +51,7 @@ export function HubSpotDetail({ c, cloud, slack: _slack, onChanged }: DetailProp
{!c.connected && (
<div className={GRP}>
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("hubspot.setup_blurb")}
</div>
</div>
@@ -94,7 +94,7 @@ function PortalRow({ p, onChanged }: { p: HubSpotPortal; onChanged: () => void }
return (
<div className={ROW} data-testid={`hubspot-portal-${p.hub_id}`}>
<span className="min-w-0 flex-1 flex items-center gap-2">
- <span className="text-[13px] font-medium truncate" title={`hub ${p.hub_id}`}>
+ <span className="text-ui font-medium truncate" title={`hub ${p.hub_id}`}>
{p.name}
</span>
{p.default && <span className={TAG_ACCENT}>{t("connector.default")}</span>}
@@ -108,7 +108,7 @@ function PortalRow({ p, onChanged }: { p: HubSpotPortal; onChanged: () => void }
</span>
{!p.default && (
<button
- className="text-[12px] text-muted hover:text-ink shrink-0"
+ className="text-meta text-muted hover:text-ink shrink-0"
data-testid={`hubspot-make-default-${p.hub_id}`}
onClick={async () => {
await setHubSpotDefaultPortal(p.hub_id);
@@ -160,7 +160,7 @@ function PrivacyGroup({ c, onChanged }: Pick<DetailProps, "c" | "onChanged">) {
{fields.map((f) => (
<span
key={f}
- className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-paper border border-line text-[13px] font-mono"
+ className="inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-paper border border-line text-ui font-mono"
>
{f}
<button className={XBTN} title={t("common.remove")} onClick={() => save(fields.filter((x) => x !== f))}>
@@ -169,7 +169,7 @@ function PrivacyGroup({ c, onChanged }: Pick<DetailProps, "c" | "onChanged">) {
</span>
))}
<input
- className="flex-1 min-w-[140px] bg-transparent text-[13px] outline-none placeholder:text-faint"
+ className="flex-1 min-w-[140px] bg-transparent text-ui outline-none placeholder:text-faint"
placeholder={t("hubspot.hidden_fields_placeholder")}
value={draft}
onChange={(e) => setDraft(e.target.value)}
diff --git a/surfaces/gui/src/components/connectors/SlackDetail.tsx b/surfaces/gui/src/components/connectors/SlackDetail.tsx
index f8868e0c..ac6f8d6b 100644
--- a/surfaces/gui/src/components/connectors/SlackDetail.tsx
+++ b/surfaces/gui/src/components/connectors/SlackDetail.tsx
@@ -38,7 +38,7 @@ function initials(name: string): string {
return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
}
-const LABEL = "text-[13px] text-muted w-24 shrink-0";
+const LABEL = "text-ui text-muted w-24 shrink-0";
/** The relay status line, one honest layer at a time: sign-in → socket → live.
* Dot color + text; never a synthetic "Slack is down" claim. */
@@ -74,8 +74,8 @@ export function SlackDetail({ c, cloud, slack, onChanged }: DetailProps) {
<div className="flex items-center gap-3.5 mb-5">
<ConnectorBadge connector={c} size={44} title="Slack" />
<div className="min-w-0 flex-1">
- <h2 className="text-[20px] font-semibold tracking-tight leading-tight">Slack</h2>
- <div className="text-[13px] text-muted flex items-center gap-1.5">
+ <h2 className="text-title font-semibold tracking-tight leading-tight">Slack</h2>
+ <div className="text-ui text-muted flex items-center gap-1.5">
{c.connected ? (
<>
<span
@@ -103,7 +103,7 @@ export function SlackDetail({ c, cloud, slack, onChanged }: DetailProps) {
{!c.connected && (
<div className={GRP}>
- <div className={ROW + " text-[13px] text-muted"}>
+ <div className={ROW + " text-ui text-muted"}>
{t("slack.setup_blurb")}
{cloud?.signed_in ? "" : " " + t("slack.setup_cloud_note")}
</div>
@@ -223,7 +223,7 @@ function WorkspaceGroup({
{empty ? (
<>
<div className={ROW}>
- <span className="min-w-0 flex-1 text-[13px] text-muted flex items-center gap-2 flex-wrap">
+ <span className="min-w-0 flex-1 text-ui text-muted flex items-center gap-2 flex-wrap">
<span>{t("slack.empty_parked_note")}</span>
<PersonPicker teamId={w.team_id} allowed={[]} onChanged={onChanged} />
</span>
@@ -277,7 +277,7 @@ function DisconnectBtn({ teamId, busy, onClick }: { teamId: string; busy: boolea
const { t } = useTranslation();
return (
<button
- className="text-[13px] text-danger/80 hover:text-danger shrink-0"
+ className="text-ui text-danger/80 hover:text-danger shrink-0"
data-testid={`disconnect-workspace-${teamId}`}
title={t("slack.disconnect_workspace_title")}
onClick={onClick}
@@ -317,12 +317,12 @@ function PeopleRow({
<span className={LABEL}>{t("connector.people")}</span>
<span className="min-w-0 flex-1 flex flex-wrap items-center gap-1.5">
{allowed.length === 0 && (
- <span className="text-[12px] text-faint">{t("slack.nobody_yet")}</span>
+ <span className="text-meta text-faint">{t("slack.nobody_yet")}</span>
)}
{allowed.map((u) => (
<span
key={u}
- className="inline-flex items-center gap-1.5 pl-1 pr-2 py-0.5 rounded-full bg-paper border border-line text-[13px]"
+ className="inline-flex items-center gap-1.5 pl-1 pr-2 py-0.5 rounded-full bg-paper border border-line text-ui"
title={`id ${u}`}
data-testid={u === installerId ? "people-chip-you" : undefined}
>
@@ -330,10 +330,10 @@ function PeopleRow({
{initials(label(u))}
</span>
{label(u)}
- {u === installerId && <span className="text-[11px] text-faint">{t("slack.you_suffix")}</span>}
+ {u === installerId && <span className="text-label text-faint">{t("slack.you_suffix")}</span>}
{protectedIds?.includes(u) ? (
<span
- className="text-[11px] text-faint"
+ className="text-label text-faint"
title={t("slack.owner_protected_title")}
>
{t("slack.owner_suffix")}
@@ -382,7 +382,16 @@ function PersonPicker({
const toggle = () => {
if (open) return setOpen(false);
const r = btn.current?.getBoundingClientRect();
- setPos(r ? { top: r.bottom + 4, left: Math.min(r.left, window.innerWidth - 300) } : null);
+ // Clamp to the viewport: the drop is ~290px tall (input + 224px list), and a
+ // button low on the page would otherwise open it below the fold (UX-048 catch).
+ setPos(
+ r
+ ? {
+ top: Math.max(8, Math.min(r.bottom + 4, window.innerHeight - 296)),
+ left: Math.min(r.left, window.innerWidth - 300),
+ }
+ : null,
+ );
setOpen(true);
};
@@ -415,7 +424,7 @@ function PersonPicker({
? await onPick(m)
: await allowUser("slack", m.id, teamId, m.name);
if (result?.ok === false) {
- setErr(result.error || "could not add person");
+ setErr(result.error || tt("misc.slack.add_person_failed"));
return;
}
setOpen(false);
@@ -428,7 +437,7 @@ function PersonPicker({
<span className="relative" ref={wrap}>
<button
ref={btn}
- className="inline-flex items-center px-2 py-0.5 rounded-full border border-dashed border-line text-[13px] text-muted hover:text-ink hover:border-faint"
+ className="inline-flex items-center px-2 py-0.5 rounded-full border border-dashed border-line text-ui text-muted hover:text-ink hover:border-faint"
data-testid={testId || `add-person-${teamId || "default"}`}
title={tt("slack.pick_from_directory")}
onClick={toggle}
@@ -443,7 +452,7 @@ function PersonPicker({
>
<input
autoFocus
- className="w-full bg-paper border border-line rounded-lg px-2 py-1 text-[13px] outline-none placeholder:text-faint"
+ className="w-full bg-paper border border-line rounded-lg px-2 py-1 text-ui outline-none placeholder:text-faint"
placeholder={tt("slack.type_a_name")}
value={q}
onChange={(e) => setQ(e.target.value)}
@@ -453,9 +462,9 @@ function PersonPicker({
/>
<div className="max-h-56 overflow-y-auto py-1">
{err ? (
- <div className="px-2 py-1.5 text-[12px] text-warnInk">{err}</div>
+ <div className="px-2 py-1.5 text-meta text-warnInk">{err}</div>
) : candidates.length === 0 ? (
- <div className="px-2 py-1.5 text-[12px] text-faint">{tt("slack.no_matches")}</div>
+ <div className="px-2 py-1.5 text-meta text-faint">{tt("slack.no_matches")}</div>
) : (
candidates.map((m) => (
<button
@@ -469,10 +478,10 @@ function PersonPicker({
pick(m);
}}
>
- <span className="text-[13px] font-medium">{m.name}</span>{" "}
- <span className="text-[12px] text-faint">@{m.handle}</span>
+ <span className="text-ui font-medium">{m.name}</span>{" "}
+ <span className="text-meta text-faint">@{m.handle}</span>
{m.guest && (
- <span className="ml-1.5 text-[11px] text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1 py-0.5">
+ <span className="ml-1.5 text-label text-warnInk bg-warnSoft/70 border border-warnInk/15 rounded px-1 py-0.5">
{tt("slack.guest")}
</span>
)}
@@ -480,7 +489,7 @@ function PersonPicker({
))
)}
</div>
- <div className="px-2 pb-1 text-[11px] text-faint">
+ <div className="px-2 pb-1 text-label text-faint">
{tt("slack.directory_foot")}
</div>
</div>
@@ -522,14 +531,14 @@ function ApprovalOwnersRow({
<span className={LABEL}>{t("slack.approvals_label")}</span>
<span className="min-w-0 flex-1 flex flex-wrap items-center gap-1.5">
{owners.length === 0 && (
- <span className="text-[12px] text-warnInk">
+ <span className="text-meta text-warnInk">
{t("slack.choose_owner_warning")}
</span>
)}
{owners.map((u) => (
<span
key={u}
- className="inline-flex items-center gap-1.5 pl-1 pr-2 py-0.5 rounded-full bg-paper border border-line text-[13px]"
+ className="inline-flex items-center gap-1.5 pl-1 pr-2 py-0.5 rounded-full bg-paper border border-line text-ui"
title={`id ${u}`}
data-testid={`approval-owner-${u}`}
>
@@ -537,7 +546,7 @@ function ApprovalOwnersRow({
{initials(label(u))}
</span>
{label(u)}
- {u === installerId && <span className="text-[11px] text-faint">{t("slack.installer_suffix")}</span>}
+ {u === installerId && <span className="text-label text-faint">{t("slack.installer_suffix")}</span>}
{editable && (
<button className={XBTN} title={t("slack.remove_owner_title")} onClick={() => remove(u)}>
×
@@ -556,9 +565,9 @@ function ApprovalOwnersRow({
/>
)}
{!editable && owners.length > 0 && (
- <span className="text-[12px] text-faint">{t("slack.owner_set_by_installer")}</span>
+ <span className="text-meta text-faint">{t("slack.owner_set_by_installer")}</span>
)}
- {err && <span className="basis-full text-[12px] text-warnInk">{err}</span>}
+ {err && <span className="basis-full text-meta text-warnInk">{err}</span>}
</span>
</div>
);
@@ -574,9 +583,9 @@ function WaitingRow({ m, onChanged }: { m: ParkedMessage; onChanged: () => void
<div className={ROW + " bg-warnSoft/25"} data-testid={`waiting-${m.id}`}>
<span className={LABEL}>{t("connector.waiting")}</span>
<span className="min-w-0 flex-1">
- <span className="font-medium text-[13px]">{m.user_name || m.user_id}</span>{" "}
- <span className="text-[13px] text-muted">{t("connector.in_channel", { name: m.chat_name || m.chat_id })}</span>
- <span className="block text-[13px] text-muted truncate">“{m.text}”</span>
+ <span className="font-medium text-ui">{m.user_name || m.user_id}</span>{" "}
+ <span className="text-ui text-muted">{t("connector.in_channel", { name: m.chat_name || m.chat_id })}</span>
+ <span className="block text-ui text-muted truncate">“{m.text}”</span>
</span>
<button
className={PILL_ACCENT + " !py-1"}
@@ -609,7 +618,7 @@ function ListeningRows({ subs, onChanged }: { subs: Subscription[]; onChanged: (
<span className={LABEL}>{t("connector.listening")}</span>
<span className="min-w-0 flex-1 space-y-1">
{subs.map((s) => (
- <span key={s.session_id + s.channel} className="flex items-center gap-2 text-[13px]">
+ <span key={s.session_id + s.channel} className="flex items-center gap-2 text-ui">
<span className="font-medium truncate" title={s.session_id}>
{s.session_title || s.session_id}
</span>
diff --git a/surfaces/gui/src/components/connectors/SlackHowItWorks.tsx b/surfaces/gui/src/components/connectors/SlackHowItWorks.tsx
index 03abd5aa..ca4fb56d 100644
--- a/surfaces/gui/src/components/connectors/SlackHowItWorks.tsx
+++ b/surfaces/gui/src/components/connectors/SlackHowItWorks.tsx
@@ -79,11 +79,11 @@ export function SlackHowItWorks({ workspaces }: { workspaces: SlackWorkspace[] }
// the only boxes on screen are the two mini-windows, which own their frames.
<div className="mb-5" data-testid="slack-howitworks">
<div className="flex items-baseline gap-2.5">
- <h3 className="text-[13px] font-semibold tracking-tight">
+ <h3 className="text-ui font-semibold tracking-tight">
{t("slack.hiw_title")}
</h3>
<button
- className="ml-auto shrink-0 inline-flex items-center gap-1.5 text-[12px] text-muted hover:text-ink"
+ className="ml-auto shrink-0 inline-flex items-center gap-1.5 text-meta text-muted hover:text-ink"
data-testid="hiw-collapse"
title={collapsed ? t("slack.hiw_show") : t("slack.hiw_collapse")}
onClick={toggle}
@@ -97,7 +97,7 @@ export function SlackHowItWorks({ workspaces }: { workspaces: SlackWorkspace[] }
</span>
</button>
</div>
- <div className="text-[12px] text-muted mt-0.5">
+ <div className="text-meta text-muted mt-0.5">
<span className="text-ok font-bold">✓ </span>
{(ws?.account || t("slack.hiw_workspace")) + " " + t("slack.hiw_connected")}
{mine
@@ -127,7 +127,7 @@ export function SlackHowItWorks({ workspaces }: { workspaces: SlackWorkspace[] }
{tab === 1 && <SceneThread meFirst={meFirst} meInitial={meInitial} />}
{tab === 2 && <SceneTeammates />}
</div>
- <div className="mt-2.5 text-[12px] text-muted" data-testid="hiw-caption">
+ <div className="mt-2.5 text-meta text-muted" data-testid="hiw-caption">
{t(CAPTIONS[tab])}
</div>
</div>
diff --git a/surfaces/gui/src/components/connectors/ToolReview.tsx b/surfaces/gui/src/components/connectors/ToolReview.tsx
index 93be73c6..22c0424e 100644
--- a/surfaces/gui/src/components/connectors/ToolReview.tsx
+++ b/surfaces/gui/src/components/connectors/ToolReview.tsx
@@ -54,7 +54,7 @@ export function ToolRow({
onChange={onToggle}
/>
<span className="min-w-0 flex-1">
- <span className={mono ? "font-mono text-[12px]" : "text-[13px] font-medium"}>{name}</span>
+ <span className={mono ? "font-mono text-meta" : "text-ui font-medium"}>{name}</span>
{badge}
{description}
</span>
@@ -96,7 +96,7 @@ export function ToolsCountLine({
}) {
const { t } = useTranslation();
return (
- <span className="block text-[12px] text-faint">
+ <span className="block text-meta text-faint">
{showCount && (
<>
{t("tools.enabled_count", { checked, total })}
@@ -123,7 +123,7 @@ export function SavedTick({ show, testId }: { show: boolean; testId?: string })
const { t } = useTranslation();
if (!show) return null;
return (
- <span className="text-[12px] text-ok" data-testid={testId}>
+ <span className="text-meta text-ok" data-testid={testId}>
{t("tools.saved")}
</span>
);
diff --git a/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx b/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
index 41da331e..39d89692 100644
--- a/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
+++ b/surfaces/gui/src/components/connectors/ToolsDisclosure.tsx
@@ -16,8 +16,8 @@ export function ToolsDisclosure({ c, onChanged }: { c: Connector; onChanged: ()
<div className={GRP + " mt-6"}>
<details>
<summary className={ROW + " cursor-pointer hover:bg-paper/60 list-none [&::-webkit-details-marker]:hidden"}>
- <span className="text-[13px] text-muted w-24 shrink-0">{t("connector.tools_label")}</span>
- <span className="min-w-0 flex-1 text-[13px] text-muted">
+ <span className="text-ui text-muted w-24 shrink-0">{t("connector.tools_label")}</span>
+ <span className="min-w-0 flex-1 text-ui text-muted">
{t("tools.enabled_count", { checked: enabled, total: c.tools.length })}
</span>
<SavedTick show={savedTick} testId={`connector-tools-saved-${c.name}`} />
diff --git a/surfaces/gui/src/components/connectors/ui.ts b/surfaces/gui/src/components/connectors/ui.ts
index c347de8e..ebfe91e1 100644
--- a/surfaces/gui/src/components/connectors/ui.ts
+++ b/surfaces/gui/src/components/connectors/ui.ts
@@ -9,17 +9,17 @@ export const GRP = "rounded-xl2 border border-line bg-panel divide-y divide-line
export const ROW = "flex items-center gap-3 px-4 py-2.5 min-h-[44px]";
/** Sentence-case section header above a group. */
-export const GRP_H = "text-[12px] font-semibold text-muted px-4 mt-6 mb-1.5";
+export const GRP_H = "text-meta font-semibold text-muted px-4 mt-6 mb-1.5";
/** Quiet footnote under a group. */
-export const FOOT = "text-[12px] text-faint px-4 pt-1.5";
+export const FOOT = "text-meta text-faint px-4 pt-1.5";
export const PILL_ACCENT =
- "text-[12.5px] font-medium px-3 py-1.5 rounded-full bg-accent text-white shrink-0 disabled:opacity-50";
+ "text-meta font-medium px-3 py-1.5 rounded-full bg-accent text-white shrink-0 disabled:opacity-50";
export const PILL_QUIET =
- "text-[12.5px] font-medium px-3 py-1.5 rounded-full bg-paper border border-line text-accent shrink-0 hover:border-lineStrong";
+ "text-meta font-medium px-3 py-1.5 rounded-full bg-paper border border-line text-accent shrink-0 hover:border-lineStrong";
export const PILL_LINE =
- "text-[12.5px] font-medium px-3 py-1.5 rounded-full border border-lineStrong text-ink shrink-0 hover:bg-paper";
+ "text-meta font-medium px-3 py-1.5 rounded-full border border-lineStrong text-ink shrink-0 hover:bg-paper";
export const TAG_ACCENT =
"text-[10.5px] font-semibold px-1.5 py-0.5 rounded bg-accentSoft text-accent shrink-0";
@@ -30,13 +30,13 @@ export const TAG_QUIET =
/** Status chip variants for the Connected list. */
export const CHIP_OK =
- "text-[11px] font-medium px-2 py-0.5 rounded-full bg-okSoft text-ok border border-okLine shrink-0";
+ "text-label font-medium px-2 py-0.5 rounded-full bg-okSoft text-ok border border-okLine shrink-0";
export const CHIP_WARN =
- "text-[11px] font-medium px-2 py-0.5 rounded-full bg-warnSoft text-warnInk border border-warnInk/20 shrink-0";
+ "text-label font-medium px-2 py-0.5 rounded-full bg-warnSoft text-warnInk border border-warnInk/20 shrink-0";
export const CHIP_OFF =
- "text-[11px] font-medium px-2 py-0.5 rounded-full bg-paper text-muted border border-lineStrong shrink-0";
+ "text-label font-medium px-2 py-0.5 rounded-full bg-paper text-muted border border-lineStrong shrink-0";
export const CHIP_ERR =
- "text-[11px] font-medium px-2 py-0.5 rounded-full bg-danger/10 text-danger border border-danger/25 shrink-0";
+ "text-label font-medium px-2 py-0.5 rounded-full bg-danger/10 text-danger border border-danger/25 shrink-0";
/** Small × affordance (danger on hover). */
export const XBTN = "text-faint hover:text-danger shrink-0 leading-none";
diff --git a/surfaces/gui/src/providers/ProviderSetup.tsx b/surfaces/gui/src/providers/ProviderSetup.tsx
index 1f7559c9..ae45b779 100644
--- a/surfaces/gui/src/providers/ProviderSetup.tsx
+++ b/surfaces/gui/src/providers/ProviderSetup.tsx
@@ -22,14 +22,14 @@ import { PROVIDER_LOGOS, providerRank } from "./logos";
// and passes a testid prefix so both stay independently addressable in e2e.
// Where a non-developer gets an API key — deep link + one line of instructions.
-export const KEY_HELP: Record<string, { url: string; label: string }> = {
+export const KEY_HELP: Record<string, { url: string; label: string; labelKey?: string }> = {
anthropic: { url: "https://console.anthropic.com/settings/keys", label: "console.anthropic.com" },
openai: { url: "https://platform.openai.com/api-keys", label: "platform.openai.com" },
gemini: { url: "https://aistudio.google.com/apikey", label: "aistudio.google.com" },
ark: { url: "https://console.byteplus.com/ark/region:ark+ap-southeast-1/apiKey", label: "console.byteplus.com" },
"ark-agent-plan-cn": { url: "https://console.volcengine.com/ark/region:cn-beijing/openManagement?LLM=%7B%7D&advancedActiveKey=agentPlan", label: "console.volcengine.com" },
openrouter: { url: "https://openrouter.ai/keys", label: "openrouter.ai" },
- bedrock: { url: "https://console.aws.amazon.com/bedrock/home#/api-keys", label: "the AWS Bedrock console" },
+ bedrock: { url: "https://console.aws.amazon.com/bedrock/home#/api-keys", label: "the AWS Bedrock console", labelKey: "misc.provider.bedrock_console" },
fireworks: { url: "https://fireworks.ai/account/api-keys", label: "fireworks.ai" },
together: { url: "https://api.together.xyz/settings/api-keys", label: "together.xyz" },
zai: { url: "https://z.ai/manage-apikey/apikey-list", label: "z.ai" },
@@ -54,7 +54,7 @@ export function ProviderMark({ name, title, size = 32 }: { name: string; title:
{url ? (
<img src={url} alt="" style={{ width: size * 0.6, height: size * 0.6 }} />
) : (
- <span className="text-[13px] font-semibold text-muted">{title[0]}</span>
+ <span className="text-ui font-semibold text-muted">{title[0]}</span>
)}
</span>
);
@@ -228,24 +228,24 @@ export function useProviderSetup(opts?: { onSaved?: () => void }): ProviderSetup
// The card keeps just the state — the account email truncated badly at card
// width (owner-hit 2026-08-21); the detail pane shows who is signed in.
if (p.signed_in)
- return <span className="block text-[12px] text-ok font-medium truncate">{t("provider.signed_in")}</span>;
- return <span className="block text-[12px] text-faint truncate">{t("provider.sign_in_with_plan")}</span>;
+ return <span className="block text-meta text-ok font-medium truncate">{t("provider.signed_in")}</span>;
+ return <span className="block text-meta text-faint truncate">{t("provider.sign_in_with_plan")}</span>;
}
if (p.configured && p.needs_key) {
const used = o?.lastUsed ? relTime(p.last_used_at, t) : null;
return (
- <span className="block text-[12px] text-ok font-medium truncate">
+ <span className="block text-meta text-ok font-medium truncate">
{t("provider.connected_ok")}{used ? <span className="text-muted font-normal">{t("provider.used_suffix", { time: used })}</span> : ""}
</span>
);
}
if (!p.needs_key)
return (
- <span className="block text-[12px] text-faint truncate">
+ <span className="block text-meta text-faint truncate">
{keylessOk.has(p.name) ? <span className="text-ok font-medium">{t("provider.running")}</span> : t("provider.no_key_needed")}
</span>
);
- return <span className="block text-[12px] text-faint truncate">{t("provider.not_set_up")}</span>;
+ return <span className="block text-meta text-faint truncate">{t("provider.not_set_up")}</span>;
};
return {
@@ -338,11 +338,11 @@ function OAuthSignIn({ info, tp, onChanged }: { info: ProviderInfo; tp: string;
return (
<div className="mt-4">
<div className="flex items-center gap-2.5 rounded-xl border border-okLine bg-okSoft px-3 py-2.5">
- <span className="text-[13px] text-ink min-w-0 flex-1 truncate" data-testid={`${tp}-oauth-account`}>
+ <span className="text-ui text-ink min-w-0 flex-1 truncate" data-testid={`${tp}-oauth-account`}>
{info.account ? t("provider.signed_in_as", { account: info.account }) : t("provider.signed_in")}
</span>
<button
- className="shrink-0 rounded-lg border border-line bg-panel px-3 py-1.5 text-[13px] text-ink hover:border-lineStrong"
+ className="shrink-0 rounded-lg border border-line bg-panel px-3 py-1.5 text-ui text-ink hover:border-lineStrong"
data-testid={`${tp}-oauth-signout`}
onClick={async () => {
await codexSignout().catch(() => {});
@@ -352,7 +352,7 @@ function OAuthSignIn({ info, tp, onChanged }: { info: ProviderInfo; tp: string;
{t("provider.sign_out")}
</button>
</div>
- <p className="text-[12px] text-faint mt-2">
+ <p className="text-meta text-faint mt-2">
{t("provider.oauth_plan_note")}
</p>
</div>
@@ -361,7 +361,7 @@ function OAuthSignIn({ info, tp, onChanged }: { info: ProviderInfo; tp: string;
return (
<div className="mt-4">
<button
- className="rounded-lg border border-accent bg-accent px-4 py-2 text-[13px] font-medium text-white hover:brightness-105 disabled:opacity-40"
+ className="rounded-lg border border-accent bg-accent px-4 py-2 text-ui font-medium text-white hover:brightness-105 disabled:opacity-40"
onClick={() => void start()}
disabled={busy}
data-testid={`${tp}-oauth-signin`}
@@ -369,7 +369,7 @@ function OAuthSignIn({ info, tp, onChanged }: { info: ProviderInfo; tp: string;
{busy ? t("provider.oauth_waiting") : t("provider.sign_in_chatgpt")}
</button>
{busy && (
- <p className="text-[12px] text-faint mt-2">
+ <p className="text-meta text-faint mt-2">
{t("provider.oauth_finish_browser")}
{reopenUrl && (
<>
@@ -384,7 +384,7 @@ function OAuthSignIn({ info, tp, onChanged }: { info: ProviderInfo; tp: string;
)}
</p>
)}
- <div className="mt-2 min-h-[19px] text-[13px]">
+ <div className="mt-2 min-h-[19px] text-ui">
{error && <span className="text-warnInk">{error}</span>}
</div>
</div>
@@ -415,10 +415,10 @@ export function ProviderCards({
>
<ProviderMark name={p.name} title={p.title} />
<span className="min-w-0 flex-1">
- <span className="block text-[13px] font-semibold leading-tight truncate">{p.title}</span>
+ <span className="block text-ui font-semibold leading-tight truncate">{p.title}</span>
{ps.statusFor(p, { lastUsed })}
</span>
- <span className="text-faint text-[14px]">›</span>
+ <span className="text-faint text-body">›</span>
</button>
))}
</div>
@@ -439,9 +439,9 @@ export function ProviderForm({
}) {
const { t } = useTranslation();
const { info, sel } = ps;
- const label = "block text-[12px] text-muted mt-3 mb-1";
+ const label = "block text-meta text-muted mt-3 mb-1";
const input =
- "w-full px-3 py-2 rounded-lg border bg-panel text-[13px] outline-none focus:border-accent";
+ "w-full px-3 py-2 rounded-lg border bg-panel text-ui outline-none focus:border-accent";
const fieldsAll = info?.fields || [];
const keyed = fieldsAll.some((x) => x.secret);
// Cloud providers declare a segmented auth-method choice; the selected method's
@@ -478,7 +478,7 @@ export function ProviderForm({
/>
{ps.fieldSaved === f.key && (
<span
- className="absolute right-2 top-1/2 -translate-y-1/2 text-[11px] font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
+ className="absolute right-2 top-1/2 -translate-y-1/2 text-label font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
data-testid={`${tp}-field-saved-${f.key}`}
>
{t("provider.saved_pill")}
@@ -487,7 +487,7 @@ export function ProviderForm({
{/* §39: state lives IN the field — no status lines below. */}
{ps.savedState && testable && (
<span
- className="absolute right-2 top-1/2 -translate-y-1/2 text-[11px] font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
+ className="absolute right-2 top-1/2 -translate-y-1/2 text-label font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
data-testid={`${tp}-saved-pill`}
>
{info?.needs_key ? t("provider.tested_saved_pill") : t("provider.detected_pill")}
@@ -496,7 +496,7 @@ export function ProviderForm({
</div>
{testable && (
<button
- className="px-4 rounded-lg border border-line text-[13px] font-medium text-ink hover:border-lineStrong shrink-0 disabled:opacity-40"
+ className="px-4 rounded-lg border border-line text-ui font-medium text-ink hover:border-lineStrong shrink-0 disabled:opacity-40"
onClick={() => ps.runTestAndSave()}
disabled={ps.verify.state === "testing" || (!ps.secretFilled && !ps.credentialed)}
data-testid={`${tp}-test`}
@@ -505,23 +505,23 @@ export function ProviderForm({
</button>
)}
</div>
- {f.help && <p className="text-[12px] text-faint mt-1">{f.help}</p>}
+ {f.help && <p className="text-meta text-faint mt-1">{f.help}</p>}
</div>
);
return (
<div>
- <button className="text-[13px] text-muted hover:text-ink" onClick={ps.backToGallery} data-testid={`${tp}-back`}>
+ <button className="text-ui text-muted hover:text-ink" onClick={ps.backToGallery} data-testid={`${tp}-back`}>
{t("provider.all_providers")}
</button>
<div className="flex items-center gap-3 mt-3 mb-1">
<ProviderMark name={info?.name || ""} title={info?.title || ""} size={36} />
<span className="min-w-0">
- <span className="block text-[14px] font-semibold leading-tight">{info?.title}</span>
+ <span className="block text-body font-semibold leading-tight">{info?.title}</span>
{info ? ps.statusFor(info) : null}
</span>
</div>
- {info?.blurb && <p className="text-[12px] text-faint mt-1">{info.blurb}</p>}
+ {info?.blurb && <p className="text-meta text-faint mt-1">{info.blurb}</p>}
{info?.auth === "oauth" && <OAuthSignIn info={info} tp={tp} onChanged={ps.refreshProviders} />}
@@ -553,7 +553,7 @@ export function ProviderForm({
role="radio"
aria-checked={active}
className={
- "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-[13px] whitespace-nowrap transition-colors " +
+ "flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-ui whitespace-nowrap transition-colors " +
(active
? "bg-panel text-ink font-medium shadow-sm ring-1 ring-line"
: "text-muted hover:text-ink")
@@ -563,7 +563,7 @@ export function ProviderForm({
>
{c.label}
{c.tag && (
- <span className="text-[9.5px] font-semibold uppercase tracking-wide text-accent bg-accentSoft rounded-full px-1.5 py-px">
+ <span className="text-[9.5px] font-medium text-accent bg-accentSoft rounded-full px-1.5 py-px">
{c.tag}
</span>
)}
@@ -573,29 +573,29 @@ export function ProviderForm({
</div>
<div className="mt-2.5 rounded-xl border border-line bg-paper/60 px-4 pb-3.5 pt-3">
- {selected?.desc && <p className="text-[12px] text-muted">{selected.desc}</p>}
+ {selected?.desc && <p className="text-meta text-muted">{selected.desc}</p>}
{selected?.command && (
<button
- className="mt-2.5 inline-flex items-center gap-2 rounded-lg border border-line bg-panel px-2.5 py-1.5 text-[12px] font-mono text-ink hover:border-lineStrong"
+ className="mt-2.5 inline-flex items-center gap-2 rounded-lg border border-line bg-panel px-2.5 py-1.5 text-meta font-mono text-ink hover:border-lineStrong"
onClick={() => void navigator.clipboard?.writeText(selected.command || "")}
title={t("provider.copy_command")}
data-testid={`${tp}-cmd-copy`}
>
{selected.command}
- <span className="font-sans text-[11px] text-faint">⧉</span>
+ <span className="font-sans text-label text-faint">⧉</span>
</button>
)}
{methodFields.map((f) => fieldRow(f, false))}
<div className="mt-3.5 flex items-center justify-between gap-3 border-t border-line pt-3">
{ps.savedState ? (
- <span className="text-[12px] font-medium text-ok" data-testid={`${tp}-saved-pill`}>
+ <span className="text-meta font-medium text-ok" data-testid={`${tp}-saved-pill`}>
{t("provider.tested_saved_pill")}
</span>
) : (
- <span className="text-[12px] text-faint">{t("provider.test_save_hint")}</span>
+ <span className="text-meta text-faint">{t("provider.test_save_hint")}</span>
)}
<button
- className="shrink-0 rounded-lg border border-accent bg-accent px-4 py-1.5 text-[13px] font-medium text-white hover:brightness-105 disabled:opacity-40"
+ className="shrink-0 rounded-lg border border-accent bg-accent px-4 py-1.5 text-ui font-medium text-white hover:brightness-105 disabled:opacity-40"
onClick={() => ps.runTestAndSave()}
disabled={ps.verify.state === "testing"}
data-testid={`${tp}-test`}
@@ -608,19 +608,19 @@ export function ProviderForm({
)}
{info?.needs_key && KEY_HELP[sel] && (
- <p className="text-[12px] text-faint mt-2">
+ <p className="text-meta text-faint mt-2">
{t("provider.no_key_yet")}{" "}
<button
className="text-muted underline decoration-line underline-offset-2 hover:text-ink"
onClick={() => openExternal(KEY_HELP[sel].url)}
>
- {t("provider.create_key_at", { label: KEY_HELP[sel].label })} ↗
+ {t("provider.create_key_at", { label: KEY_HELP[sel].labelKey ? t(KEY_HELP[sel].labelKey) : KEY_HELP[sel].label })} ↗
</button>{" "}
{t("provider.takes_a_minute")}
</p>
)}
{info && !info.needs_key && info.auth !== "oauth" && (
- <p className="text-[12px] text-faint mt-2">
+ <p className="text-meta text-faint mt-2">
{t("provider.no_key_needed_desc")}{" "}
<button
className="text-muted underline decoration-line underline-offset-2 hover:text-ink"
@@ -641,7 +641,7 @@ export function ProviderForm({
if (!ps.showEndpoint)
return (
<button
- className="block self-start text-[13px] text-muted hover:text-ink mt-4"
+ className="block self-start text-ui text-muted hover:text-ink mt-4"
onClick={() => ps.setShowEndpoint(true)}
data-testid={`${tp}-endpoint-link`}
>
@@ -663,20 +663,20 @@ export function ProviderForm({
/>
{ps.fieldSaved === ep.key && (
<span
- className="absolute right-2 top-1/2 -translate-y-1/2 text-[11px] font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
+ className="absolute right-2 top-1/2 -translate-y-1/2 text-label font-medium text-ok bg-okSoft rounded-full px-2 py-0.5 pointer-events-none"
data-testid={`${tp}-field-saved-${ep.key}`}
>
{t("provider.saved_pill")}
</span>
)}
</div>
- {ep.help && <p className="text-[12px] text-faint mt-1">{ep.help}</p>}
+ {ep.help && <p className="text-meta text-faint mt-1">{ep.help}</p>}
</div>
);
})()}
{/* Error line: fixed height so failures never reflow the form. */}
- <div className="mt-3 min-h-[19px] text-[13px]">
+ <div className="mt-3 min-h-[19px] text-ui">
{ps.verify.state === "error" && <span className="text-warnInk">{ps.verify.msg}</span>}
</div>
{info?.auth === "oauth" ? null : footer}