ToolAgentSelector

Description

ToolAgentSelector is a trigger button that opens a searchable popup of checkbox rows for enabling agents and tools, listed under "Agents" and "Tools" headers with an icon, a title and an optional description per row. The trigger shows a badge with the number of selected items, and Compact() hides the descriptions. The popup can also be shown at an explicit viewport position with ShowInlineAt, which is how OmniBox.EnableChatMentions turns typing @ into the same picker.

Usage

Create the selector with ToolAgentSelector(label, icon), fill the two sections with Agents(...) and Tools(...), and read SelectedItems or SelectedCount in OnChange.

In a chat composer, put the selector in the OmniBox footer and wire EnableChatMentions to it so @ opens the popup at the caret. Typing filters the list, Arrow Up/Down moves the highlight, and Enter toggles the highlighted item.

API reference

class

ToolAgentSelector

public sealed class ToolAgentSelector : Layer<ToolAgentSelector>

A trigger button with a searchable popup for enabling agents and tools, shown grouped under "Agents" and "Tools" sections. Selecting items updates a count badge on the trigger. Designed to be dropped into one of FooterItems's slots, and can also be driven inline (see ShowInlineAt) to back an "@mention" style picker inside a chat input.

Namespace
Tesserae
Inheritance
Layer<ToolAgentSelector> → ToolAgentSelector

Constructors

NameDescription
ToolAgentSelectorInitializes a new instance of this class.
Constructor
ToolAgentSelector
public ToolAgentSelector(string label = "Tools", UIcons icon = UIcons.Tools)

Initializes a new instance of this class.

Properties

NameDescription
SelectedItemsGets every currently selected item, agents first, then tools.
SelectedCountGets the number of currently selected items.
Property
ToolAgentSelector.SelectedItems
public Item[] SelectedItems

Gets every currently selected item, agents first, then tools.

Property
ToolAgentSelector.SelectedCount
public int SelectedCount

Gets the number of currently selected items.

Methods

NameDescription
RenderRenders the component's root HTML element.
AgentsSets the items shown under the "Agents" section (replaces any previously set).
ToolsSets the items shown under the "Tools" section (replaces any previously set).
CompactHides item descriptions, rendering a denser list of icon + title rows only.
OnChangeRegisters a callback invoked whenever the selection changes.
ShowShows the popup anchored below the trigger button.
ShowInlineAtShows the popup anchored at an explicit viewport position (for example, next to a text caret), without moving focus or toggling the trigger button's pressed state. Used to back an "@mention" style picker.
HideHides the popup.
FilterFilters the visible items by the given free-text query (matches title or description). Used both by the built-in search box and externally, to drive the popup from an inline "@" mention as the user types.
MoveHighlightMoves the keyboard-navigation highlight forward (positive) or backward (negative) among the currently visible items, wrapping around at either end.
ActivateHighlightedToggles the selection of the currently highlighted item (defaulting to the first visible item if none is highlighted yet). Returns true if an item was toggled.
Method
ToolAgentSelector.Render
public override HTMLElement Render()

Renders the component's root HTML element.

Method
ToolAgentSelector.Agents
public ToolAgentSelector Agents(params Item[] items)

Sets the items shown under the "Agents" section (replaces any previously set).

Method
ToolAgentSelector.Tools
public ToolAgentSelector Tools(params Item[] items)

Sets the items shown under the "Tools" section (replaces any previously set).

Method
ToolAgentSelector.Compact
public ToolAgentSelector Compact(bool value = true)

Hides item descriptions, rendering a denser list of icon + title rows only.

Method
ToolAgentSelector.OnChange
public ToolAgentSelector OnChange(Action<ToolAgentSelector> handler)

Registers a callback invoked whenever the selection changes.

Method
ToolAgentSelector.Show
public override ToolAgentSelector Show()

Shows the popup anchored below the trigger button.

Method
ToolAgentSelector.ShowInlineAt
public ToolAgentSelector ShowInlineAt(double clientX, double clientY)

Shows the popup anchored at an explicit viewport position (for example, next to a text caret), without moving focus or toggling the trigger button's pressed state. Used to back an "@mention" style picker.

Method
ToolAgentSelector.Hide
public override void Hide(Action onHidden = null)

Hides the popup.

Method
ToolAgentSelector.Filter
public ToolAgentSelector Filter(string text)

Filters the visible items by the given free-text query (matches title or description). Used both by the built-in search box and externally, to drive the popup from an inline "@" mention as the user types.

Method
ToolAgentSelector.MoveHighlight
public void MoveHighlight(int direction)

Moves the keyboard-navigation highlight forward (positive) or backward (negative) among the currently visible items, wrapping around at either end.

Method
ToolAgentSelector.ActivateHighlighted
public bool ActivateHighlighted()

Toggles the selection of the currently highlighted item (defaulting to the first visible item if none is highlighted yet). Returns true if an item was toggled.

Events

NameDescription
SelectionChangedRaised whenever an item's selected state changes.
Event
ToolAgentSelector.SelectionChanged
public event Action<ToolAgentSelector> SelectionChanged

Raised whenever an item's selected state changes.

See also