UNPKG

@promptbook/remote-server

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

51 lines (50 loc) 1.65 kB
import type { Arrayable } from 'type-fest'; import type { really_any } from '../utils/organization/really_any'; import type { string_markdown } from './string_markdown'; import type { id, string_date_iso8601 } from './string_token'; /** * A generic message structure for various communication channels */ export type Message<TParticipant> = { /** * Unique identifier of the message */ readonly id?: id; /** * Date when the message was created */ readonly createdAt?: Date | string_date_iso8601; /** * The communication channel of the message */ readonly channel?: 'PROMPTBOOK_CHAT' | 'EMAIL' | 'SMS' | 'WHATSAPP' | 'TELEGRAM' | 'SIGNAL' | string | 'UNKNOWN'; /** * Is the message send from the Promptbook or to the Promptbook */ readonly direction?: 'INBOUND' | 'OUTBOUND' | 'INTERNAL' | 'INITIAL'; /** * Who sent the message */ readonly sender: TParticipant; /** * Who are the recipients of the message */ readonly recipients?: Readonly<Arrayable<TParticipant>>; /** * The content of the message as markdown * * Note: We are converting all message content to markdown for consistency */ readonly content: string_markdown; /** * The thread identifier the message belongs to * * - `null` means the message is not part of any thread * - `undefined` means that we don't know if the message is part of a thread or not */ readonly threadId?: id | null; /** * Arbitrary metadata associated with the message */ readonly metadata?: Readonly<Record<string, really_any>>; };