UNPKG

@adonis-agora/agent

Version:

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

86 lines • 5.08 kB
import type { Plugin } from 'vite'; import type { SandboxKitDescriptor } from '../sandbox-kit.js'; import { type SandboxKitSourceOptions } from './files.js'; import { type SandboxKitPurgeOption } from './styles.js'; export interface GenuiSandboxKitOptions extends SandboxKitSourceOptions { /** * A name, for several kits in one app (variants of the design system, a tenant's own, an A/B * test): each `genuiSandboxKit({ name })` builds its own kit, served under * `/@genui-sandbox-kit/<name>/`, written to its own descriptor and listed under its own manifest * keys ({@link sandboxKitManifestKeys}); the server picks one by that name (`kitName`). Unnamed: * the app's one kit. */ name?: string; /** * The app's style entry files — plain CSS, Sass/Less, PostCSS, CSS modules, a `.scss` importing * Bootstrap, a Tailwind v3/v4 stylesheet… — compiled with the app's Vite CSS pipeline and inlined * into the frame. Paths or globs relative to the root, or package stylesheets * (`bootstrap/dist/css/bootstrap.css`). Default: the stylesheets among the app's Vite entrypoints. */ styles?: string | readonly string[]; /** Guidance on the styles for the model (a markdown/text file, or the text itself). */ stylesDocs?: string; /** Where the dev descriptor is written, relative to the Vite root. */ descriptor?: string; /** The tsconfig the kit's types are read with. Default: the nearest to the kit. */ tsconfig?: string; /** A TypeScript module with the compiler API, when the project's own has none (TypeScript 7). */ typescript?: unknown; /** * Extra Vite plugins for compiling the styles and the components (a CSS-in-JS compiler, a * PostCSS-less Tailwind setup…). The app's `@tailwindcss/vite` is added on its own. */ plugins?: unknown[]; /** Largest font or image a stylesheet's `url()` inlines, in bytes. Default 128 KB; larger ones are left out (warned). */ inlineAssetLimit?: number; /** Most bytes of fonts and images inlined in all. Default 1 MB. */ inlineAssetBudget?: number; /** * Take out of the compiled styles what the frame can never use (default on): with Tailwind v4, * every utility the kit's own code does not name (the frame's Tailwind runtime generates the * ones the model writes; the theme, base and components layers stay); with Tailwind v3, every * rule naming a class the kit does not use; with other CSS, generated CSS-modules classes the kit * does not use. `false` ships the whole stylesheet; `{ safelist }` keeps more classes (names or * patterns) — say, a Tailwind plugin's utilities the model is told about in `stylesDocs`. */ purge?: SandboxKitPurgeOption; } /** The library-specific defaults the shared plugin is built with. */ export interface GenuiSandboxKitDefaults { /** Default dev descriptor path, relative to the Vite root. */ descriptor: string; /** App modules importing the renderer get the HMR bridge: a test on their source. */ rendererImport: RegExp; } /** Where the dev server serves the assets. */ export declare const SANDBOX_KIT_DEV_PREFIX = "@genui-sandbox-kit/"; /** The Vite manifest keys the build lists them under. */ export declare const SANDBOX_KIT_MANIFEST_KEYS: { readonly kit: 'genui-sandbox-kit.js'; readonly css: 'genui-sandbox-kit.css'; readonly tailwind: 'genui-sandbox-tailwind.js'; readonly descriptor: 'genui-sandbox-kit.json'; }; /** The event a page gets (`window`) when the kit was rebuilt in dev. */ export declare const SANDBOX_KIT_UPDATE_EVENT = "genui-sandbox-kit:update"; /** The manifest keys a named kit's assets are listed under (`genui-sandbox-kit.<name>.js`…). */ export declare function sandboxKitManifestKeys(name?: string): Record<keyof typeof SANDBOX_KIT_MANIFEST_KEYS, string>; /** A named kit's descriptor path, from the unnamed one's (`genui_sandbox_kit.json` → `genui_sandbox_kit.<name>.json`). */ export declare function sandboxKitDescriptorPath(path: string, name?: string): string; /** Throws unless a kit name is a plain identifier (it goes into urls and file names). */ export declare function assertSandboxKitName(name: unknown): asserts name is string | undefined; /** What the plugin exposes to the server process it runs in (`plugin.api`). */ export interface GenuiSandboxKitApi { /** The kit's name (`genuiSandboxKit({ name })`), `undefined` for the unnamed one. */ readonly kitName?: string | undefined; /** The current descriptor (dev), once the first build is done. */ descriptor(): SandboxKitDescriptor | null; /** Resolves when the first build is done. */ ready(): Promise<void>; } /** The plugin object: a Vite plugin with the {@link GenuiSandboxKitApi} on `api`. */ export type GenuiSandboxKitPlugin = Plugin & { api: GenuiSandboxKitApi; }; export declare function createGenuiSandboxKitPlugin(options: GenuiSandboxKitOptions, defaults: GenuiSandboxKitDefaults): GenuiSandboxKitPlugin; //# sourceMappingURL=plugin.d.ts.map