@salesforce/agents
Version: 
Client side APIs for working with Salesforce agents
71 lines (70 loc) • 1.93 kB
TypeScript
import { Connection } from '@salesforce/core';
type ApiStatus = {
    status: 'UP' | 'DOWN';
};
type Href = {
    href: string;
};
export type AgentPreviewError = {
    status: number;
    path: string;
    requestId: string;
    error: string;
    message: string;
    timestamp: number;
};
export type AgentPreviewMessageLinks = {
    self: Href | null;
    messages: Href | null;
    session: Href | null;
    end: Href | null;
};
export type MessageType = 'Inform' | 'TextChunk' | 'ProgressIndicator' | 'Inquire' | 'Confirm' | 'Failure' | 'Escalate' | 'SessionEnded' | 'EndOfTurn' | 'Error';
export type AgentPreviewMessage = {
    type: MessageType;
    id: string;
    feedbackId: string;
    planId: string;
    isContentSafe: boolean;
    message: string;
    result: {
        type: string;
        property: string;
        value: any;
    };
    citedReferences: {
        type: string;
        value: string;
    };
};
export type AgentPreviewStartResponse = {
    sessionId: string;
    _links: AgentPreviewMessageLinks;
    messages: AgentPreviewMessage[];
};
export type AgentPreviewSendResponse = {
    messages: AgentPreviewMessage[];
    _links: AgentPreviewMessageLinks;
};
export type AgentPreviewEndMessage = {
    type: string;
    id: string;
    reason: string;
    feedbackId: string;
};
export type AgentPreviewEndResponse = {
    messages: AgentPreviewEndMessage[];
    _links: AgentPreviewMessageLinks;
};
type EndReason = 'UserRequest' | 'Transfer' | 'Expiration' | 'Error' | 'Other';
export declare class AgentPreview {
    private apiBase;
    private instanceUrl;
    private maybeMock;
    constructor(connection: Connection);
    start(botId: string): Promise<AgentPreviewStartResponse>;
    send(sessionId: string, message: string): Promise<AgentPreviewSendResponse>;
    end(sessionId: string, reason: EndReason): Promise<AgentPreviewEndResponse>;
    status(): Promise<ApiStatus>;
}
export {};