UNPKG

@salesforce/agents

Version:

Client side APIs for working with Salesforce agents

55 lines 2.05 kB
"use strict"; /* * Copyright 2025, Salesforce, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.AgentPreviewBase = void 0; const core_1 = require("@salesforce/core"); const maybe_mock_1 = require("./maybe-mock"); /** * Abstract base class for agent runners that provides common functionality * for interacting with agents through the Einstein AI Agent API. */ class AgentPreviewBase { connection; apexTraceFlag; logger; maybeMock; apexDebugMode; constructor(config) { if (!config.connection) { throw new Error('Connection is required'); } // Protected properties const connection = config.connection; const logger = config.logger ?? core_1.Logger.childFromRoot(this.constructor.name); // Initialize protected properties this.connection = connection; this.logger = logger; this.maybeMock = new maybe_mock_1.MaybeMock(connection); } /** * Enable or disable Apex Debug Mode, which will enable trace flags for the Bot user * and create apex debug logs for use within VS Code's Apex Replay Debugger. * * @param enable Whether to enable or disable Apex Debug Mode. */ setApexDebugMode(enable) { this.apexDebugMode = enable; this.logger.debug(`Apex Debug Mode is now ${enable ? 'enabled' : 'disabled'}`); } } exports.AgentPreviewBase = AgentPreviewBase; //# sourceMappingURL=agentPreviewBase.js.map