@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
23 lines • 1.37 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { useContext } from 'react';
import { Text } from 'react-native';
import { GenuiProvider as BaseGenuiProvider, GenuiActionContext, } from '../../react/core/genui/generative-ui.js';
/** The item's persisted text, as a `<Text>` — the web default draws a `<span>`, which RN cannot. */
export const nativeGenuiFallback = (problem) => problem.item.fallbackText !== undefined ? _jsx(Text, { children: problem.item.fallbackText }) : null;
/**
* `GenuiProvider` for React Native: the same provider (the same shared contexts — `GenerativeUI`
* and `useGenerativeUI` read it as on the web), with `fallback` defaulting to
* {@link nativeGenuiFallback} so an unknown or failing component never draws a DOM element.
*/
export function GenuiProvider({ fallback, ...props }) {
return _jsx(BaseGenuiProvider, { ...props, fallback: fallback ?? nativeGenuiFallback });
}
/** Where UI actions go — a sandbox's `agent.send(…)`. Typically the chat's `sendUiAction`. */
export function GenuiActionProvider({ onAction, children, }) {
return _jsx(GenuiActionContext.Provider, { value: onAction, children: children });
}
/** The enclosing {@link GenuiActionProvider}'s handler, or `null` outside one. */
export function useGenuiAction() {
return useContext(GenuiActionContext);
}
//# sourceMappingURL=provider.js.map