@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
18 lines • 1.3 kB
JavaScript
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
import { readUiActionText, uiActionSummary } from '../../../genui/actions.js';
/**
* A user message that is a UI action — a sandbox's `agent.send`, a component's button — drawn as a
* compact chip: what the user said, then a few of its values (`Recalculate · people: 4, tip: 15`).
* The message's JSON block stays in the message (the model reads it); the chip's `title` lists every
* value for a reader who wants them. A string that is not a UI action draws as itself.
*
* Unstyled: `className`, or the `[data-ui-action]` attribute, is the hook.
*/
export function UiActionChip({ action, maxValues, className, children }) {
const parsed = typeof action === 'string' ? readUiActionText(action) : action;
if (parsed === null)
return _jsx(_Fragment, { children: action });
const values = Object.keys(parsed.context).length > 0 ? JSON.stringify(parsed.context) : '';
return (_jsx("span", { className: className, "data-ui-action": parsed.name, "data-ui-action-source": parsed.source, title: values.length > 0 ? `${parsed.text}\n${values}` : parsed.text, children: children ?? uiActionSummary(parsed, maxValues !== undefined ? { maxValues } : {}) }));
}
//# sourceMappingURL=ui-action-chip.js.map