UNPKG

@adonis-agora/agent

Version:

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

110 lines • 5.59 kB
import type { SandboxKitDocs } from '../sandbox-kit.js'; import { type CssVocabulary, type TailwindTokens } from '../sandbox-styles.js'; /** Extensions a style entry may have. */ export declare const STYLE_EXTENSIONS: string[]; /** * A stylesheet import as CSS resolves it: relative, absolute, an alias of the app's Vite config, or * a package (`bootstrap/dist/css/bootstrap.css`, `shadcn/tailwind.css`, `@fontsource-variable/geist` * — its `exports` under the `style` condition, its `style` field). */ export declare function resolveStyleImport(spec: string, fromDir: string, alias?: Record<string, string>): string | undefined; /** One stylesheet the app's styles are made of, as written. */ export interface StyleSource { file: string; text: string; } /** * The style entries and every stylesheet they `@import` (plain CSS imports are followed through * packages; Sass/Less partials are read for detection only). The `tailwindcss` package itself is * not read (the frame brings its own runtime). */ export declare function collectStyleSources(entries: readonly string[], options?: { alias?: Record<string, string>; }): StyleSource[]; /** The `styles` option as files: paths and globs relative to the root, or package stylesheets. */ export declare function resolveStyleEntries(root: string, styles: string | readonly string[]): { files: string[]; missing: string[]; }; /** * The app's style entries, found from its Vite setup — what `genuiSandboxKit()` uses without * `styles`: the stylesheets among `build.rollupOptions.input` (the AdonisJS plugin puts its * `entrypoints` there) or linked from `index.html`, and those the script entries import directly * (`import './app.css'`). CSS modules are left out. */ export declare function discoverStyleEntries(root: string, options?: { input?: unknown; }): string[]; /** The app's styles, compiled and understood. */ export interface SandboxKitStyles { /** Compiled CSS (fonts and images inlined). */ css: string; hash: string; /** The files the styles are made of (entries and what they import) — what to watch. */ files: string[]; tailwind?: { version: 3 | 4; tokens: TailwindTokens; directives: string; }; vocabulary?: CssVocabulary; /** Custom properties on the styles' root. */ vars: Record<string, string>; /** Set once purged ({@link purgeSandboxKitStyles}): the size before, in characters. */ purged?: { before: number; }; } export interface BuildSandboxKitStylesOptions { root: string; entries: readonly string[]; resolve?: Record<string, unknown>; css?: Record<string, unknown>; publicDir?: string | false; plugins?: unknown[]; inlineAssetLimit?: number; inlineAssetBudget?: number; warn?: (message: string) => void; /** Compile with Vite. Default true; false reads the files as they are (plain CSS only). */ compile?: boolean; } /** Aliases of a resolved Vite `resolve` (object or array form) as `find → replacement` strings. */ export declare function stringAliases(resolveOptions: Record<string, unknown> | undefined): Record<string, string>; /** * Compile the style entries with the app's Vite CSS pipeline and work out what they are: Tailwind * (its version, tokens, and the directives the frame's runtime needs — v3's config theme mapped to * v4), or plain CSS (its class vocabulary). `null` with no entries. */ export declare function buildSandboxKitStyles(options: BuildSandboxKitStylesOptions): Promise<SandboxKitStyles | null>; /** What `genuiSandboxKit({ purge })` takes: on/off, or the classes to keep whatever the purge finds. */ export type SandboxKitPurgeOption = boolean | { /** Classes kept even when the kit does not use them (exact names, or patterns). */ safelist?: readonly (string | RegExp)[]; }; /** * The compiled styles with what the frame can never use taken out (`genuiSandboxKit({ purge })`, * on by default): * * - Tailwind v4: the `utilities` layer keeps only the utilities the kit's own code names — the * frame's Tailwind runtime generates every other one the model writes, from the app's theme; the * theme, base and components layers, `@font-face`, `@keyframes` and `@property` stay whole; * - Tailwind v3 (no layers in its output): every rule naming a class the kit does not use goes — * the model writes utilities, which the runtime generates, and is told nothing of the rest; * - any other CSS: only generated CSS-modules classes the kit does not use go — every other class * is in the vocabulary the model is told, so it stays. * * `kitCode` is the kit bundle (what the components can put on an element); `safelist` keeps more. */ export declare function purgeSandboxKitStyles(styles: SandboxKitStyles, options?: { kitCode?: string; safelist?: readonly (string | RegExp)[]; }): SandboxKitStyles; /** The docs half of compiled styles (what the model is told). */ export declare function stylesDocs(styles: SandboxKitStyles | null): Pick<SandboxKitDocs, 'tailwind' | 'vocabulary'>; /** `stylesDocs`: a file (markdown, text) relative to the root, or the guidance itself. */ export declare function readStylesGuide(root: string, stylesDocs: string | undefined): string | undefined; /** A fresh instance of the app's Tailwind Vite plugin, when the app has one and the kit has none. */ export declare function tailwindVitePluginFor(root: string, appPlugins: readonly { name?: string; }[], given: readonly unknown[]): Promise<unknown[]>; //# sourceMappingURL=styles.d.ts.map