From 0ad39b884ff4924572a3ac868dc8417e75e12a6b Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Fri, 26 Jun 2026 19:58:50 +0800 Subject: [PATCH] fix(bots): hide redundant namespace wildcard and show raw event code - Only surface `ns.*` wildcard when the namespace has 2+ concrete events, so single-event adapters (legacy) show just the one event - Show raw event code as a muted subtitle under each option's label Co-Authored-By: Claude Opus 4.8 --- .../bot-form/EventBindingsEditor.tsx | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx b/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx index 54ba788da..19004790e 100644 --- a/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx +++ b/web/src/app/home/bots/components/bot-form/EventBindingsEditor.tsx @@ -143,12 +143,17 @@ function agentSupportsEventPattern(agent: Agent, pattern: string) { } function eventNamespaces(events: string[]) { - const ns = new Set(); + // Only surface a `ns.*` wildcard when the namespace actually has 2+ + // concrete events — otherwise the wildcard is redundant with the single event. + const counts = new Map(); events.forEach((e) => { const n = e.split('.')[0]; - if (n) ns.add(`${n}.*`); + if (n) counts.set(n, (counts.get(n) ?? 0) + 1); }); - return Array.from(ns).sort(); + return Array.from(counts.entries()) + .filter(([, c]) => c >= 2) + .map(([n]) => `${n}.*`) + .sort(); } // Localized label for an event pattern. Concrete events look up @@ -535,14 +540,30 @@ function BindingCardContent({ }} > - + {binding.event_pattern ? ( + + {eventLabel(binding.event_pattern, t)} + + ) : ( + + )} - {eventOptions.map((event) => ( - - {eventLabel(event, t)} - - ))} + {eventOptions.map((event) => { + const label = eventLabel(event, t); + return ( + + + {label} + {label !== event && ( + + {event} + + )} + + + ); + })}