UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

57 lines • 2.68 kB
/** * The sandbox's look, as a React Native app gives it. Like the server's `genui.sandbox` config * (`GET <agent>/config`), but each asset may come inline (`runtime`, `source`) instead of by url. */ export interface NativeSandboxConfig { /** Pass the app's theme in. Default true. */ theme?: boolean; /** * Tailwind (v4 `@tailwindcss/browser`): its source inline (`runtime`), or a `url` to fetch it from * (the agent's public asset — relative urls resolve against `baseUrl`); `css` is extra Tailwind * directives (`@theme`, `@custom-variant`) the app's stylesheet declares. */ tailwind?: { runtime?: string; url?: string; css?: string; }; /** The kit bundle (JSX views): its source inline, or a `url` to fetch it from. */ kit?: { source?: string; url?: string; }; /** The app's compiled styles (`genuiSandboxKit({ styles })`): inline, or a `url` to fetch them from. */ css?: { source?: string; url?: string; }; } /** * Where the config comes from: an object; a url answering `GET <agent>/config` (or the sandbox * config itself); a loader (your own authenticated client); `false` — theme only. Default: `GET * <baseUrl>/config` when there is a `baseUrl`, else theme only. */ export type NativeSandboxConfigSource = NativeSandboxConfig | string | false | (() => NativeSandboxConfig | undefined | Promise<NativeSandboxConfig | undefined>); export type FetchLike = (input: string, init?: { headers?: Record<string, string>; credentials?: 'omit' | 'same-origin' | 'include'; }) => Promise<{ ok: boolean; text(): Promise<string>; }>; /** Fetch a text once per url, shared by every sandbox in the app; a failure is forgotten. */ export declare function loadNativeSandboxText(url: string, fetchImpl?: FetchLike | undefined, init?: Parameters<FetchLike>[1]): Promise<string | null>; /** The sandbox's config: `undefined` (and `loading`) until it is known. */ export declare function useNativeSandboxConfig(source: NativeSandboxConfigSource | undefined, baseUrl: string | undefined, fetchImpl: FetchLike | undefined): { config: NativeSandboxConfig | undefined; loading: boolean; }; /** * An asset's text: inline if given, else fetched from its url (resolved against `baseUrl`). * `undefined` while it loads, `null` when it could not be had (or there is none). */ export declare function useNativeSandboxAsset(asset: { inline?: string | undefined; url?: string | undefined; } | undefined, baseUrl: string | undefined, fetchImpl: FetchLike | undefined): string | null | undefined; //# sourceMappingURL=sandbox-assets.d.ts.map