@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
42 lines • 2.2 kB
TypeScript
import type { SandboxKitDocs } from './sandbox-kit.js';
/**
* Why a UI tool call was refused (or warned about) — what telemetry counts.
*
* `shape`: the input does not fit the schema (a missing wrapper, a wrong type); `syntax`: the code
* does not parse; `missing-app`: JSX without `App`; `bridge`: a bridge other than `agent.send`;
* `unknown-component` / `unknown-prop`: not in the kit's docs; `unavailable`: the component is not
* offered here; `other`: anything else (a thrown handler, the emit failing).
*/
export type GenuiErrorCategory = 'shape' | 'syntax' | 'missing-app' | 'bridge' | 'unknown-component' | 'unknown-prop' | 'unavailable' | 'other';
/** One problem with a sandbox's code, where it is. */
export interface SandboxCodeIssue {
/** `error` refuses the call; `warning` is reported with the result. */
severity: 'error' | 'warning';
category: GenuiErrorCategory;
field: 'jsx' | 'html' | 'jsFunctions' | 'jsExpressions';
/** The `jsExpressions` entry. */
index?: number;
/** 1-based, in the field's own text. */
line?: number;
/** 1-based. */
column?: number;
/** What is wrong and the one-line fix. */
message: string;
}
export interface ValidateSandboxCodeOptions {
/** The view may be JSX (a kit bundle draws it). Default: what `kit.jsx` says. */
jsx?: boolean;
/** The kit's docs: `<Component>`s and their props are checked against them. */
kit?: SandboxKitDocs;
/** Origins the policy opens for scripts (`<script src>` from elsewhere is refused). */
scriptOrigins?: readonly string[];
}
/** `jsx line 12:5: …` / `jsExpressions[2] line 1:3: …` — the issue as the model reads it. */
export declare function formatSandboxIssue(issue: SandboxCodeIssue): string;
/**
* The sandbox's code, checked: errors first (each refuses the call), then warnings. JSX when the
* kit allows it and the view is in `jsx` (the longer of `jsx`/`html`, as the renderer decides);
* otherwise the HTML and its scripts.
*/
export declare function validateSandboxCode(props: Record<string, unknown>, options?: ValidateSandboxCodeOptions): Promise<SandboxCodeIssue[]>;
//# sourceMappingURL=sandbox-validate.d.ts.map