History

feat(toolkits): show connection display name, not the slug

The Access list, note placeholder, and 'what the agent sees' rail now render a connection's display label (its identityLabel, falling back to the name) instead of the raw connection name/slug — matching how accounts-section and the rest of the console show a connection. Display-only; the stored connection name (keys, toolkit entries, policy pattern ids) is unchanged.

Rhys Sullivan committed 5 months ago

Commit 6a411191 parent 07a31df1 file · +21 −6Browse files

Unified · Split

packages/plugins/toolkits/src/react/ToolkitsPage.tsx+21−6
@@ -80,6 +80,12 @@ type ToolRow = { · 79 unmodified lines
8080 readonly requiresApproval?: boolean;
8181 };
8282
83+/** Connection's human display name — its "which account" label, falling back to
84+ * the (slug-like) connection name. Matches how the rest of the console renders
85+ * a connection (see accounts-section). */
86+const connLabel = (c: { readonly name: string; readonly identityLabel?: string | null }): string =>
87+ c.identityLabel && c.identityLabel.length > 0 ? c.identityLabel : c.name;
88+
8389 const ACCESS_OPTIONS: ReadonlyArray<{ value: ToolkitAccess; label: string }> = [
8490 { value: "off", label: "Off" },
8591 { value: "read", label: "Read" },
@@ -455,7 +461,15 @@ function ToolkitEditor(props: EditorProps) { · 369 unmodified lines
455461
456462 // Live "what the agent sees" — derived from the in-progress form.
457463 const previewGroups = useMemo(() => {
458− const byInt = new Map<string, Array<{ name: string; access: ToolkitAccess; note?: string }>>();
464+ const byInt = new Map<
465+ string,
466+ Array<{
467+ name: string;
468+ identityLabel?: string | null;
469+ access: ToolkitAccess;
470+ note?: string;
471+ }>
472+ >();
459473 for (const tier of tiers) {
460474 for (const c of tier.conns) {
461475 const key = connKey(c.integration, c.name);
@@ -464,6 +478,7 @@ function ToolkitEditor(props: EditorProps) { · 2 unmodified lines
464478 const list = byInt.get(c.integration) ?? [];
465479 list.push({
466480 name: c.name,
481+ identityLabel: c.identityLabel,
467482 access: a,
468483 note: notes[key]?.trim() || undefined,
469484 });
@@ -570,11 +585,11 @@ function ToolkitEditor(props: EditorProps) { · 100 unmodified lines
570585 <div className="flex items-center gap-3 py-1">
571586 <div className="min-w-0 flex-1">
572587 <div className="truncate text-[13px] font-semibold text-foreground">
573− {c.name}
588+ {connLabel(c)}
574589 </div>
575− {(c.identityLabel || c.description) && (
590+ {c.description && (
576591 <div className="truncate text-[11.5px] text-muted-foreground">
577− {c.identityLabel || c.description}
592+ {c.description}
578593 </div>
579594 )}
580595 </div>
@@ -586,7 +601,7 @@ function ToolkitEditor(props: EditorProps) { · 5 unmodified lines
586601 onChange={(e) =>
587602 setNote(key, (e.target as HTMLInputElement).value)
588603 }
589− placeholder={`Note to the agent about ${c.name} (optional)`}
604+ placeholder={`Note to the agent about ${connLabel(c)} (optional)`}
590605 className="mb-1.5 h-7 border-transparent bg-transparent px-0 text-[12px] italic shadow-none focus-visible:border-input"
591606 />
592607 )}
@@ -743,7 +758,7 @@ function ToolkitEditor(props: EditorProps) { · 150 unmodified lines
743758 {conns.map((c) => (
744759 <div key={c.name} className="mt-1 pl-6">
745760 <div className="flex items-center gap-2">
746− <span className="text-[12px] text-foreground">{c.name}</span>
761+ <span className="text-[12px] text-foreground">{connLabel(c)}</span>
747762 <Badge
748763 variant={c.access === "full" ? "default" : "secondary"}
749764 className="px-1.5 py-0 text-[10px]"

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t