@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
39 lines • 2.24 kB
TypeScript
import type { UIMessage } from 'ai';
import type { MessageAttachment } from '../../../index.js';
/** How a renderer is likely to show a file. */
export type MessageFileKind = 'image' | 'pdf' | 'text' | 'audio' | 'video' | 'other';
/** One file on a message, live or replayed, with what a renderer needs to decide how to show it. */
export interface MessageFile {
url: string;
mediaType: string;
/** The original name, or `null` when the part carried none. */
filename: string | null;
kind: MessageFileKind;
/** Lower-case extension from the name (`'pdf'`), or `null`. */
extension: string | null;
/** The stored media id — present on files replayed from history (`StoredMessage.attachments`). */
mediaId: string | null;
}
/** The {@link MessageFileKind} of a MIME type. */
export declare function fileKind(mediaType: string): MessageFileKind;
/**
* An uploaded attachment as the {@link MessageFile} it is once its message is sent — so a message
* still waiting (in the queue, in the composer) draws its files with the same code a sent one does.
*/
export declare function attachmentFile(attachment: MessageAttachment): MessageFile;
/**
* The files on a message — the user's attachments (live, or replayed from `StoredMessage.attachments`
* by `storedMessageToUiMessage`) and any the model produced — in part order. Data only: pair it with
* your own thumbnails/links.
*/
export declare function messageFiles(message: Pick<UIMessage, 'parts'>): MessageFile[];
/**
* Whether `file` matches an `accept` list in the `<input accept>` grammar: MIME types
* (`application/pdf`), wildcards (`image/*`) and extensions (`.csv`). An empty list accepts all.
*/
export declare function acceptsFile(accept: string | readonly string[] | undefined, file: Pick<File, 'name' | 'type'>): boolean;
/** Files carried by a paste — screenshots and copied files. Text-only pastes give `[]`. */
export declare function filesFromClipboard(data: DataTransfer | null | undefined): File[];
/** Whether a drag carries files (as opposed to text or a link) — gate your drop highlight on it. */
export declare function dragHasFiles(data: DataTransfer | null | undefined): boolean;
//# sourceMappingURL=files.d.ts.map