ToolCall
Description
Inline tool-call indicator that expands accordion-style to show the associated content. The content component is created lazily the first time the user expands the tool call. Used in chat / assistant UIs to surface tool invocations without taking up vertical space until expanded.
Usage
API reference
public sealed class ToolCall : ComponentBase<ToolCall, HTMLElement>Inline tool-call indicator that expands accordion-style to show the associated content. The content component is created lazily the first time the user expands the tool call.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<ToolCall, HTMLElement> → ToolCall
Constructors
| Name | Description |
|---|---|
| ToolCall | Initializes a new instance of this class. |
| Overload | |
|---|---|
| ToolCall(UIcons, string, Func<IComponent>) | Initializes a new instance of this class. |
| ToolCall(UIcons, string, IComponent) | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| Icon | Gets or sets the icon shown by the component. |
| Text | Gets or sets the text shown in the component. |
| IsExpanded | Gets or sets a value indicating whether the component is expanded. |
| HasContent | Returns a value indicating whether the component has the given content. |
| Progress | Gets the live progress line shown on the header while the call runs, creating it on first use. The line lives inside the header row, so expanding the call leaves it untouched. |
public bool IsExpandedGets or sets a value indicating whether the component is expanded.
public bool HasContentReturns a value indicating whether the component has the given content.
Methods
| Name | Description |
|---|---|
| CreateContent | Returns a fresh IComponent built from the content factory, or null if no factory was provided. Used by ToolsUsed to render the detail pane independently of this inline view. |
| SetContent | Sets the content of the component. |
| SetText | Sets the text of the component. |
| SetIcon | Sets the icon of the component. |
| SetProgress | Writes the given progress onto the header of this call, next to its name. Meant to be called as often as the progress arrives - only the text of the line changes. |
| ClearProgress | Clears the progress shown on the header, leaving the call as a plain chip again. |
| NotExpandable | Configures the not expandable on the component. |
| Expanded | Expands the component. |
| Expand | Expands the component. |
| Collapse | Collapses the component. |
| Toggle | Toggles the component's state. |
| OnToggle | Registers a callback invoked when the toggle event fires. |
| Render | Renders the component's root HTML element. |
public IComponent CreateContent()Returns a fresh IComponent built from the content factory, or null if no factory was provided. Used by ToolsUsed to render the detail pane independently of this inline view.
| Overload | |
|---|---|
| SetContent(Func<IComponent>) | Sets the content of the component. |
| SetContent(IComponent) | Sets the content of the component. |
| Overload | |
|---|---|
| SetProgress(string) | Writes the given progress onto the header of this call, next to its name. Meant to be called as often as the progress arrives - only the text of the line changes. |
| SetProgress(IObservable<string>) | Streams the progress shown on the header from the given observable. |
public ToolCall ClearProgress()Clears the progress shown on the header, leaving the call as a plain chip again.
public ToolCall NotExpandable()Configures the not expandable on the component.
public ToolCall OnToggle(Action<ToolCall> onToggle)Registers a callback invoked when the toggle event fires.
public sealed class ToolsUsed : ComponentBase<ToolsUsed, HTMLElement>Compact summary of multiple tool calls that opens a popup showing the list of tools on the left. Clicking a tool slides the list to the left and shows that tool's content on the right with a back button to return to the list. Inline swaps the popup for an in-place disclosure: the summary expands underneath itself into the list of ToolCalls, each one opening its own content inline the way a standalone call does.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<ToolsUsed, HTMLElement> → ToolsUsed
Constructors
| Name | Description |
|---|---|
| ToolsUsed | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| IsInline | Returns a value indicating whether the group renders its tools in place rather than in a popup. |
| IsExpanded | Returns a value indicating whether the inline list is open. Always false while the group opens its tools in the popup instead. |
| Progress | Gets the live progress line shown on the summary while the group's calls run, creating it on first use. |
public bool IsInlineReturns a value indicating whether the group renders its tools in place rather than in a popup.
public bool IsExpandedReturns a value indicating whether the inline list is open. Always false while the group opens its tools in the popup instead.
Methods
| Name | Description |
|---|---|
| Add | Adds the given item to the component. |
| AddRange | Adds the given range to the component. |
| Clear | Clears the component's current state. |
| SetSummary | Sets the summary of the component. |
| SetIcon | Sets the icon of the component. |
| SetTitle | Sets the title of the component. |
| Inline | Renders the tools in place instead of in a popup: the summary becomes an accordion that expands into the list of ToolCalls underneath itself, each one opening its own content inline the way a standalone call does. For a transcript where sending the reader to a modal for a one-line result is too much ceremony. |
| Expanded | Expands or collapses the group. |
| Expand | Opens the group: the inline list when Inline is set, the popup otherwise. |
| Collapse | Closes the group: the inline list when Inline is set, the popup otherwise. |
| Toggle | Toggles the group between open and closed. |
| OnToggle | Registers a callback invoked whenever the inline list is expanded or collapsed. |
| SetProgress | Writes the given progress onto the summary, next to the count of tools used. Meant to be called as often as the progress arrives - only the text of the line changes. |
| ClearProgress | Clears the progress shown on the summary. |
| Show | Shows the component: the popup, or the inline list when Inline is set. |
| Hide | Hides the component: the popup, or the inline list when Inline is set. |
| Render | Renders the component's root HTML element. |
| Overload | |
|---|---|
| Add(ToolCall) | Adds the given item to the component. |
| Add(UIcons, string, Func<IComponent>) | Adds the given item to the component. |
| Add(UIcons, string, IComponent) | Adds the given item to the component. |
Add(ToolCall)
public ToolsUsed Add(ToolCall tool)Adds the given item to the component.
Parameters
- tool ToolCall
public ToolsUsed AddRange(IEnumerable<ToolCall> tools)Adds the given range to the component.
public ToolsUsed SetSummary(string label)Sets the summary of the component.
public ToolsUsed Inline(bool value = true)Renders the tools in place instead of in a popup: the summary becomes an accordion that expands into the list of ToolCalls underneath itself, each one opening its own content inline the way a standalone call does. For a transcript where sending the reader to a modal for a one-line result is too much ceremony.
public ToolsUsed Expand()Opens the group: the inline list when Inline is set, the popup otherwise.
public ToolsUsed Collapse()Closes the group: the inline list when Inline is set, the popup otherwise.
public ToolsUsed OnToggle(Action<ToolsUsed> onToggle)Registers a callback invoked whenever the inline list is expanded or collapsed.
| Overload | |
|---|---|
| SetProgress(string) | Writes the given progress onto the summary, next to the count of tools used. Meant to be called as often as the progress arrives - only the text of the line changes. |
| SetProgress(IObservable<string>) | Streams the progress shown on the summary from the given observable. |
public ToolsUsed ClearProgress()Clears the progress shown on the summary.
public ToolsUsed Show()Shows the component: the popup, or the inline list when Inline is set.
public ToolsUsed Hide()Hides the component: the popup, or the inline list when Inline is set.
ToolCallInspect
The body of a tool-call inspection: the arguments a tool was called with, listed as name/value rows, above the response it returned in a read-only code block. Meant as the content of a ToolCall, inline or in the detail pane of a ToolsUsed modal. The sections scroll independently, with the arguments taking at most half the available height, so inspecting a long response never scrolls the arguments off screen.
public sealed class ToolCallInspect : ComponentBase<ToolCallInspect, HTMLElement>The body of a tool-call inspection: the arguments a tool was called with, listed as name/value rows, above the response it returned, shown in a read-only code block. Meant as the content of a ToolCall - inline, or in the detail pane of a ToolsUsed modal. The sections scroll independently: the arguments take at most half of the height available and the response claims the rest, so inspecting a long response never scrolls the arguments off screen.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<ToolCallInspect, HTMLElement> → ToolCallInspect
Constructors
| Name | Description |
|---|---|
| ToolCallInspect | Initializes a new instance of this class. |
Methods
| Name | Description |
|---|---|
| SetArguments | Sets the arguments shown by the component. A JSON object is listed as one name/value row per property; anything else is shown verbatim. An empty value hides the section. |
| SetResponse | Sets the response shown by the component. JSON is re-indented for reading; anything else is shown verbatim. An empty value hides the section. |
| SetError | Sets the error message shown by the component, for a call that failed. An empty value hides the section. |
| SetArgumentsLabel | Sets the caption shown above the arguments. Defaults to "Arguments". |
| SetResponseLabel | Sets the caption shown above the response. Defaults to "Response". |
| SetErrorLabel | Sets the caption shown above the error. Defaults to "Error". |
| SetEmptyText | Sets the text shown when the component has no arguments, response or error to show. |
| Render | Renders the component's root HTML element. |
public ToolCallInspect SetArguments(string arguments)Sets the arguments shown by the component. A JSON object is listed as one name/value row per property; anything else is shown verbatim. An empty value hides the section.
public ToolCallInspect SetResponse(string response)Sets the response shown by the component. JSON is re-indented for reading; anything else is shown verbatim. An empty value hides the section.
public ToolCallInspect SetError(string error)Sets the error message shown by the component, for a call that failed. An empty value hides the section.
public ToolCallInspect SetArgumentsLabel(string label)Sets the caption shown above the arguments. Defaults to "Arguments".
public ToolCallInspect SetResponseLabel(string label)Sets the caption shown above the response. Defaults to "Response".
public ToolCallInspect SetErrorLabel(string label)Sets the caption shown above the error. Defaults to "Error".
public ToolCallInspect SetEmptyText(string text)Sets the text shown when the component has no arguments, response or error to show.
LiveProgress
A single quiet line of live progress text ("Reading documents · Encoding 57%") meant to be updated many times a second while a long-running task streams its progress. The line and its tooltip are built once and never rebuilt: an update writes the new text into the elements already on screen, so a stream of updates reads as one line changing rather than a component being replaced.
public sealed class LiveProgress : ComponentBase<LiveProgress, HTMLElement>A single quiet line of live progress text ("Reading documents · Encoding 57%") meant to be updated many times a second while a long-running task streams its progress. The line, and the tooltip carrying its untruncated text, are built once and never rebuilt: an update writes the new text into the elements already on screen. Nothing fades in or out, so a stream of updates reads as one line changing rather than a component being replaced. It also survives a host that refreshes itself by diffing a freshly built layout onto the DOM already on screen (DeltaComponent, and so ChatMessage): the line element the reader sees is then the one an earlier layout built and the diff keeps patching, so the tooltip follows the text of the element rather than the text a given instance was told to show, and the line opts its subtree out of the fade the diff puts on patched content.
- Namespace
- Tesserae
- Inheritance
- ComponentBase<LiveProgress, HTMLElement> → LiveProgress
Constructors
| Name | Description |
|---|---|
| LiveProgress | Initializes a new instance of this class. |
Properties
| Name | Description |
|---|---|
| Text | Gets the text currently shown by the component. Read from the element rather than remembered, so it stays true under a host that patches the line's text itself. |
| IsEmpty | Returns a value indicating whether the component currently shows any progress. |
public string TextGets the text currently shown by the component. Read from the element rather than remembered, so it stays true under a host that patches the line's text itself.
Methods
| Name | Description |
|---|---|
| SetText | Writes the given progress into the line already on screen. An empty text hides the line without removing it, so the next update brings back the same element. |
| Clear | Clears the progress, hiding the line until the next update. |
| Stream | Streams the progress from the given observable: every value it publishes is written into the line. The subscription is released when the component leaves the DOM, and a second call replaces the source this component follows. |
| StopStreaming | Stops following the observable passed to Stream, keeping the text it last wrote. |
| WithTooltip | Configures whether hovering the line shows its full text as a tooltip. On by default, as the line is ellipsized to the width it is given. |
| NoTooltip | Configures the component to show no tooltip when hovered. |
| Render | Renders the component's root HTML element. |
public LiveProgress SetText(string text)Writes the given progress into the line already on screen. An empty text hides the line without removing it, so the next update brings back the same element.
public LiveProgress Clear()Clears the progress, hiding the line until the next update.
public LiveProgress Stream(IObservable<string> source)Streams the progress from the given observable: every value it publishes is written into the line. The subscription is released when the component leaves the DOM, and a second call replaces the source this component follows.
public LiveProgress StopStreaming()Stops following the observable passed to Stream, keeping the text it last wrote.
public LiveProgress WithTooltip(bool value = true)Configures whether hovering the line shows its full text as a tooltip. On by default, as the line is ellipsized to the width it is given.
public LiveProgress NoTooltip()Configures the component to show no tooltip when hovered.