@salesforce/agents
Version:
Client side APIs for working with Salesforce agents
71 lines (70 loc) • 2.54 kB
TypeScript
import { SfProject } from '@salesforce/core';
import { type AgentPreviewEndResponse, AgentPreviewInterface, type AgentPreviewSendResponse, type CompileAgentScriptResponse, ExtendedAgentJobSpec, PlannerResponse, PreviewMetadata, PublishAgent, ScriptAgentOptions } from '../types';
import { TranscriptEntry } from '../utils';
import { AgentBase } from './agentBase';
export declare class ScriptAgent extends AgentBase {
private options;
preview: AgentPreviewInterface & {
setMockMode: (mockMode: 'Mock' | 'Live Test') => void;
};
private mockMode;
private agentScriptContent;
private agentJson;
private readonly apiBase;
private readonly aabDirectory;
private readonly metaContent;
private readonly agentFilePath;
constructor(options: ScriptAgentOptions);
/**
* Creates an AiAuthoringBundle directory, .script file, and -meta.xml file
*
* @returns Promise<void>
* @beta
* @param options {
* project: SfProject;
* bundleApiName: string;
* outputDir?: string;
* agentSpec?: ExtendedAgentJobSpec;
*}
*/
static createAuthoringBundle(options: {
project: SfProject;
bundleApiName: string;
outputDir?: string;
agentSpec?: ExtendedAgentJobSpec;
}): Promise<void>;
refreshContent(): Promise<void>;
getTrace(planId: string): Promise<PlannerResponse>;
/**
* Compiles AgentScript returning agent JSON when successful, otherwise the compile errors are returned.
*
* @returns Promise<CompileAgentScriptResponse> The raw API response
* @beta
*/
compile(): Promise<CompileAgentScriptResponse>;
/**
* Publish an AgentJson representation to the org
*
* @beta
* @returns {Promise<PublishAgentJsonResponse>} The publish response
*/
publish(skipMetadataRetrieve?: boolean): Promise<PublishAgent>;
getHistoryFromDisc(sessionId?: string): Promise<{
metadata: PreviewMetadata | null;
transcript: TranscriptEntry[];
traces: PlannerResponse[];
}>;
/**
* Ending is not required
* this will save all the transcripts to disc
*
* @returns `AgentPreviewEndResponse`
*/
endSession(): Promise<AgentPreviewEndResponse>;
getAgentIdForStorage(): string;
protected canApexDebug(): boolean;
protected handleApexDebuggingSetup(): Promise<void>;
protected sendMessage(message: string): Promise<AgentPreviewSendResponse>;
private setMockMode;
private startPreview;
}