Skip to content

Your lightweight open-source personal agent.

feat(linear): make member access settings responsive and familiar

Xubin Renb410ead0c768
diff --git a/docs/guides/linear-agent.md b/docs/guides/linear-agent.md
index 805c73c97..a0e8b5ab0 100644
--- a/docs/guides/linear-agent.md
+++ b/docs/guides/linear-agent.md
@@ -233,15 +233,22 @@ refreshes each workspace installation separately.
Before inviting teammates, open **Member access** under the authorized workspace
in **Settings → Channels → Linear**. Search for a member and switch on **Allow
-… to use nanobot**. Wait for **Member access saved.** They can then mention the
+… to use nanobot**. Wait for **Saved** beside that member. They can then mention the
agent without copying a pairing code or authorizing another OAuth installation.
The list contains active human members of teams this app can access. It does not
grant access to additional Linear teams or to the nanobot admin UI. Names are for
display; permissions use stable user IDs scoped to the OAuth client and workspace.
Use **Refresh members** to refresh the directory and effective permission state.
-If a read or save fails, the UI reports the failure and requires a refresh before
-another edit; it does not pretend a switch was saved.
+The UI prefetches on hover or keyboard focus and keeps visited lists in memory,
+scoped to this gateway, admin login, app configuration and workspace. Lists older
+than one minute stay visible while refreshing. This display cache is not used to
+authorize agent requests.
+
+Each switch changes only after the server confirms the save; other members remain
+editable while it saves. A failed save may have an uncertain outcome (for example,
+after a timeout), so refresh before editing that member again. Failed refreshes keep
+the last confirmed list visible and show an error, rather than an empty directory.
New members are off by default. Existing pairing approvals and **Advanced →
Allowed Linear users** remain valid until explicitly overridden by a member
diff --git a/nanobot/channels/linear/webui/LinearMemberAccess.tsx b/nanobot/channels/linear/webui/LinearMemberAccess.tsx
index 63f8800ae..50a91614d 100644
--- a/nanobot/channels/linear/webui/LinearMemberAccess.tsx
+++ b/nanobot/channels/linear/webui/LinearMemberAccess.tsx
@@ -1,142 +1,138 @@
-import { useEffect, useId, useRef, useState } from "react";
-import { Check, ChevronDown, Loader2, RefreshCw } from "lucide-react";
+import { useEffect, useId, useState, useSyncExternalStore } from "react";
+import { Check, ChevronDown, Info, RefreshCw, Search } from "lucide-react";
import { useTranslation } from "react-i18next";
import { channelTranslator } from "@/channel-plugins/i18n";
import { ToggleButton } from "@/components/settings/ToggleButton";
+import { SETTINGS_SEARCH_INPUT_CLASS, SettingsGroup, SettingsRow } from "@/components/settings/shared/SettingsControls";
+import { SettingsHint } from "@/components/settings/shared/SettingsHint";
import { Button } from "@/components/ui/button";
+import { DisclosureContent } from "@/components/ui/disclosure";
import { Input } from "@/components/ui/input";
import { cn } from "@/lib/utils";
import { useClient } from "@/providers/ClientProvider";
-import { manageLinearMembers } from "./api";
-import type { LinearMember } from "./types";
+import { linearMemberAccessStore } from "./member-access-store";
-export function LinearMemberAccess({ organizationId, disabled = false }: {
+export function LinearMemberAccess({ organizationId, configScope = "", disabled = false }: {
organizationId: string;
+ configScope?: string;
disabled?: boolean;
}) {
- const { client } = useClient();
+ const { client, token } = useClient();
const { t } = useTranslation();
const tx = channelTranslator(t, "linear");
const panelId = useId();
const [expanded, setExpanded] = useState(false);
- const [members, setMembers] = useState<LinearMember[]>([]);
const [search, setSearch] = useState("");
- const [busy, setBusy] = useState(false);
- const [savingId, setSavingId] = useState<string | null>(null);
- const [error, setError] = useState<string | null>(null);
- const [saved, setSaved] = useState(false);
- const [allowAll, setAllowAll] = useState(false);
- const generation = useRef(0);
- useEffect(() => () => { generation.current += 1; }, [organizationId]);
+ const store = linearMemberAccessStore(client, token, configScope, organizationId);
+ const { payload, loading, error, saves } = useSyncExternalStore(store.subscribe, store.getSnapshot);
+ const members = payload?.members ?? [];
+ const saving = Object.values(saves).some((save) => save.status === "saving");
- const refresh = async () => {
- const request = ++generation.current;
- setBusy(true);
- setError(null);
- setSaved(false);
- try {
- const payload = await manageLinearMembers(client, { operation: "members", organization_id: organizationId });
- if (request !== generation.current) return;
- setMembers(payload.members);
- setAllowAll(payload.legacy_allow_all);
- } catch (err) {
- if (request === generation.current) setError((err as Error).message);
- } finally {
- if (request === generation.current) setBusy(false);
- }
- };
-
- const setAllowed = async (member: LinearMember, allowed: boolean) => {
- const request = ++generation.current;
- setBusy(true);
- setSavingId(member.id);
- setError(null);
- setSaved(false);
- try {
- const payload = await manageLinearMembers(client, {
- operation: "member_access", organization_id: organizationId, user_id: member.id, allowed,
- });
- if (request !== generation.current) return;
- const updated = payload.members.find((item) => item.id === member.id);
- if (!updated || updated.allowed !== allowed) throw new Error(tx("members.saveUnconfirmed", "Access was not confirmed. Refresh members before trying again."));
- setMembers((current) => current.map((item) => item.id === member.id ? updated : item));
- setAllowAll(payload.legacy_allow_all);
- setSaved(true);
- } catch (err) {
- if (request === generation.current) setError((err as Error).message);
- } finally {
- if (request === generation.current) {
- setBusy(false);
- setSavingId(null);
- }
- }
- };
+ useEffect(() => {
+ if (expanded && !disabled) void store.load();
+ }, [store, expanded, disabled]);
+ const prefetch = () => { if (!disabled) void store.load(); };
const needle = search.trim().toLocaleLowerCase();
const visible = members.filter((member) => [member.name, member.id, ...member.teams]
.some((value) => value.toLocaleLowerCase().includes(needle)));
+ const names = new Set<string>();
+ const duplicateNames = new Set<string>();
+ for (const member of members) {
+ if (names.has(member.name)) duplicateNames.add(member.name);
+ names.add(member.name);
+ }
return (
- <section className="w-full border-t border-border/50 pt-2">
+ <section className="w-full border-t border-border/50 pt-1">
<button type="button" aria-expanded={expanded} aria-controls={panelId}
- disabled={disabled || busy}
- className="flex min-h-10 w-full items-center justify-between gap-2 text-start text-[12px] font-medium disabled:opacity-50"
- onClick={() => {
- setExpanded(!expanded);
- if (!expanded) void refresh();
- }}>
- {tx("members.title", "Member access")}
- <ChevronDown className={cn("h-4 w-4", expanded && "rotate-180")} aria-hidden />
+ disabled={disabled} onMouseEnter={prefetch} onFocus={prefetch}
+ className="settings-list-inset flex min-h-12 w-full items-center justify-between gap-3 rounded-xl text-start text-[13px] font-medium settings-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50"
+ onClick={() => setExpanded(!expanded)}>
+ <span>{tx("members.title", "Member access")}</span>
+ <span className="flex items-center gap-2">
+ <span role="status" aria-live="polite" className="text-[12px] font-normal text-muted-foreground">
+ {loading ? payload
+ ? tx("members.refreshing", "Checking for updates…")
+ : tx("members.loading", "Finding your teammates…")
+ : payload ? tx("members.summary", "{{allowed}} of {{total}} enabled", {
+ allowed: members.filter((member) => member.allowed).length, total: members.length,
+ }) : null}
+ </span>
+ <ChevronDown className={cn("h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200 motion-reduce:transition-none", expanded && "rotate-180")} aria-hidden />
+ </span>
</button>
- {expanded ? (
- <div id={panelId} className="space-y-3 pb-1">
- <p className="text-[12px] leading-5 text-muted-foreground">
- {tx("members.help", "Choose who can use nanobot in Linear without a pairing code. This does not grant access to the nanobot admin UI. Turning access off blocks new requests, not tasks already running.")}
- </p>
- {allowAll ? <p className="rounded-control bg-muted p-2 text-[12px] leading-5">
- {tx("members.allowAll", "Advanced settings currently allow all members (*), including new members. Individual off switches still take precedence. Remove * to require approval for new members.")}
- </p> : null}
- <div className="flex items-center gap-2">
+ <DisclosureContent id={panelId} open={expanded} className="space-y-3 pb-2">
+ <div className="settings-list-inset flex items-center gap-2 text-[12px] leading-5 text-muted-foreground">
+ <p>{tx("members.intro", "Choose who can use nanobot in Linear. No pairing codes needed.")}</p>
+ <SettingsHint description={tx("members.help", "Choose who can use nanobot in Linear without a pairing code. This does not grant access to the nanobot admin UI. Turning access off blocks new requests, not tasks already running.")}>
+ <Info className="h-4 w-4 shrink-0" aria-hidden />
+ <span className="sr-only">{tx("members.details", "About member access")}</span>
+ </SettingsHint>
+ </div>
+ {payload?.legacy_allow_all ? <p className="settings-list-inset rounded-control bg-muted py-2 text-[12px] leading-5">
+ {tx("members.allowAll", "Advanced settings currently allow all members (*), including new members. Individual off switches still take precedence. Remove * to require approval for new members.")}
+ </p> : null}
+ <div className="settings-list-inset flex items-center gap-2">
+ <div className="relative min-w-0 flex-1">
+ <Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" aria-hidden />
<Input value={search} onChange={(event) => setSearch(event.target.value)}
aria-label={tx("members.search", "Search members")}
- placeholder={tx("members.search", "Search members")} className="min-w-0 text-[12px]" />
- <Button type="button" variant="ghost" size="sm" disabled={disabled || busy}
- onClick={() => void refresh()} aria-label={tx("members.refresh", "Refresh members")}>
- <RefreshCw className={cn("h-4 w-4", busy && !savingId && "animate-spin motion-reduce:animate-none")} aria-hidden />
- </Button>
- </div>
- <div role="status" aria-live="polite" className="text-[12px] text-muted-foreground">
- {busy ? tx("members.working", "Updating member access…") : saved ? <span className="inline-flex items-center gap-1">
- <Check className="h-3 w-3" aria-hidden />{tx("members.saved", "Member access saved.")}
- </span> : null}
+ placeholder={tx("members.search", "Search members")}
+ className={cn(SETTINGS_SEARCH_INPUT_CLASS, "pl-9 text-[13px]")} />
</div>
- {error ? <p role="alert" className="text-[12px] leading-5 text-destructive">
- {error} {tx("members.retry", "Refresh members to check the current state and try again.")}
- </p> : null}
- {!busy && !error && visible.length === 0 ? <p className="text-[12px] text-muted-foreground">
- {tx("members.empty", "No matching active members in the teams this app can access.")}
- </p> : null}
- <ul className="max-h-72 space-y-1 overflow-y-auto">
- {visible.map((member) => <li key={member.id} className="flex min-h-14 items-center gap-3 rounded-control px-2 py-2">
- <span aria-hidden className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium">
- {member.name.slice(0, 2).toLocaleUpperCase()}
- </span>
- <div className="min-w-0 flex-1">
- <p className="truncate text-[12.5px] font-medium" title={member.id}>{member.name}</p>
- <p className="truncate text-[11px] text-muted-foreground">{member.teams.join(" · ")}</p>
- {members.some((other) => other.id !== member.id && other.name === member.name) ?
- <p className="truncate text-[10px] text-muted-foreground">{member.id}</p> : null}
- </div>
- {savingId === member.id ? <Loader2 className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none" aria-hidden /> : null}
- <ToggleButton checked={member.allowed} disabled={disabled || busy || Boolean(error)}
- label={tx("members.allow", "Allow {{name}} to use nanobot", { name: member.name })}
- onChange={(allowed) => void setAllowed(member, allowed)} />
- </li>)}
- </ul>
+ <Button type="button" variant="ghost" size="icon" disabled={disabled || loading || saving}
+ onClick={() => void store.load(true)} aria-label={tx("members.refresh", "Refresh members")}
+ title={tx("members.refresh", "Refresh members")}>
+ <RefreshCw className="h-4 w-4 text-muted-foreground" aria-hidden />
+ </Button>
</div>
- ) : null}
+ {error ? <p role="alert" className="settings-list-inset break-words text-[12px] leading-5 text-destructive">
+ {error} {tx("members.retry", "Refresh members to check the current state and try again.")}
+ </p> : null}
+ {payload && !error && visible.length === 0 ? <p className="settings-list-inset py-3 text-[12px] text-muted-foreground">
+ {tx("members.empty", "No matching active members in the teams this app can access.")}
+ </p> : null}
+ <SettingsGroup>
+ <ul className="max-h-80 overflow-y-auto" aria-label={tx("members.title", "Member access")}>
+ {visible.map((member) => {
+ const save = saves[member.id];
+ const statusId = `${panelId}-${member.id}-status`;
+ return <li key={member.id}>
+ <SettingsRow title={<div className="flex min-w-0 items-center gap-3">
+ <span aria-hidden className="flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground">
+ {member.name.slice(0, 2).toLocaleUpperCase()}
+ </span>
+ <div className="min-w-0">
+ <p className="truncate" title={member.id}>{member.name}</p>
+ <div className="flex flex-wrap items-center gap-x-2 text-[12px] font-normal text-muted-foreground">
+ <span className="truncate">{member.teams.join(" · ")}</span>
+ <span id={save?.status === "error" ? undefined : statusId} role="status" aria-live="polite" className="inline-flex items-center gap-1">
+ {save?.status === "saving" ? tx("members.working", "Saving…") : null}
+ {save?.status === "saved" ? <><Check className="h-3 w-3" aria-hidden />{tx("members.saved", "Saved")}</> : null}
+ </span>
+ </div>
+ {duplicateNames.has(member.name) ?
+ <p className="break-all text-[11px] font-normal text-muted-foreground">{member.id}</p> : null}
+ </div>
+ </div>}>
+ <ToggleButton checked={member.allowed}
+ disabled={disabled || save?.status === "saving" || save?.status === "error"}
+ aria-describedby={save ? statusId : undefined} aria-invalid={save?.status === "error" || undefined}
+ label={tx("members.allow", "Allow {{name}} to use nanobot", { name: member.name })}
+ onChange={(allowed) => void store.setAllowed(member.id, allowed,
+ tx("members.saveUnconfirmed", "Access was not confirmed. Refresh members before trying again."))} />
+ </SettingsRow>
+ {save?.status === "error" ? <p id={statusId} role="alert" className="settings-list-inset break-words pb-3 text-[12px] leading-5 text-destructive">
+ {save.message} {tx("members.retry", "Refresh members to check the current state and try again.")}
+ </p> : null}
+ </li>;
+ })}
+ </ul>
+ </SettingsGroup>
+ </DisclosureContent>
</section>
);
}
diff --git a/nanobot/channels/linear/webui/LinearPanel.tsx b/nanobot/channels/linear/webui/LinearPanel.tsx
index 173340f6d..b7aad8aae 100644
--- a/nanobot/channels/linear/webui/LinearPanel.tsx
+++ b/nanobot/channels/linear/webui/LinearPanel.tsx
@@ -369,6 +369,10 @@ export function LinearPanel({
</Button>
</div>
<LinearMemberAccess organizationId={installation.organization_id}
+ configScope={JSON.stringify([
+ feature.config_values?.["channels.linear.clientId"],
+ feature.config_values?.["channels.linear.allowFrom"],
+ ])}
disabled={busy || dirty || connecting || loadingInstallations || disconnectingId !== null} />
</article>
);
diff --git a/nanobot/channels/linear/webui/locales/en.json b/nanobot/channels/linear/webui/locales/en.json
index 9fb8da9e9..2076b1f6d 100644
--- a/nanobot/channels/linear/webui/locales/en.json
+++ b/nanobot/channels/linear/webui/locales/en.json
@@ -96,12 +96,17 @@
"allowAll": "Advanced settings currently allow all members (*), including new members. Individual off switches still take precedence. Remove * to require approval for new members.",
"search": "Search members",
"refresh": "Refresh members",
- "working": "Updating member access…",
- "saved": "Member access saved.",
+ "working": "Saving…",
+ "saved": "Saved",
"retry": "Refresh members to check the current state and try again.",
"empty": "No matching active members in the teams this app can access.",
"allow": "Allow {{name}} to use nanobot",
"saveUnconfirmed": "Access was not confirmed. Refresh members before trying again.",
- "guide": "Use Member access to approve teammates without pairing codes. Existing approvals still work unless switched off. Connect Linear MCP to search or edit issues."
+ "guide": "Use Member access to approve teammates without pairing codes. Existing approvals still work unless switched off. Connect Linear MCP to search or edit issues.",
+ "intro": "Choose who can use nanobot in Linear. No pairing codes needed.",
+ "details": "About member access",
+ "summary": "{{allowed}} of {{total}} enabled",
+ "loading": "Finding your teammates…",
+ "refreshing": "Checking for updates…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/es.json b/nanobot/channels/linear/webui/locales/es.json
index 3bdda1a12..dc371b584 100644
--- a/nanobot/channels/linear/webui/locales/es.json
+++ b/nanobot/channels/linear/webui/locales/es.json
@@ -96,12 +96,17 @@
"allowAll": "La configuración avanzada permite a todos los miembros (*), incluidos los nuevos. Los interruptores desactivados tienen prioridad. Elimina * para exigir aprobación a los nuevos miembros.",
"search": "Buscar miembros",
"refresh": "Actualizar miembros",
- "working": "Actualizando acceso…",
- "saved": "Acceso guardado.",
+ "working": "Guardando…",
+ "saved": "Guardado",
"retry": "Actualiza los miembros para comprobar el estado actual y vuelve a intentarlo.",
"empty": "No hay miembros activos coincidentes en los equipos accesibles para esta app.",
"allow": "Permitir que {{name}} use nanobot",
"saveUnconfirmed": "No se confirmó el acceso. Actualiza los miembros antes de reintentar.",
- "guide": "Usa Acceso de miembros para aprobar compañeros sin códigos. Las aprobaciones existentes siguen vigentes salvo que se desactiven. Conecta Linear MCP para buscar o editar issues."
+ "guide": "Usa Acceso de miembros para aprobar compañeros sin códigos. Las aprobaciones existentes siguen vigentes salvo que se desactiven. Conecta Linear MCP para buscar o editar issues.",
+ "intro": "Elige quién puede usar nanobot en Linear, sin códigos de vinculación.",
+ "details": "Acerca del acceso de miembros",
+ "summary": "{{allowed}} de {{total}} habilitados",
+ "loading": "Buscando a tus compañeros…",
+ "refreshing": "Buscando actualizaciones…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/fr.json b/nanobot/channels/linear/webui/locales/fr.json
index ecff5d304..381544238 100644
--- a/nanobot/channels/linear/webui/locales/fr.json
+++ b/nanobot/channels/linear/webui/locales/fr.json
@@ -96,12 +96,17 @@
"allowAll": "Les paramètres avancés autorisent tous les membres (*), y compris les nouveaux. Une désactivation individuelle reste prioritaire. Retirez * pour exiger l’approbation des nouveaux membres.",
"search": "Rechercher des membres",
"refresh": "Actualiser les membres",
- "working": "Mise à jour des accès…",
- "saved": "Accès enregistré.",
+ "working": "Enregistrement…",
+ "saved": "Enregistré",
"retry": "Actualisez les membres pour vérifier l’état actuel et réessayez.",
"empty": "Aucun membre actif correspondant dans les équipes accessibles à cette application.",
"allow": "Autoriser {{name}} à utiliser nanobot",
"saveUnconfirmed": "L’accès n’a pas été confirmé. Actualisez les membres avant de réessayer.",
- "guide": "Utilisez Accès des membres pour approuver vos collègues sans code. Les autorisations existantes restent valables sauf désactivation. Connectez Linear MCP pour rechercher ou modifier des issues."
+ "guide": "Utilisez Accès des membres pour approuver vos collègues sans code. Les autorisations existantes restent valables sauf désactivation. Connectez Linear MCP pour rechercher ou modifier des issues.",
+ "intro": "Choisissez qui peut utiliser nanobot dans Linear, sans code d’association.",
+ "details": "À propos de l’accès des membres",
+ "summary": "{{allowed}} sur {{total}} autorisés",
+ "loading": "Recherche des membres de votre équipe…",
+ "refreshing": "Recherche de mises à jour…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/id.json b/nanobot/channels/linear/webui/locales/id.json
index 77a4ade26..730dfbde0 100644
--- a/nanobot/channels/linear/webui/locales/id.json
+++ b/nanobot/channels/linear/webui/locales/id.json
@@ -96,12 +96,17 @@
"allowAll": "Pengaturan lanjutan mengizinkan semua anggota (*), termasuk anggota baru. Penonaktifan per anggota tetap diutamakan. Hapus * agar anggota baru memerlukan persetujuan.",
"search": "Cari anggota",
"refresh": "Segarkan anggota",
- "working": "Memperbarui akses…",
- "saved": "Akses anggota disimpan.",
+ "working": "Menyimpan…",
+ "saved": "Tersimpan",
"retry": "Segarkan anggota untuk memeriksa status terkini, lalu coba lagi.",
"empty": "Tidak ada anggota aktif yang cocok di tim yang dapat diakses aplikasi ini.",
"allow": "Izinkan {{name}} memakai nanobot",
"saveUnconfirmed": "Akses belum dikonfirmasi. Segarkan anggota sebelum mencoba lagi.",
- "guide": "Gunakan Akses anggota untuk menyetujui rekan tanpa kode pairing. Persetujuan lama tetap berlaku kecuali dinonaktifkan. Hubungkan Linear MCP untuk mencari atau mengedit issue."
+ "guide": "Gunakan Akses anggota untuk menyetujui rekan tanpa kode pairing. Persetujuan lama tetap berlaku kecuali dinonaktifkan. Hubungkan Linear MCP untuk mencari atau mengedit issue.",
+ "intro": "Pilih siapa yang boleh memakai nanobot di Linear, tanpa kode pairing.",
+ "details": "Tentang akses anggota",
+ "summary": "{{allowed}} dari {{total}} diizinkan",
+ "loading": "Mencari anggota tim…",
+ "refreshing": "Memeriksa pembaruan…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/ja.json b/nanobot/channels/linear/webui/locales/ja.json
index 526e648b4..83b933294 100644
--- a/nanobot/channels/linear/webui/locales/ja.json
+++ b/nanobot/channels/linear/webui/locales/ja.json
@@ -96,12 +96,17 @@
"allowAll": "詳細設定では新規メンバーを含む全員(*)が許可されています。個別のオフ設定が優先されます。新規メンバーに承認を必須とするには * を削除してください。",
"search": "メンバーを検索",
"refresh": "メンバーを更新",
- "working": "アクセスを更新中…",
- "saved": "アクセス設定を保存しました。",
+ "working": "保存中…",
+ "saved": "保存済み",
"retry": "メンバーを更新して現在の状態を確認し、再試行してください。",
"empty": "アプリがアクセスできるチームに、条件に一致する有効なメンバーはいません。",
"allow": "{{name}} に nanobot の利用を許可",
"saveUnconfirmed": "保存を確認できませんでした。メンバーを更新してから再試行してください。",
- "guide": "「メンバーのアクセス」でコードなしで同僚を承認できます。既存の承認はオフにしない限り有効です。Issue の検索・編集には Linear MCP を接続してください。"
+ "guide": "「メンバーのアクセス」でコードなしで同僚を承認できます。既存の承認はオフにしない限り有効です。Issue の検索・編集には Linear MCP を接続してください。",
+ "intro": "Linear で nanobot を使えるメンバーを選びます。ペアリングコードは不要です。",
+ "details": "メンバーのアクセスについて",
+ "summary": "{{total}} 人中 {{allowed}} 人が有効",
+ "loading": "チームメンバーを取得中…",
+ "refreshing": "更新を確認中…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/ko.json b/nanobot/channels/linear/webui/locales/ko.json
index 1c82b0048..a4683cbfc 100644
--- a/nanobot/channels/linear/webui/locales/ko.json
+++ b/nanobot/channels/linear/webui/locales/ko.json
@@ -96,12 +96,17 @@
"allowAll": "고급 설정에서 신규 멤버를 포함한 모든 멤버(*)를 허용하고 있습니다. 개별 끄기 설정이 우선합니다. 신규 멤버의 승인을 요구하려면 *를 제거하세요.",
"search": "멤버 검색",
"refresh": "멤버 새로고침",
- "working": "접근 권한 업데이트 중…",
- "saved": "멤버 접근 권한을 저장했습니다.",
+ "working": "저장 중…",
+ "saved": "저장됨",
"retry": "멤버를 새로고침하여 현재 상태를 확인한 후 다시 시도하세요.",
"empty": "앱이 접근할 수 있는 팀에 일치하는 활성 멤버가 없습니다.",
"allow": "{{name}}의 nanobot 사용 허용",
"saveUnconfirmed": "권한 저장을 확인하지 못했습니다. 멤버를 새로고침한 후 다시 시도하세요.",
- "guide": "멤버 접근 권한에서 코드 없이 동료를 승인하세요. 기존 승인은 끄지 않는 한 유지됩니다. Issue 검색이나 수정에는 Linear MCP를 연결하세요."
+ "guide": "멤버 접근 권한에서 코드 없이 동료를 승인하세요. 기존 승인은 끄지 않는 한 유지됩니다. Issue 검색이나 수정에는 Linear MCP를 연결하세요.",
+ "intro": "페어링 코드 없이 Linear에서 nanobot을 사용할 멤버를 선택하세요.",
+ "details": "멤버 접근 권한 안내",
+ "summary": "{{total}}명 중 {{allowed}}명 허용",
+ "loading": "팀 멤버를 불러오는 중…",
+ "refreshing": "업데이트 확인 중…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/pt-BR.json b/nanobot/channels/linear/webui/locales/pt-BR.json
index d297ac6df..c8ddb083b 100644
--- a/nanobot/channels/linear/webui/locales/pt-BR.json
+++ b/nanobot/channels/linear/webui/locales/pt-BR.json
@@ -96,12 +96,17 @@
"allowAll": "As configurações avançadas permitem todos os membros (*), inclusive novos. Desativações individuais têm prioridade. Remova * para exigir aprovação de novos membros.",
"search": "Buscar membros",
"refresh": "Atualizar membros",
- "working": "Atualizando acesso…",
- "saved": "Acesso dos membros salvo.",
+ "working": "Salvando…",
+ "saved": "Salvo",
"retry": "Atualize os membros para conferir o estado atual e tente novamente.",
"empty": "Nenhum membro ativo correspondente nas equipes acessíveis ao aplicativo.",
"allow": "Permitir que {{name}} use nanobot",
"saveUnconfirmed": "O acesso não foi confirmado. Atualize os membros antes de tentar novamente.",
- "guide": "Use Acesso de membros para aprovar colegas sem códigos. Aprovações existentes continuam válidas até serem desativadas. Conecte o Linear MCP para buscar ou editar issues."
+ "guide": "Use Acesso de membros para aprovar colegas sem códigos. Aprovações existentes continuam válidas até serem desativadas. Conecte o Linear MCP para buscar ou editar issues.",
+ "intro": "Escolha quem pode usar o nanobot no Linear, sem códigos de pareamento.",
+ "details": "Sobre o acesso de membros",
+ "summary": "{{allowed}} de {{total}} habilitados",
+ "loading": "Buscando membros da equipe…",
+ "refreshing": "Verificando atualizações…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/vi.json b/nanobot/channels/linear/webui/locales/vi.json
index d316f3d9a..8f151510f 100644
--- a/nanobot/channels/linear/webui/locales/vi.json
+++ b/nanobot/channels/linear/webui/locales/vi.json
@@ -96,12 +96,17 @@
"allowAll": "Cài đặt nâng cao đang cho phép mọi thành viên (*), kể cả người mới. Lựa chọn tắt riêng vẫn được ưu tiên. Xóa * để yêu cầu phê duyệt thành viên mới.",
"search": "Tìm thành viên",
"refresh": "Làm mới thành viên",
- "working": "Đang cập nhật quyền…",
- "saved": "Đã lưu quyền truy cập.",
+ "working": "Đang lưu…",
+ "saved": "Đã lưu",
"retry": "Làm mới danh sách để kiểm tra trạng thái hiện tại rồi thử lại.",
"empty": "Không có thành viên đang hoạt động phù hợp trong các nhóm ứng dụng có thể truy cập.",
"allow": "Cho phép {{name}} dùng nanobot",
"saveUnconfirmed": "Chưa xác nhận được quyền. Hãy làm mới danh sách trước khi thử lại.",
- "guide": "Dùng Quyền truy cập của thành viên để phê duyệt đồng nghiệp không cần mã. Phê duyệt cũ vẫn có hiệu lực trừ khi bị tắt. Kết nối Linear MCP để tìm hoặc sửa issue."
+ "guide": "Dùng Quyền truy cập của thành viên để phê duyệt đồng nghiệp không cần mã. Phê duyệt cũ vẫn có hiệu lực trừ khi bị tắt. Kết nối Linear MCP để tìm hoặc sửa issue.",
+ "intro": "Chọn ai có thể dùng nanobot trong Linear mà không cần mã ghép nối.",
+ "details": "Về quyền truy cập của thành viên",
+ "summary": "Đã cho phép {{allowed}} / {{total}} người",
+ "loading": "Đang tìm thành viên nhóm…",
+ "refreshing": "Đang kiểm tra cập nhật…"
}
}
diff --git a/nanobot/channels/linear/webui/locales/zh-CN.json b/nanobot/channels/linear/webui/locales/zh-CN.json
index 78f8f2057..546e80e3f 100644
--- a/nanobot/channels/linear/webui/locales/zh-CN.json
+++ b/nanobot/channels/linear/webui/locales/zh-CN.json
@@ -1 +1 @@
-{"description":"通过 Linear 原生 Agent Session 在 issue 中使用 nanobot。","requirements":"一个私有 Linear OAuth 应用和稳定的公网 HTTPS 回调地址","setup":{"docsLabel":"打开 Linear 配置指南","officialLabel":"创建 Linear OAuth 应用","tryIt":"在 issue 评论中 @ 应用或把 issue 委派给它;进入 Agent Session 后,后续对话无需重复 @。","summary":"创建私有 Linear OAuth 应用,保存凭据和公网地址,再授权工作区。可通过 @ 应用或委派 issue 开启会话,普通评论会被忽略。","steps":["用稳定的 HTTPS 地址暴露此 nanobot 实例(可以使用隧道)。","在 Linear 创建私有 OAuth 应用,启用 read、write、app:mentionable 和 app:assignable。","将应用 webhook 订阅 AgentSessionEvent、PermissionChange 和 OAuthAuthorization,并填写生成的 webhook 地址。","通过 OAuth 连接工作区,然后 @ 应用或把 issue 委派给它。"],"fields":{"clientId":{"label":"OAuth Client ID","placeholder":"Linear OAuth Client ID","help":"从 Linear 私有 OAuth 应用中复制。"},"clientSecret":{"label":"OAuth Client Secret","placeholder":"••••••","help":"只保存在此 nanobot 实例中。"},"webhookSigningSecret":{"label":"Webhook 签名密钥","placeholder":"••••••","help":"在解析 webhook 内容前验证 Linear-Signature。"},"publicBaseUrl":{"label":"公网 HTTPS 地址","placeholder":"https://nanobot.example.com","help":"稳定且能转发到下方监听端口的 HTTPS 源地址,不要包含路径。"},"host":{"label":"监听地址","placeholder":"0.0.0.0"},"port":{"label":"监听端口","placeholder":"3979"},"webhookPath":{"label":"Webhook 路径","placeholder":"/linear/webhook"},"oauthCallbackPath":{"label":"OAuth 回调路径","placeholder":"/linear/oauth/callback"},"allowFrom":{"label":"允许的 Linear 用户","placeholder":"用逗号分隔 Linear 用户 ID","help":"留空使用 nanobot 配对;填写 * 允许已连接工作区内的所有用户。"},"showReasoning":{"label":"显示推理过程","help":"把模型推理作为思考动态发布到 Linear;关闭后会话更简洁。"}}},"custom":{"qrAlt":"Linear 授权二维码","authorizeTitle":"在 Linear 中授权","authorizeDescription":"在当前浏览器打开 Linear 或扫描二维码;授权后 nanobot 会自动启用 channel。","waiting":"正在等待 Linear 授权……","connected":"Linear 已连接。","stopped":"授权已停止。","connecting":"正在连接……","reconnect":"连接另一个工作区","connect":"连接 Linear","openLinear":"前往 Linear","createApp":"创建 Linear 应用","savePublicUrl":"请先填写公网 HTTPS 地址,再创建 Linear 应用。","removeCredentials":"删除已保存的凭据","retrySave":"重试","channelRunning":"Channel 正在运行","accessAll":"已授权工作区中的所有成员都可以运行此 Agent。","accessRestricted":"只有“高级”中列出的 Linear 用户 ID 可以运行此 Agent。","accessPairing":"首次使用需配对,连接 Linear MCP 后可搜索或修改 issue。","configureTools":"配置 Linear MCP","workspacesTitle":"已授权的工作区","refreshWorkspaces":"刷新工作区","loadingWorkspaces":"正在加载工作区","noWorkspaces":"尚未授权工作区。连接工作区后才能接收 Linear Agent 请求。","refreshRequired":"需要刷新授权","missingScopes":"重新连接以授予:{{scopes}}","authorized":"已授权","confirmDisconnect":"断开工作区连接","disconnect":"断开连接"},"members":{"title":"成员访问","help":"选择可以在 Linear 中免配对使用 nanobot 的成员。这不会授予 nanobot 后台管理权限。关闭后会阻止新请求,但不会取消正在运行的任务。","allowAll":"高级设置目前允许所有成员(*),包括新成员。单独关闭的成员仍会被拒绝;若希望新成员须经批准,请移除 *。","search":"搜索成员","refresh":"刷新成员","working":"正在更新成员访问权限……","saved":"成员访问权限已保存。","retry":"请刷新成员列表确认当前状态后重试。","empty":"应用可访问的团队中没有匹配的活跃成员。","allow":"允许 {{name}} 使用 nanobot","saveUnconfirmed":"未能确认权限已保存,请刷新成员列表后重试。","guide":"在「成员访问」中为同事开通免配对使用。已有授权仍然有效,除非手动关闭。连接 Linear MCP 后可搜索或修改 issue。"}}
+{"description":"通过 Linear 原生 Agent Session 在 issue 中使用 nanobot。","requirements":"一个私有 Linear OAuth 应用和稳定的公网 HTTPS 回调地址","setup":{"docsLabel":"打开 Linear 配置指南","officialLabel":"创建 Linear OAuth 应用","tryIt":"在 issue 评论中 @ 应用或把 issue 委派给它;进入 Agent Session 后,后续对话无需重复 @。","summary":"创建私有 Linear OAuth 应用,保存凭据和公网地址,再授权工作区。可通过 @ 应用或委派 issue 开启会话,普通评论会被忽略。","steps":["用稳定的 HTTPS 地址暴露此 nanobot 实例(可以使用隧道)。","在 Linear 创建私有 OAuth 应用,启用 read、write、app:mentionable 和 app:assignable。","将应用 webhook 订阅 AgentSessionEvent、PermissionChange 和 OAuthAuthorization,并填写生成的 webhook 地址。","通过 OAuth 连接工作区,然后 @ 应用或把 issue 委派给它。"],"fields":{"clientId":{"label":"OAuth Client ID","placeholder":"Linear OAuth Client ID","help":"从 Linear 私有 OAuth 应用中复制。"},"clientSecret":{"label":"OAuth Client Secret","placeholder":"••••••","help":"只保存在此 nanobot 实例中。"},"webhookSigningSecret":{"label":"Webhook 签名密钥","placeholder":"••••••","help":"在解析 webhook 内容前验证 Linear-Signature。"},"publicBaseUrl":{"label":"公网 HTTPS 地址","placeholder":"https://nanobot.example.com","help":"稳定且能转发到下方监听端口的 HTTPS 源地址,不要包含路径。"},"host":{"label":"监听地址","placeholder":"0.0.0.0"},"port":{"label":"监听端口","placeholder":"3979"},"webhookPath":{"label":"Webhook 路径","placeholder":"/linear/webhook"},"oauthCallbackPath":{"label":"OAuth 回调路径","placeholder":"/linear/oauth/callback"},"allowFrom":{"label":"允许的 Linear 用户","placeholder":"用逗号分隔 Linear 用户 ID","help":"留空使用 nanobot 配对;填写 * 允许已连接工作区内的所有用户。"},"showReasoning":{"label":"显示推理过程","help":"把模型推理作为思考动态发布到 Linear;关闭后会话更简洁。"}}},"custom":{"qrAlt":"Linear 授权二维码","authorizeTitle":"在 Linear 中授权","authorizeDescription":"在当前浏览器打开 Linear 或扫描二维码;授权后 nanobot 会自动启用 channel。","waiting":"正在等待 Linear 授权……","connected":"Linear 已连接。","stopped":"授权已停止。","connecting":"正在连接……","reconnect":"连接另一个工作区","connect":"连接 Linear","openLinear":"前往 Linear","createApp":"创建 Linear 应用","savePublicUrl":"请先填写公网 HTTPS 地址,再创建 Linear 应用。","removeCredentials":"删除已保存的凭据","retrySave":"重试","channelRunning":"Channel 正在运行","accessAll":"已授权工作区中的所有成员都可以运行此 Agent。","accessRestricted":"只有“高级”中列出的 Linear 用户 ID 可以运行此 Agent。","accessPairing":"首次使用需配对,连接 Linear MCP 后可搜索或修改 issue。","configureTools":"配置 Linear MCP","workspacesTitle":"已授权的工作区","refreshWorkspaces":"刷新工作区","loadingWorkspaces":"正在加载工作区","noWorkspaces":"尚未授权工作区。连接工作区后才能接收 Linear Agent 请求。","refreshRequired":"需要刷新授权","missingScopes":"重新连接以授予:{{scopes}}","authorized":"已授权","confirmDisconnect":"断开工作区连接","disconnect":"断开连接"},"members":{"title":"成员访问","help":"选择可以在 Linear 中免配对使用 nanobot 的成员。这不会授予 nanobot 后台管理权限。关闭后会阻止新请求,但不会取消正在运行的任务。","allowAll":"高级设置目前允许所有成员(*),包括新成员。单独关闭的成员仍会被拒绝;若希望新成员须经批准,请移除 *。","search":"搜索成员","refresh":"刷新成员","working":"保存中…","saved":"已保存","retry":"请刷新成员列表确认当前状态后重试。","empty":"应用可访问的团队中没有匹配的活跃成员。","allow":"允许 {{name}} 使用 nanobot","saveUnconfirmed":"未能确认权限已保存,请刷新成员列表后重试。","guide":"在「成员访问」中为同事开通免配对使用。已有授权仍然有效,除非手动关闭。连接 Linear MCP 后可搜索或修改 issue。","intro":"选择哪些成员可以在 Linear 中使用 nanobot,无需配对码。","details":"关于成员访问权限","summary":"已开启 {{allowed}} / {{total}} 人","loading":"正在获取团队成员…","refreshing":"正在检查更新…"}}
diff --git a/nanobot/channels/linear/webui/locales/zh-TW.json b/nanobot/channels/linear/webui/locales/zh-TW.json
index 3701143da..10edde4c8 100644
--- a/nanobot/channels/linear/webui/locales/zh-TW.json
+++ b/nanobot/channels/linear/webui/locales/zh-TW.json
@@ -1 +1 @@
-{"description":"透過 Linear 原生 Agent Session 在 issue 中使用 nanobot。","requirements":"一個私有 Linear OAuth 應用程式和穩定的公網 HTTPS 回呼網址","setup":{"docsLabel":"開啟 Linear 設定指南","officialLabel":"建立 Linear OAuth 應用程式","tryIt":"在 issue 評論中 @ 應用程式或將 issue 委派給它;進入 Agent Session 後,後續對話無需重複 @。","summary":"建立私有 Linear OAuth 應用程式,儲存憑證和公網網址,再授權工作區。可透過 @ 應用程式或委派 issue 開啟會話,普通評論會被忽略。","steps":["用穩定的 HTTPS 網址公開此 nanobot 實例(可以使用隧道)。","在 Linear 建立私有 OAuth 應用程式,啟用 read、write、app:mentionable 和 app:assignable。","將應用程式 webhook 訂閱 AgentSessionEvent、PermissionChange 和 OAuthAuthorization,並填入產生的 webhook 網址。","透過 OAuth 連接工作區,然後 @ 應用程式或將 issue 委派給它。"],"fields":{"clientId":{"label":"OAuth Client ID","placeholder":"Linear OAuth Client ID","help":"從 Linear 私有 OAuth 應用程式中複製。"},"clientSecret":{"label":"OAuth Client Secret","placeholder":"••••••","help":"只儲存在此 nanobot 實例中。"},"webhookSigningSecret":{"label":"Webhook 簽署密鑰","placeholder":"••••••","help":"在解析 webhook 內容前驗證 Linear-Signature。"},"publicBaseUrl":{"label":"公網 HTTPS 網址","placeholder":"https://nanobot.example.com","help":"穩定且能轉送到下方監聽連接埠的 HTTPS 來源網址,不要包含路徑。"},"host":{"label":"監聽位址","placeholder":"0.0.0.0"},"port":{"label":"監聽連接埠","placeholder":"3979"},"webhookPath":{"label":"Webhook 路徑","placeholder":"/linear/webhook"},"oauthCallbackPath":{"label":"OAuth 回呼路徑","placeholder":"/linear/oauth/callback"},"allowFrom":{"label":"允許的 Linear 使用者","placeholder":"以逗號分隔 Linear 使用者 ID","help":"留空使用 nanobot 配對;填寫 * 允許已連接工作區內的所有使用者。"},"showReasoning":{"label":"顯示推理過程","help":"將模型推理作為思考動態發佈到 Linear;關閉後會話更簡潔。"}}},"custom":{"qrAlt":"Linear 授權 QR code","authorizeTitle":"在 Linear 中授權","authorizeDescription":"在目前瀏覽器開啟 Linear 或掃描 QR code;授權後 nanobot 會自動啟用 channel。","waiting":"正在等待 Linear 授權……","connected":"Linear 已連接。","stopped":"授權已停止。","connecting":"正在連接……","reconnect":"連接另一個工作區","connect":"連接 Linear","openLinear":"前往 Linear","createApp":"建立 Linear 應用程式","savePublicUrl":"請先填寫公網 HTTPS 網址,再建立 Linear 應用程式。","removeCredentials":"刪除已儲存的憑證","retrySave":"重試","channelRunning":"Channel 正在執行","accessAll":"已授權工作區中的所有成員都可以執行此 Agent。","accessRestricted":"只有「進階」中列出的 Linear 使用者 ID 可以執行此 Agent。","accessPairing":"首次使用需配對,連接 Linear MCP 後可搜尋或修改 issue。","configureTools":"設定 Linear MCP","workspacesTitle":"已授權的工作區","refreshWorkspaces":"重新整理工作區","loadingWorkspaces":"正在載入工作區","noWorkspaces":"尚未授權工作區。連接工作區後才能接收 Linear Agent 請求。","refreshRequired":"需要重新整理授權","missingScopes":"重新連接以授予:{{scopes}}","authorized":"已授權","confirmDisconnect":"中斷工作區連線","disconnect":"中斷連線"},"members":{"title":"成員存取","help":"選擇可在 Linear 中免配對使用 nanobot 的成員。這不會授予 nanobot 後台管理權限。關閉後會阻止新請求,但不會取消正在執行的任務。","allowAll":"進階設定目前允許所有成員(*),包含新成員。個別關閉的成員仍會被拒絕;若希望新成員須經核准,請移除 *。","search":"搜尋成員","refresh":"重新整理成員","working":"正在更新成員存取權限……","saved":"成員存取權限已儲存。","retry":"請重新整理成員清單確認目前狀態後再試。","empty":"應用程式可存取的團隊中沒有符合的活躍成員。","allow":"允許 {{name}} 使用 nanobot","saveUnconfirmed":"無法確認權限已儲存,請重新整理成員清單後再試。","guide":"在「成員存取」中為同事開通免配對使用。既有授權仍然有效,除非手動關閉。連接 Linear MCP 後可搜尋或修改 issue。"}}
+{"description":"透過 Linear 原生 Agent Session 在 issue 中使用 nanobot。","requirements":"一個私有 Linear OAuth 應用程式和穩定的公網 HTTPS 回呼網址","setup":{"docsLabel":"開啟 Linear 設定指南","officialLabel":"建立 Linear OAuth 應用程式","tryIt":"在 issue 評論中 @ 應用程式或將 issue 委派給它;進入 Agent Session 後,後續對話無需重複 @。","summary":"建立私有 Linear OAuth 應用程式,儲存憑證和公網網址,再授權工作區。可透過 @ 應用程式或委派 issue 開啟會話,普通評論會被忽略。","steps":["用穩定的 HTTPS 網址公開此 nanobot 實例(可以使用隧道)。","在 Linear 建立私有 OAuth 應用程式,啟用 read、write、app:mentionable 和 app:assignable。","將應用程式 webhook 訂閱 AgentSessionEvent、PermissionChange 和 OAuthAuthorization,並填入產生的 webhook 網址。","透過 OAuth 連接工作區,然後 @ 應用程式或將 issue 委派給它。"],"fields":{"clientId":{"label":"OAuth Client ID","placeholder":"Linear OAuth Client ID","help":"從 Linear 私有 OAuth 應用程式中複製。"},"clientSecret":{"label":"OAuth Client Secret","placeholder":"••••••","help":"只儲存在此 nanobot 實例中。"},"webhookSigningSecret":{"label":"Webhook 簽署密鑰","placeholder":"••••••","help":"在解析 webhook 內容前驗證 Linear-Signature。"},"publicBaseUrl":{"label":"公網 HTTPS 網址","placeholder":"https://nanobot.example.com","help":"穩定且能轉送到下方監聽連接埠的 HTTPS 來源網址,不要包含路徑。"},"host":{"label":"監聽位址","placeholder":"0.0.0.0"},"port":{"label":"監聽連接埠","placeholder":"3979"},"webhookPath":{"label":"Webhook 路徑","placeholder":"/linear/webhook"},"oauthCallbackPath":{"label":"OAuth 回呼路徑","placeholder":"/linear/oauth/callback"},"allowFrom":{"label":"允許的 Linear 使用者","placeholder":"以逗號分隔 Linear 使用者 ID","help":"留空使用 nanobot 配對;填寫 * 允許已連接工作區內的所有使用者。"},"showReasoning":{"label":"顯示推理過程","help":"將模型推理作為思考動態發佈到 Linear;關閉後會話更簡潔。"}}},"custom":{"qrAlt":"Linear 授權 QR code","authorizeTitle":"在 Linear 中授權","authorizeDescription":"在目前瀏覽器開啟 Linear 或掃描 QR code;授權後 nanobot 會自動啟用 channel。","waiting":"正在等待 Linear 授權……","connected":"Linear 已連接。","stopped":"授權已停止。","connecting":"正在連接……","reconnect":"連接另一個工作區","connect":"連接 Linear","openLinear":"前往 Linear","createApp":"建立 Linear 應用程式","savePublicUrl":"請先填寫公網 HTTPS 網址,再建立 Linear 應用程式。","removeCredentials":"刪除已儲存的憑證","retrySave":"重試","channelRunning":"Channel 正在執行","accessAll":"已授權工作區中的所有成員都可以執行此 Agent。","accessRestricted":"只有「進階」中列出的 Linear 使用者 ID 可以執行此 Agent。","accessPairing":"首次使用需配對,連接 Linear MCP 後可搜尋或修改 issue。","configureTools":"設定 Linear MCP","workspacesTitle":"已授權的工作區","refreshWorkspaces":"重新整理工作區","loadingWorkspaces":"正在載入工作區","noWorkspaces":"尚未授權工作區。連接工作區後才能接收 Linear Agent 請求。","refreshRequired":"需要重新整理授權","missingScopes":"重新連接以授予:{{scopes}}","authorized":"已授權","confirmDisconnect":"中斷工作區連線","disconnect":"中斷連線"},"members":{"title":"成員存取","help":"選擇可在 Linear 中免配對使用 nanobot 的成員。這不會授予 nanobot 後台管理權限。關閉後會阻止新請求,但不會取消正在執行的任務。","allowAll":"進階設定目前允許所有成員(*),包含新成員。個別關閉的成員仍會被拒絕;若希望新成員須經核准,請移除 *。","search":"搜尋成員","refresh":"重新整理成員","working":"儲存中…","saved":"已儲存","retry":"請重新整理成員清單確認目前狀態後再試。","empty":"應用程式可存取的團隊中沒有符合的活躍成員。","allow":"允許 {{name}} 使用 nanobot","saveUnconfirmed":"無法確認權限已儲存,請重新整理成員清單後再試。","guide":"在「成員存取」中為同事開通免配對使用。既有授權仍然有效,除非手動關閉。連接 Linear MCP 後可搜尋或修改 issue。","intro":"選擇哪些成員可以在 Linear 中使用 nanobot,無需配對碼。","details":"關於成員存取權限","summary":"已開啟 {{allowed}} / {{total}} 人","loading":"正在取得團隊成員…","refreshing":"正在檢查更新…"}}
diff --git a/nanobot/channels/linear/webui/member-access-store.ts b/nanobot/channels/linear/webui/member-access-store.ts
new file mode 100644
index 000000000..735603010
--- /dev/null
+++ b/nanobot/channels/linear/webui/member-access-store.ts
@@ -0,0 +1,123 @@
+import type { WebUIMutationTransport } from "@/lib/api";
+
+import { manageLinearMembers } from "./api";
+import type { LinearMembersPayload } from "./types";
+
+type MemberSave = { status: "saving" | "saved" } | { status: "error"; message: string };
+interface MemberAccessSnapshot {
+ payload: LinearMembersPayload | null;
+ loading: boolean;
+ error: string | null;
+ saves: Record<string, MemberSave>;
+}
+
+const FRESH_FOR_MS = 60_000;
+
+/** Display cache only. The server still checks membership and access on every request. */
+class LinearMemberAccessStore {
+ private snapshot: MemberAccessSnapshot = { payload: null, loading: false, error: null, saves: {} };
+ private listeners = new Set<() => void>();
+ private readVersion = 0;
+ private fetchedAt = 0;
+
+ constructor(private client: WebUIMutationTransport, private organizationId: string) {}
+
+ getSnapshot = () => this.snapshot;
+ subscribe = (listener: () => void) => {
+ this.listeners.add(listener);
+ return () => { this.listeners.delete(listener); };
+ };
+
+ private update(patch: Partial<MemberAccessSnapshot>) {
+ this.snapshot = { ...this.snapshot, ...patch };
+ this.listeners.forEach((listener) => listener());
+ }
+
+ private get saving() {
+ return Object.values(this.snapshot.saves).some((save) => save.status === "saving");
+ }
+
+ get canEvict() {
+ return !this.listeners.size && !this.saving && !this.snapshot.loading;
+ }
+
+ load = async (force = false) => {
+ if (this.snapshot.loading || this.saving) return;
+ if (!force && this.snapshot.payload && Date.now() - this.fetchedAt < FRESH_FOR_MS) return;
+ const version = ++this.readVersion;
+ this.update({ loading: true, error: null });
+ try {
+ const payload = await manageLinearMembers(this.client, {
+ operation: "members", organization_id: this.organizationId,
+ });
+ if (version !== this.readVersion) return;
+ this.fetchedAt = Date.now();
+ this.update({ payload, loading: false, saves: {} });
+ } catch (error) {
+ if (version !== this.readVersion) return;
+ this.update({ loading: false, error: error instanceof Error ? error.message : String(error) });
+ }
+ };
+
+ setAllowed = async (userId: string, allowed: boolean, unconfirmedMessage: string) => {
+ const previous = this.snapshot.saves[userId];
+ if (previous?.status === "saving" || previous?.status === "error") return;
+ if (!this.snapshot.payload?.members.some((member) => member.id === userId)) return;
+ // An older directory response must not overwrite a newer permission change.
+ this.readVersion += 1;
+ this.update({ loading: false, saves: { ...this.snapshot.saves, [userId]: { status: "saving" } } });
+ try {
+ const payload = await manageLinearMembers(this.client, {
+ operation: "member_access", organization_id: this.organizationId, user_id: userId, allowed,
+ });
+ const updated = payload.members.find((member) => member.id === userId);
+ if (payload.organization_id !== this.organizationId || !updated || updated.allowed !== allowed) {
+ throw new Error(unconfirmedMessage);
+ }
+ const current = this.snapshot.payload;
+ if (!current) return;
+ this.update({
+ payload: {
+ ...current,
+ legacy_allow_all: payload.legacy_allow_all,
+ members: current.members.map((member) => member.id === userId ? updated : member),
+ },
+ saves: { ...this.snapshot.saves, [userId]: { status: "saved" } },
+ });
+ } catch (error) {
+ // A timeout can mean the server saved the change. Re-read before retrying this member.
+ this.fetchedAt = 0;
+ this.update({ saves: { ...this.snapshot.saves, [userId]: {
+ status: "error", message: error instanceof Error ? error.message : String(error),
+ } } });
+ }
+ };
+}
+
+const caches = new WeakMap<WebUIMutationTransport, {
+ token: string;
+ stores: Map<string, LinearMemberAccessStore>;
+}>();
+
+/** Keep visited lists across panel closes, never across gateways, logins or app configurations. */
+export function linearMemberAccessStore(
+ client: WebUIMutationTransport, token: string, configScope: string, organizationId: string,
+) {
+ let cache = caches.get(client);
+ if (!cache || cache.token !== token) {
+ cache = { token, stores: new Map() };
+ caches.set(client, cache);
+ }
+ const key = JSON.stringify([configScope, organizationId]);
+ let store = cache.stores.get(key);
+ if (!store) {
+ if (cache.stores.size >= 32) {
+ for (const [cachedKey, entry] of cache.stores) {
+ if (entry.canEvict) { cache.stores.delete(cachedKey); break; }
+ }
+ }
+ store = new LinearMemberAccessStore(client, organizationId);
+ cache.stores.set(key, store);
+ }
+ return store;
+}
diff --git a/webui/src/tests/linear-member-access.test.tsx b/webui/src/tests/linear-member-access.test.tsx
index 843acc85b..7479229eb 100644
--- a/webui/src/tests/linear-member-access.test.tsx
+++ b/webui/src/tests/linear-member-access.test.tsx
@@ -4,11 +4,11 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { LinearMemberAccess } from "../../../nanobot/channels/linear/webui/LinearMemberAccess";
import type { LinearMembersPayload } from "../../../nanobot/channels/linear/webui/types";
-const { requestMutation } = vi.hoisted(() => ({ requestMutation: vi.fn() }));
-vi.mock("@/providers/ClientProvider", () => {
- const client = { requestMutation };
- return { useClient: () => ({ client }) };
+const { requestMutation, context } = vi.hoisted(() => {
+ const requestMutation = vi.fn();
+ return { requestMutation, context: { client: { requestMutation }, token: "admin-session" } };
});
+vi.mock("@/providers/ClientProvider", () => ({ useClient: () => context }));
const roster: LinearMembersPayload = {
session_id: "", status: "members", organization_id: "org-1", legacy_allow_all: false,
@@ -18,86 +18,250 @@ const roster: LinearMembersPayload = {
],
};
-beforeEach(() => requestMutation.mockReset().mockResolvedValue(roster));
-afterEach(cleanup);
+beforeEach(() => {
+ requestMutation.mockReset().mockResolvedValue(roster);
+ context.client = { requestMutation };
+ context.token = "admin-session";
+});
+afterEach(() => { cleanup(); vi.restoreAllMocks(); });
+
+const header = () => screen.getByRole("button", { name: /^Member access/ });
+const xubin = () => screen.getByRole("switch", { name: "Allow Xubin to use nanobot" });
+const yongru = () => screen.getByRole("switch", { name: "Allow Yongru to use nanobot" });
+const refresh = () => fireEvent.click(screen.getByRole("button", { name: "Refresh members" }));
+
+function deferNextRequest() {
+ let resolve!: (value: LinearMembersPayload) => void;
+ let reject!: (error: Error) => void;
+ const promise = new Promise<LinearMembersPayload>((done, fail) => {
+ resolve = done; reject = fail;
+ });
+ requestMutation.mockReturnValueOnce(promise);
+ return { resolve, reject };
+}
async function openMembers() {
- render(<LinearMemberAccess organizationId="org-1" />);
+ const view = render(<LinearMemberAccess organizationId="org-1" />);
expect(requestMutation).not.toHaveBeenCalled();
- fireEvent.click(screen.getByRole("button", { name: "Member access" }));
- return screen.findByRole("switch", { name: "Allow Yongru to use nanobot" });
+ fireEvent.click(header());
+ await screen.findByRole("switch", { name: "Allow Yongru to use nanobot" });
+ return view;
}
describe("Linear member access", () => {
- it("loads the selected workspace, shows effective permissions and searches by name", async () => {
- const toggle = await openMembers();
- expect(toggle).not.toBeChecked();
- expect(screen.getByRole("switch", { name: "Allow Xubin to use nanobot" })).toBeChecked();
+ it("shows permissions, a summary and short guidance; details are available on demand", async () => {
+ await openMembers();
+ expect(yongru()).not.toBeChecked();
+ expect(xubin()).toBeChecked();
+ expect(header()).toHaveTextContent("1 of 2 enabled");
expect(requestMutation).toHaveBeenCalledWith("settings.channel.connect.start", {
channel: "linear", operation: "members", organization_id: "org-1",
}, 150_000);
- expect(screen.getByText(/does not grant access/)).toBeVisible();
+ expect(screen.getByText(/No pairing codes needed/)).toBeVisible();
+ expect(screen.queryByRole("tooltip")).not.toBeInTheDocument();
+ fireEvent.click(screen.getByRole("button", { name: "About member access" }));
+ expect(await screen.findByRole("tooltip")).toHaveTextContent("does not grant access");
fireEvent.change(screen.getByRole("textbox", { name: "Search members" }), { target: { value: "yong" } });
expect(screen.queryByRole("switch", { name: "Allow Xubin to use nanobot" })).not.toBeInTheDocument();
- expect(toggle).toBeVisible();
+ expect(yongru()).toBeVisible();
+ });
+
+ it.each(["hover", "focus"])("prefetches on %s, deduplicates the click, and never sends a permission write", async (intent) => {
+ const request = deferNextRequest();
+ render(<LinearMemberAccess organizationId="org-1" />);
+ if (intent === "hover") fireEvent.mouseEnter(header());
+ else fireEvent.focus(header());
+ expect(requestMutation).toHaveBeenCalledTimes(1);
+ fireEvent.click(header());
+ expect(requestMutation).toHaveBeenCalledTimes(1);
+ expect(screen.getByText("Finding your teammates…")).toBeVisible();
+ expect(screen.getByRole("textbox", { name: "Search members" })).toBeEnabled();
+ expect(header()).toBeEnabled();
+ expect(document.querySelector(".animate-spin")).toBeNull();
+ expect(screen.queryByText(/No matching active/)).not.toBeInTheDocument();
+ await act(async () => request.resolve(roster));
+ expect(yongru()).toBeEnabled();
+ });
+
+ it("keeps the list and search on reopen without fetching again", async () => {
+ await openMembers();
+ fireEvent.change(screen.getByRole("textbox", { name: "Search members" }), { target: { value: "yong" } });
+ fireEvent.click(header());
+ expect(screen.queryByRole("switch")).not.toBeInTheDocument();
+ fireEvent.click(header());
+ expect(yongru()).toBeVisible();
+ expect(screen.getByRole("textbox", { name: "Search members" })).toHaveValue("yong");
+ expect(requestMutation).toHaveBeenCalledTimes(1);
+ });
+
+ it("keeps a fresh list across panel unmounts, scoped to this admin session", async () => {
+ const view = await openMembers();
+ view.unmount();
+ render(<LinearMemberAccess organizationId="org-1" />);
+ fireEvent.click(header());
+ expect(yongru()).toBeVisible();
+ expect(requestMutation).toHaveBeenCalledTimes(1);
+ expect(screen.queryByText("Finding your teammates…")).not.toBeInTheDocument();
+ });
+
+ it("shows a stale list immediately while revalidating, without disabling the list", async () => {
+ const view = await openMembers();
+ view.unmount();
+ vi.spyOn(Date, "now").mockReturnValue(Date.now() + 61_000);
+ const request = deferNextRequest();
+ render(<LinearMemberAccess organizationId="org-1" />);
+ fireEvent.click(header());
+ expect(yongru()).toBeVisible();
+ expect(yongru()).toBeEnabled();
+ expect(screen.getByText("Checking for updates…")).toBeVisible();
+ await act(async () => request.resolve({ ...roster, members: [roster.members[0]] }));
+ expect(screen.queryByRole("switch", { name: "Allow Yongru to use nanobot" })).not.toBeInTheDocument();
});
- it("changes the switch only after the server confirms and sends stable IDs", async () => {
- const toggle = await openMembers();
- let resolve!: (value: LinearMembersPayload) => void;
- requestMutation.mockImplementationOnce(() => new Promise<LinearMembersPayload>((done) => { resolve = done; }));
- fireEvent.click(toggle);
- expect(toggle).toBeDisabled();
- expect(toggle).not.toBeChecked();
+ it("changes a switch only after confirmation and keeps other members editable", async () => {
+ await openMembers();
+ const request = deferNextRequest();
+ fireEvent.click(yongru());
+ expect(yongru()).toBeDisabled();
+ expect(yongru()).not.toBeChecked();
+ expect(xubin()).toBeEnabled();
+ expect(header()).toBeEnabled();
+ expect(screen.getByText("Saving…")).toBeVisible();
expect(requestMutation).toHaveBeenLastCalledWith("settings.channel.connect.start", {
channel: "linear", operation: "member_access", organization_id: "org-1", user_id: "u2", allowed: true,
}, 150_000);
- await act(async () => resolve({ ...roster, status: "member_access_saved", members: [{ ...roster.members[1], allowed: true }] }));
- expect(toggle).toBeChecked();
- expect(toggle).toBeEnabled();
- expect(screen.getByText("Member access saved.")).toBeVisible();
- expect(screen.getByRole("switch", { name: "Allow Xubin to use nanobot" })).toBeChecked();
- });
-
- it("does not fake success on save failure and requires refresh before retrying", async () => {
- const toggle = await openMembers();
- requestMutation.mockRejectedValueOnce(new Error("Could not save"));
- fireEvent.click(toggle);
- expect(await screen.findByRole("alert")).toHaveTextContent("Could not save");
- expect(toggle).not.toBeChecked();
- expect(toggle).toBeDisabled();
- expect(screen.queryByText("Member access saved.")).not.toBeInTheDocument();
- fireEvent.click(screen.getByRole("button", { name: "Refresh members" }));
- await waitFor(() => expect(toggle).toBeEnabled());
+ await act(async () => request.resolve({ ...roster, status: "member_access_saved", members: [{ ...roster.members[1], allowed: true }] }));
+ expect(yongru()).toBeChecked();
+ expect(yongru()).toBeEnabled();
+ expect(screen.getByText("Saved")).toBeVisible();
+ expect(xubin()).toBeChecked();
+ });
+
+ it("handles concurrent member saves completing in reverse order", async () => {
+ await openMembers();
+ const grant = deferNextRequest();
+ fireEvent.click(yongru());
+ const revoke = deferNextRequest();
+ fireEvent.click(xubin());
+ await act(async () => revoke.resolve({ ...roster, members: [{ ...roster.members[0], allowed: false }] }));
+ expect(xubin()).not.toBeChecked();
+ expect(xubin()).toBeEnabled();
+ expect(yongru()).toBeDisabled();
+ await act(async () => grant.resolve({ ...roster, members: [{ ...roster.members[1], allowed: true }] }));
+ expect(xubin()).not.toBeChecked();
+ expect(yongru()).toBeChecked();
+ expect(screen.getAllByText("Saved")).toHaveLength(2);
+ });
+
+ it("does not overwrite a confirmed permission with a late directory response", async () => {
+ await openMembers();
+ const read = deferNextRequest();
+ refresh();
+ const save = deferNextRequest();
+ fireEvent.click(yongru());
+ await act(async () => save.resolve({ ...roster, members: [{ ...roster.members[1], allowed: true }] }));
+ await act(async () => read.resolve(roster));
+ expect(yongru()).toBeChecked();
+ expect(screen.getByText("Saved")).toBeVisible();
+ });
+
+ it("retains a pending save across closing the panel and confirms it when it finishes", async () => {
+ const view = await openMembers();
+ const request = deferNextRequest();
+ fireEvent.click(yongru());
+ view.unmount();
+ render(<LinearMemberAccess organizationId="org-1" />);
+ fireEvent.click(header());
+ expect(yongru()).toBeDisabled();
+ expect(screen.getByText("Saving…")).toBeVisible();
+ expect(requestMutation).toHaveBeenCalledTimes(2);
+ await act(async () => request.resolve({ ...roster, members: [{ ...roster.members[1], allowed: true }] }));
+ expect(yongru()).toBeChecked();
+ expect(yongru()).toBeEnabled();
+ });
+
+ it("contains an uncertain save to that member and reconciles server state on refresh", async () => {
+ await openMembers();
+ requestMutation.mockRejectedValueOnce(new Error("Could not confirm save"));
+ fireEvent.click(yongru());
+ expect(await screen.findByRole("alert")).toHaveTextContent("Could not confirm save");
+ expect(yongru()).not.toBeChecked();
+ expect(yongru()).toBeDisabled();
+ expect(yongru()).toHaveAccessibleDescription(/Refresh members/);
+ expect(xubin()).toBeEnabled();
+ expect(screen.queryByText("Saved")).not.toBeInTheDocument();
+ requestMutation.mockResolvedValueOnce({
+ ...roster, members: roster.members.map((member) => ({ ...member, allowed: true })),
+ });
+ refresh();
+ await waitFor(() => expect(yongru()).toBeEnabled());
+ expect(yongru()).toBeChecked();
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
});
- it("does not turn a failed roster load into an empty successful directory", async () => {
+ it("rejects a mismatched save confirmation", async () => {
+ await openMembers();
+ requestMutation.mockResolvedValueOnce(roster);
+ fireEvent.click(yongru());
+ expect(await screen.findByRole("alert")).toHaveTextContent("Access was not confirmed");
+ expect(yongru()).not.toBeChecked();
+ expect(yongru()).toBeDisabled();
+ });
+
+ it("does not turn a failed initial load into an empty successful directory", async () => {
requestMutation.mockRejectedValueOnce(new Error("Linear unavailable"));
render(<LinearMemberAccess organizationId="org-1" />);
- fireEvent.click(screen.getByRole("button", { name: "Member access" }));
+ fireEvent.click(header());
expect(await screen.findByRole("alert")).toHaveTextContent("Linear unavailable");
expect(screen.queryByRole("switch")).not.toBeInTheDocument();
expect(screen.queryByText(/No matching active/)).not.toBeInTheDocument();
});
+ it("keeps known members visible when a refresh fails", async () => {
+ await openMembers();
+ requestMutation.mockRejectedValueOnce(new Error("Linear unavailable"));
+ refresh();
+ expect(await screen.findByRole("alert")).toHaveTextContent("Linear unavailable");
+ expect(xubin()).toBeChecked();
+ expect(yongru()).toBeEnabled();
+ });
+
+ it.each(["workspace", "login", "gateway", "app configuration"])("isolates cached lists and late responses after changing %s", async (scope) => {
+ const view = await openMembers();
+ const oldSave = deferNextRequest();
+ fireEvent.click(yongru());
+ const nextRead = deferNextRequest();
+ if (scope === "login") context.token = "another-admin-session";
+ if (scope === "gateway") context.client = { requestMutation };
+ const organizationId = scope === "workspace" ? "org-2" : "org-1";
+ view.rerender(<LinearMemberAccess organizationId={organizationId} configScope={scope === "app configuration" ? "other-app" : ""} />);
+ expect(screen.queryByRole("switch")).not.toBeInTheDocument();
+ await act(async () => oldSave.resolve({ ...roster, members: [{ ...roster.members[1], allowed: true }] }));
+ expect(screen.queryByRole("switch")).not.toBeInTheDocument();
+ await act(async () => nextRead.resolve({ ...roster, organization_id: organizationId, members: [roster.members[0]] }));
+ expect(xubin()).toBeVisible();
+ expect(screen.queryByRole("switch", { name: "Allow Yongru to use nanobot" })).not.toBeInTheDocument();
+ });
+
it("explains legacy wildcard access without hiding individual off switches", async () => {
requestMutation.mockResolvedValue({ ...roster, legacy_allow_all: true });
- const toggle = await openMembers();
+ await openMembers();
expect(screen.getByText(/including new members/)).toBeVisible();
- expect(toggle).not.toBeChecked();
+ expect(yongru()).not.toBeChecked();
});
- it("blocks edits while parent configuration is unsaved", () => {
+ it("blocks prefetches and edits while parent configuration is unsaved", () => {
render(<LinearMemberAccess organizationId="org-1" disabled />);
- fireEvent.click(screen.getByRole("button", { name: "Member access" }));
+ fireEvent.mouseEnter(header());
+ fireEvent.focus(header());
+ fireEvent.click(header());
expect(requestMutation).not.toHaveBeenCalled();
});
it("disambiguates duplicate names with IDs", async () => {
requestMutation.mockResolvedValue({ ...roster, members: roster.members.map((member) => ({ ...member, name: "Alex" })) });
render(<LinearMemberAccess organizationId="org-1" />);
- fireEvent.click(screen.getByRole("button", { name: "Member access" }));
+ fireEvent.click(header());
expect(await screen.findByText("u1")).toBeVisible();
expect(screen.getByText("u2")).toBeVisible();
});