UNPKG

@promptbook/remote-client

Version:

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

136 lines (135 loc) 4.54 kB
import type { AvatarVisualId } from '../../avatars/types/AvatarVisualDefinition'; import type { string_agent_hash, string_agent_name, string_agent_permanent_id } from '../../types/string_agent_name'; import type { string_agent_url } from '../../types/string_agent_url'; import type { string_fonts } from '../../types/string_markdown'; import type { string_color } from '../../types/string_person_fullname'; import type { string_url_image } from '../../types/string_url_image'; /** * Unified parameter representation that supports two different notations: * 1. @Parameter - single word parameter starting with @ * 2. {parameterName} or {parameter with multiple words} or {parameterName: description text} * Both notations represent the same syntax feature - parameters */ export type BookParameter = { /** * The raw text of the parameter as it appears in the source */ text: string; /** * The notation used for this parameter */ notation: 'at' | 'brace'; /** * The parameter name (without @ or {}) */ name: string; /** * Optional description for {parameterName: description} notation */ description?: string; }; /** * Capability of the agent * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc. */ export type AgentCapability = { /** * The type of the capability */ type: 'browser' | 'search-engine' | 'knowledge' | 'timeout' | 'time' | 'user-location' | 'inheritance' | 'import' | 'image-generator' | 'team' | 'email' | 'popup' | 'privacy' | 'project' | 'calendar' | 'wallet'; /** * The label to display for this capability */ label: string; /** * The name of the icon to display for this capability */ iconName: string; /** * Optional link to another agent * This is used for 'inheritance' and 'import' types */ agentUrl?: string_agent_url; }; /** * Information about agent basic. */ export type AgentBasicInformation = { /** * Name of the agent * This is the first line of the agent source */ agentName: string_agent_name; /** * Hash of the agent source for integrity verification */ agentHash: string_agent_hash; /** * Unique identifier of the agent * This is a random base58 string assigned by the server */ permanentId?: string_agent_permanent_id; /** * Optional description of the agent * This is derived from the last `GOAL` / `GOALS` commitment, * falling back to deprecated `PERSONA` / `PERSONAE` for backward compatibility. */ personaDescription: string | null; /** * The initial message shown to the user when the chat starts * This is the line starting with "INITIAL MESSAGE" */ initialMessage: string | null; /** * Metadata commitments parsed from META lines * Each META commitment has the format "META TYPE content" * When there are multiple meta commitments of the same type, later overrides earlier */ meta: { fullname?: string; description?: string; disclaimer?: string; inputPlaceholder?: string; messageSuffix?: string; image?: string_url_image; avatar?: AvatarVisualId; domain?: string; font?: string_fonts; color?: string_color; voice?: string; [key: string]: string | undefined; }; /** * Links found in the agent source * This corresponds to META LINK commitments */ links: Array<string_agent_url>; /** * Parameters found in the agent source * Supports two different notations for the same syntax feature: * - @Parameter (single word parameter starting with @) * - {parameterName} or {parameter with multiple words} or {parameterName: description text} */ parameters: Array<BookParameter>; /** * Capabilities of the agent * This is parsed from commitments like USE BROWSER, USE SEARCH ENGINE, KNOWLEDGE, etc. */ capabilities: Array<AgentCapability>; /** * List of sample conversations (question/answer pairs) */ samples: Array<{ question: string | null; answer: string; }>; /** * Knowledge sources (documents, URLs) used by the agent * This is parsed from KNOWLEDGE commitments * Used for resolving document citations when the agent references sources */ knowledgeSources: Array<{ url: string; filename: string; }>; };