@salesforce/plugin-agent 1.32.0 → 1.32.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -47
- package/lib/agentActivation.d.ts +15 -1
- package/lib/agentActivation.js +68 -13
- package/lib/agentActivation.js.map +1 -1
- package/lib/commands/agent/activate.d.ts +8 -2
- package/lib/commands/agent/activate.js +16 -4
- package/lib/commands/agent/activate.js.map +1 -1
- package/lib/commands/agent/deactivate.d.ts +4 -2
- package/lib/commands/agent/deactivate.js +5 -3
- package/lib/commands/agent/deactivate.js.map +1 -1
- package/lib/commands/agent/generate/template.d.ts +45 -2
- package/lib/commands/agent/generate/template.js +261 -8
- package/lib/commands/agent/generate/template.js.map +1 -1
- package/messages/agent.activate.md +12 -6
- package/messages/agent.activation.md +4 -0
- package/messages/agent.deactivate.md +2 -2
- package/messages/agent.generate.template.md +50 -9
- package/oclif.manifest.json +499 -474
- package/package.json +4 -4
- package/schemas/agent-activate.json +19 -0
- package/schemas/agent-deactivate.json +19 -0
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Connection } from '@salesforce/core';
|
|
3
|
+
import type { BotTemplate, GenAiPlannerBundle, BotDialogGroup, ConversationDefinitionGoal, ConversationVariable, GenAiFunction, GenAiPlugin, GenAiPlannerFunctionDef } from '@salesforce/types/metadata';
|
|
4
|
+
/** Global function names that are allowed to be emitted in genAiFunctions when converting localActionLinks. */
|
|
5
|
+
export declare const ALLOWED_GLOBAL_FUNCTIONS: Set<string>;
|
|
3
6
|
export type GenAiPlannerBundleExt = {
|
|
4
|
-
GenAiPlannerBundle:
|
|
7
|
+
GenAiPlannerBundle: GenAiPlannerBundle & {
|
|
5
8
|
botTemplate?: string;
|
|
9
|
+
localActionLinks?: GenAiPlannerFunctionDef[];
|
|
10
|
+
localTopicLinks: GenAiPlannerFunctionDef[];
|
|
11
|
+
localTopics?: GenAiPlugin[];
|
|
12
|
+
plannerActions?: GenAiFunction[];
|
|
6
13
|
};
|
|
7
14
|
};
|
|
8
15
|
export type BotTemplateExt = {
|
|
@@ -28,8 +35,44 @@ export default class AgentGenerateTemplate extends SfCommand<AgentGenerateTempla
|
|
|
28
35
|
static readonly requiresProject = true;
|
|
29
36
|
static readonly flags: {
|
|
30
37
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
38
|
+
'source-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
31
39
|
'agent-version': import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
|
|
32
40
|
'agent-file': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
41
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
33
42
|
};
|
|
34
43
|
run(): Promise<AgentGenerateTemplateResult>;
|
|
35
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Extracts local topics and actions from the GenAiPlannerBundle and validates that each has a `source` reference to its global counterpart.
|
|
47
|
+
* Throws if any local topic or action is missing `source`.
|
|
48
|
+
*
|
|
49
|
+
* @param genAiPlannerBundleMetaJson - The GenAiPlannerBundle metadata to read from
|
|
50
|
+
* @returns { localTopics, localActions } - The local topics and the flattened local actions from all plugins
|
|
51
|
+
*/
|
|
52
|
+
export declare const getLocalAssets: (genAiPlannerBundleMetaJson: GenAiPlannerBundleExt) => {
|
|
53
|
+
localTopics: GenAiPlugin[];
|
|
54
|
+
localActions: GenAiFunction[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Uses localTopics' <source> elements to identify global assets, then updates topic links (genAiPlugins), action links (genAiFunctions), attributeMappings and ruleExpressionAssignments.
|
|
58
|
+
* Replaces localTopicLinks with genAiPlugins. Replaces localActionLinks with genAiFunctions.
|
|
59
|
+
*/
|
|
60
|
+
export declare const replaceReferencesToGlobalAssets: (genAiPlannerBundleMetaJson: GenAiPlannerBundleExt, localTopics: GenAiPlugin[]) => void;
|
|
61
|
+
/** Tooling API row for GenAiPluginDefinition or GenAiFunctionDefinition (shared field shape). */
|
|
62
|
+
export type GenAiBundledAssetToolingRecord = {
|
|
63
|
+
Id: string;
|
|
64
|
+
DeveloperName: string;
|
|
65
|
+
NamespacePrefix: string | null;
|
|
66
|
+
IsLocal: boolean;
|
|
67
|
+
Source: string | null;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Validates that local topics and actions reference global assets that exist in the source org.
|
|
71
|
+
*
|
|
72
|
+
* @param localTopics - Local genAiPlugin topics (GenAiPluginDefinition)
|
|
73
|
+
* @param localActions - Local genAiFunction actions (GenAiFunctionDefinition)
|
|
74
|
+
* @param connection - Source org connection (--source-org)
|
|
75
|
+
* @param namespaceFromSfdxProject - `namespace` from sfdx-project.json (empty if unset)
|
|
76
|
+
* @param warn - Command warn hook (e.g. `(msg) => this.warn(msg)`)
|
|
77
|
+
*/
|
|
78
|
+
export declare const validateGlobalAssets: (localTopics: GenAiPlugin[], localActions: GenAiFunction[], connection: Connection, namespaceFromSfdxProject: string, warn: (msg: string) => void) => Promise<void>;
|
|
@@ -14,10 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { join, dirname, basename, resolve } from 'node:path';
|
|
17
|
-
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { cpSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
|
|
18
18
|
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
19
|
-
import { Messages, SfError } from '@salesforce/core';
|
|
19
|
+
import { Messages, SfError, validateSalesforceId } from '@salesforce/core';
|
|
20
20
|
import { XMLParser, XMLBuilder } from 'fast-xml-parser';
|
|
21
|
+
/** Global function names that are allowed to be emitted in genAiFunctions when converting localActionLinks. */
|
|
22
|
+
export const ALLOWED_GLOBAL_FUNCTIONS = new Set(['EmployeeCopilot__AnswerQuestionsWithKnowledge']);
|
|
21
23
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
24
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.template');
|
|
23
25
|
export default class AgentGenerateTemplate extends SfCommand {
|
|
@@ -27,6 +29,9 @@ export default class AgentGenerateTemplate extends SfCommand {
|
|
|
27
29
|
static requiresProject = true;
|
|
28
30
|
static flags = {
|
|
29
31
|
'api-version': Flags.orgApiVersion(),
|
|
32
|
+
'source-org': Flags.requiredOrg({
|
|
33
|
+
summary: messages.getMessage('flags.source-org.summary'),
|
|
34
|
+
}),
|
|
30
35
|
'agent-version': Flags.integer({
|
|
31
36
|
summary: messages.getMessage('flags.agent-version.summary'),
|
|
32
37
|
required: true,
|
|
@@ -37,10 +42,14 @@ export default class AgentGenerateTemplate extends SfCommand {
|
|
|
37
42
|
required: true,
|
|
38
43
|
exists: true,
|
|
39
44
|
}),
|
|
45
|
+
'output-dir': Flags.directory({
|
|
46
|
+
summary: messages.getMessage('flags.output-dir.summary'),
|
|
47
|
+
char: 'r',
|
|
48
|
+
}),
|
|
40
49
|
};
|
|
41
50
|
async run() {
|
|
42
51
|
const { flags } = await this.parse(AgentGenerateTemplate);
|
|
43
|
-
const { 'agent-file': agentFile, 'agent-version': botVersion } = flags;
|
|
52
|
+
const { 'agent-file': agentFile, 'agent-version': botVersion, 'output-dir': outputDir } = flags;
|
|
44
53
|
if (!agentFile.endsWith('.bot-meta.xml')) {
|
|
45
54
|
throw new SfError(messages.getMessage('error.invalid-agent-file'));
|
|
46
55
|
}
|
|
@@ -50,24 +59,39 @@ export default class AgentGenerateTemplate extends SfCommand {
|
|
|
50
59
|
// Since we are cloning the GenAiPlannerBundle, we need to use a different name than the Agent (Bot) we started with
|
|
51
60
|
// We will use this name for the BotTemplate also to make it clear they are related
|
|
52
61
|
const finalFilename = `${botName}_v${botVersion}_Template`;
|
|
53
|
-
//
|
|
62
|
+
// Base path for reading metadata
|
|
54
63
|
const basePath = resolve(dirname(agentFile), '..', '..');
|
|
55
64
|
const botDir = join(basePath, 'bots', botName);
|
|
56
65
|
const genAiPlannerBundleDir = join(basePath, 'genAiPlannerBundles');
|
|
57
|
-
const
|
|
66
|
+
const outputBase = resolve(outputDir ?? basePath);
|
|
67
|
+
const botTemplateDir = join(outputBase, 'botTemplates');
|
|
68
|
+
const outputGenAiPlannerBundleDir = join(outputBase, 'genAiPlannerBundles');
|
|
58
69
|
const botTemplateFilePath = join(botTemplateDir, `${finalFilename}.botTemplate-meta.xml`);
|
|
59
|
-
const clonedGenAiPlannerBundleFilePath = join(
|
|
70
|
+
const clonedGenAiPlannerBundleFilePath = join(outputGenAiPlannerBundleDir, finalFilename, `${finalFilename}.genAiPlannerBundle`);
|
|
60
71
|
// Parse the metadata files as JSON
|
|
61
72
|
const botJson = xmlToJson(join(botDir, `${botName}.bot-meta.xml`), parser);
|
|
73
|
+
if (botJson.Bot.agentDSLEnabled) {
|
|
74
|
+
throw new SfError(messages.getMessage('error.nga-agent-not-supported'));
|
|
75
|
+
}
|
|
62
76
|
const botVersionJson = xmlToJson(join(botDir, `v${botVersion}.botVersion-meta.xml`), parser);
|
|
63
77
|
const genAiPlannerBundleMetaJson = xmlToJson(join(genAiPlannerBundleDir, botName, `${botName}.genAiPlannerBundle`), parser);
|
|
64
78
|
// Modify the metadata files for final output
|
|
65
|
-
// TODO: Confirm this name (might be conversationDefinitionPlanners)
|
|
66
79
|
genAiPlannerBundleMetaJson.GenAiPlannerBundle.botTemplate = finalFilename;
|
|
80
|
+
// Process local assets
|
|
81
|
+
const { localTopics, localActions } = getLocalAssets(genAiPlannerBundleMetaJson);
|
|
82
|
+
const connection = flags['source-org'].getConnection(flags['api-version']);
|
|
83
|
+
const resolvedProjectConfig = await this.project.resolveProjectConfig();
|
|
84
|
+
const namespaceFromSfdxProject = typeof resolvedProjectConfig.namespace === 'string' ? resolvedProjectConfig.namespace : '';
|
|
85
|
+
await validateGlobalAssets(localTopics, localActions, connection, namespaceFromSfdxProject, (msg) => this.warn(msg));
|
|
86
|
+
replaceReferencesToGlobalAssets(genAiPlannerBundleMetaJson, localTopics);
|
|
67
87
|
const botTemplate = convertBotToBotTemplate(botJson, botVersionJson, finalFilename, botTemplateFilePath);
|
|
68
88
|
// Build and save the metadata files
|
|
69
89
|
jsonToXml(clonedGenAiPlannerBundleFilePath, genAiPlannerBundleMetaJson, builder);
|
|
70
90
|
jsonToXml(botTemplateFilePath, botTemplate, builder);
|
|
91
|
+
if (outputDir) {
|
|
92
|
+
const copiedDirs = copyMetadataDirsIfPresent(basePath, outputBase);
|
|
93
|
+
this.warn(messages.getMessage('warn.copied-asset-directories', [copiedDirs.join(', ')]));
|
|
94
|
+
}
|
|
71
95
|
this.log(`\nSaved BotTemplate to:\n - ${botTemplateFilePath}`);
|
|
72
96
|
this.log(`Saved GenAiPlannerBundle to:\n - ${clonedGenAiPlannerBundleFilePath}`);
|
|
73
97
|
return {
|
|
@@ -134,7 +158,236 @@ const jsonToXml = (filename, json, builder) => {
|
|
|
134
158
|
writeFileSync(filename, xml);
|
|
135
159
|
}
|
|
136
160
|
catch (error) {
|
|
137
|
-
throw new SfError(`Failed save to file: ${filename}
|
|
161
|
+
throw new SfError(`Failed save to file: ${filename}`, undefined, undefined, undefined, error);
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Extracts local topics and actions from the GenAiPlannerBundle and validates that each has a `source` reference to its global counterpart.
|
|
166
|
+
* Throws if any local topic or action is missing `source`.
|
|
167
|
+
*
|
|
168
|
+
* @param genAiPlannerBundleMetaJson - The GenAiPlannerBundle metadata to read from
|
|
169
|
+
* @returns { localTopics, localActions } - The local topics and the flattened local actions from all plugins
|
|
170
|
+
*/
|
|
171
|
+
export const getLocalAssets = (genAiPlannerBundleMetaJson) => {
|
|
172
|
+
const rawLocalTopics = genAiPlannerBundleMetaJson.GenAiPlannerBundle.localTopics;
|
|
173
|
+
const localTopics = Array.isArray(rawLocalTopics) ? rawLocalTopics : rawLocalTopics ? [rawLocalTopics] : [];
|
|
174
|
+
const localTopicsWithoutSource = localTopics.filter((topic) => !topic.source);
|
|
175
|
+
if (localTopicsWithoutSource.length > 0) {
|
|
176
|
+
throw new SfError(messages.getMessage('error.local-topics-without-source', [
|
|
177
|
+
localTopicsWithoutSource.map((topic) => topic.developerName).join(', '),
|
|
178
|
+
]));
|
|
179
|
+
}
|
|
180
|
+
const actionsFromPlugins = localTopics.flatMap((plugin) => Array.isArray(plugin.localActions) ? plugin.localActions : plugin.localActions ? [plugin.localActions] : []);
|
|
181
|
+
const plannerBundle = genAiPlannerBundleMetaJson.GenAiPlannerBundle;
|
|
182
|
+
const plannerActions = Array.isArray(plannerBundle.plannerActions)
|
|
183
|
+
? plannerBundle.plannerActions
|
|
184
|
+
: plannerBundle.plannerActions
|
|
185
|
+
? [plannerBundle.plannerActions]
|
|
186
|
+
: [];
|
|
187
|
+
// localActions are the actions from the plugins and the plannerActions
|
|
188
|
+
const localActions = [...actionsFromPlugins, ...plannerActions];
|
|
189
|
+
if (localActions.length > 0) {
|
|
190
|
+
const localActionsWithoutSource = localActions.filter((action) => !action.source);
|
|
191
|
+
if (localActionsWithoutSource.length > 0) {
|
|
192
|
+
throw new SfError(messages.getMessage('error.local-actions-without-source', [
|
|
193
|
+
localActionsWithoutSource.map((action) => action.developerName ?? action.fullName).join(', '),
|
|
194
|
+
]));
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return { localTopics, localActions };
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Uses localTopics' <source> elements to identify global assets, then updates topic links (genAiPlugins), action links (genAiFunctions), attributeMappings and ruleExpressionAssignments.
|
|
201
|
+
* Replaces localTopicLinks with genAiPlugins. Replaces localActionLinks with genAiFunctions.
|
|
202
|
+
*/
|
|
203
|
+
export const replaceReferencesToGlobalAssets = (genAiPlannerBundleMetaJson, localTopics) => {
|
|
204
|
+
const plannerBundle = genAiPlannerBundleMetaJson.GenAiPlannerBundle;
|
|
205
|
+
const localToGlobalAssets = buildLocalToGlobalAssetMap(localTopics, plannerBundle);
|
|
206
|
+
// replace localTopicLinks with global genAiPlugins
|
|
207
|
+
plannerBundle.genAiPlugins = localTopics.map((topic) => ({
|
|
208
|
+
genAiPluginName: topic.source,
|
|
209
|
+
}));
|
|
210
|
+
plannerBundle.localTopicLinks = [];
|
|
211
|
+
// Replaces localActionLinks with global genAiFunctions (only names in ALLOWED_GLOBAL_FUNCTIONS are emitted)
|
|
212
|
+
if (plannerBundle.localActionLinks) {
|
|
213
|
+
plannerBundle.localActionLinks = Array.isArray(plannerBundle.localActionLinks)
|
|
214
|
+
? plannerBundle.localActionLinks
|
|
215
|
+
: [plannerBundle.localActionLinks];
|
|
216
|
+
const allowedFound = new Set();
|
|
217
|
+
for (const link of plannerBundle.localActionLinks) {
|
|
218
|
+
const globalName = localToGlobalAssets.get(link.genAiFunctionName);
|
|
219
|
+
if (globalName && ALLOWED_GLOBAL_FUNCTIONS.has(globalName)) {
|
|
220
|
+
allowedFound.add(globalName);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
plannerBundle.genAiFunctions = [...allowedFound].map((genAiFunctionName) => ({ genAiFunctionName }));
|
|
224
|
+
plannerBundle.localActionLinks = [];
|
|
225
|
+
}
|
|
226
|
+
// replace references in attributeMappings and ruleExpressionAssignments
|
|
227
|
+
const attributeMappings = Array.isArray(plannerBundle.attributeMappings)
|
|
228
|
+
? plannerBundle.attributeMappings
|
|
229
|
+
: plannerBundle.attributeMappings
|
|
230
|
+
? [plannerBundle.attributeMappings]
|
|
231
|
+
: [];
|
|
232
|
+
for (const mapping of attributeMappings) {
|
|
233
|
+
if (mapping.attributeName) {
|
|
234
|
+
mapping.attributeName = replaceLocalRefsWithGlobal(mapping.attributeName, localToGlobalAssets);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const ruleExpressionAssignments = Array.isArray(plannerBundle.ruleExpressionAssignments)
|
|
238
|
+
? plannerBundle.ruleExpressionAssignments
|
|
239
|
+
: plannerBundle.ruleExpressionAssignments
|
|
240
|
+
? [plannerBundle.ruleExpressionAssignments]
|
|
241
|
+
: [];
|
|
242
|
+
for (const assignment of ruleExpressionAssignments) {
|
|
243
|
+
if (assignment.targetName) {
|
|
244
|
+
assignment.targetName = replaceLocalRefsWithGlobal(assignment.targetName, localToGlobalAssets);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
// delete local assets from the GenAiPlannerBundle
|
|
248
|
+
plannerBundle.localTopics = [];
|
|
249
|
+
plannerBundle.plannerActions = [];
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Queries the org for asset definitions (topics or functions) and checks each local asset against the results.
|
|
253
|
+
*
|
|
254
|
+
* @returns { referenceAssetFromManagedPackage, notFoundInOrg } - The assets that are referenced from managed packages and the assets that are not found in the org
|
|
255
|
+
*/
|
|
256
|
+
const doValidateGlobalAssets = async (connection, toolingObject, localAssets, namespaceFromSfdxProject) => {
|
|
257
|
+
const developerNames = localAssets.map((asset) => asset.fullName).filter((name) => Boolean(name));
|
|
258
|
+
// early return if there are no local assets to validate
|
|
259
|
+
if (developerNames.length === 0) {
|
|
260
|
+
return { referenceAssetFromManagedPackage: new Set(), notFoundInOrg: new Set() };
|
|
261
|
+
}
|
|
262
|
+
const inClause = developerNames.map((name) => `'${String(name).replace(/'/g, "''")}'`).join(', ');
|
|
263
|
+
const soql = `SELECT Id, DeveloperName, NamespacePrefix, IsLocal, Source FROM ${toolingObject} WHERE DeveloperName IN (${inClause}) OR IsLocal = false`;
|
|
264
|
+
const result = await connection.tooling.query(soql);
|
|
265
|
+
const assetDefinitionResults = result.records ?? [];
|
|
266
|
+
const localAssetDefinitionResults = new Map();
|
|
267
|
+
const globalAssetDefinitionById = new Map();
|
|
268
|
+
for (const assetDefinition of assetDefinitionResults) {
|
|
269
|
+
if (assetDefinition.IsLocal) {
|
|
270
|
+
localAssetDefinitionResults.set(assetDefinition.DeveloperName, assetDefinition);
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
globalAssetDefinitionById.set(assetDefinition.Id, assetDefinition);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const referenceAssetFromManagedPackage = new Set();
|
|
277
|
+
const notFoundInOrg = new Set();
|
|
278
|
+
for (const localAsset of localAssets) {
|
|
279
|
+
const currentAssetDefinitionResult = localAssetDefinitionResults.get(localAsset.fullName);
|
|
280
|
+
if (currentAssetDefinitionResult) {
|
|
281
|
+
// if source is an Id, it means it's pointing to a record created in the org
|
|
282
|
+
// if is not an Id, it means it's pointing to an standard OOTB Salesforce asset
|
|
283
|
+
if (validateSalesforceId(currentAssetDefinitionResult.Source)) {
|
|
284
|
+
const globalAsset = globalAssetDefinitionById.get(currentAssetDefinitionResult.Source);
|
|
285
|
+
if (globalAsset) {
|
|
286
|
+
// find global assets from managed packages other than the one in the sfdx-project.json
|
|
287
|
+
if (globalAsset.NamespacePrefix && globalAsset.NamespacePrefix !== namespaceFromSfdxProject) {
|
|
288
|
+
referenceAssetFromManagedPackage.add(`${globalAsset.NamespacePrefix}__${globalAsset.DeveloperName}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
notFoundInOrg.add(currentAssetDefinitionResult.Source);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// OOTB Salesforce asset, no validation needed
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
notFoundInOrg.add(localAsset.fullName);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
referenceAssetFromManagedPackage,
|
|
305
|
+
notFoundInOrg,
|
|
306
|
+
};
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Validates that local topics and actions reference global assets that exist in the source org.
|
|
310
|
+
*
|
|
311
|
+
* @param localTopics - Local genAiPlugin topics (GenAiPluginDefinition)
|
|
312
|
+
* @param localActions - Local genAiFunction actions (GenAiFunctionDefinition)
|
|
313
|
+
* @param connection - Source org connection (--source-org)
|
|
314
|
+
* @param namespaceFromSfdxProject - `namespace` from sfdx-project.json (empty if unset)
|
|
315
|
+
* @param warn - Command warn hook (e.g. `(msg) => this.warn(msg)`)
|
|
316
|
+
*/
|
|
317
|
+
export const validateGlobalAssets = async (localTopics, localActions, connection, namespaceFromSfdxProject, warn) => {
|
|
318
|
+
const topicsValidationResults = await doValidateGlobalAssets(connection, 'GenAiPluginDefinition', localTopics, namespaceFromSfdxProject);
|
|
319
|
+
const actionsValidationResults = await doValidateGlobalAssets(connection, 'GenAiFunctionDefinition', localActions, namespaceFromSfdxProject);
|
|
320
|
+
const referenceAssetFromManagedPackage = new Set([
|
|
321
|
+
...topicsValidationResults.referenceAssetFromManagedPackage,
|
|
322
|
+
...actionsValidationResults.referenceAssetFromManagedPackage,
|
|
323
|
+
]);
|
|
324
|
+
const notFoundInOrg = new Set([
|
|
325
|
+
...topicsValidationResults.notFoundInOrg,
|
|
326
|
+
...actionsValidationResults.notFoundInOrg,
|
|
327
|
+
]);
|
|
328
|
+
if (referenceAssetFromManagedPackage.size > 0) {
|
|
329
|
+
warn(messages.getMessage('warn.reference-asset-from-managed-package', [
|
|
330
|
+
[...referenceAssetFromManagedPackage].join(', '),
|
|
331
|
+
]));
|
|
332
|
+
}
|
|
333
|
+
if (notFoundInOrg.size > 0) {
|
|
334
|
+
throw new SfError(messages.getMessage('error.global-asset-not-found', [[...notFoundInOrg].join(', ')]));
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
/**
|
|
338
|
+
* Builds a map from local asset names to their global (source) asset names.
|
|
339
|
+
*
|
|
340
|
+
* @param localTopics - The local topics of the GenAiPlannerBundle
|
|
341
|
+
* @param plannerBundle - The GenAiPlannerBundle (for plannerActions)
|
|
342
|
+
* @returns A map of local asset name → global asset name
|
|
343
|
+
*/
|
|
344
|
+
const buildLocalToGlobalAssetMap = (localTopics, plannerBundle) => {
|
|
345
|
+
const map = new Map();
|
|
346
|
+
for (const topic of localTopics) {
|
|
347
|
+
map.set(topic.fullName, topic.source);
|
|
348
|
+
const actions = Array.isArray(topic.localActions)
|
|
349
|
+
? topic.localActions
|
|
350
|
+
: topic.localActions
|
|
351
|
+
? [topic.localActions]
|
|
352
|
+
: [];
|
|
353
|
+
for (const action of actions) {
|
|
354
|
+
map.set(action.fullName, action.source);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const plannerActions = Array.isArray(plannerBundle.plannerActions)
|
|
358
|
+
? plannerBundle.plannerActions
|
|
359
|
+
: plannerBundle.plannerActions
|
|
360
|
+
? [plannerBundle.plannerActions]
|
|
361
|
+
: [];
|
|
362
|
+
for (const action of plannerActions) {
|
|
363
|
+
if (action.fullName && action.source)
|
|
364
|
+
map.set(action.fullName, action.source);
|
|
365
|
+
}
|
|
366
|
+
return map;
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* Replaces dot-separated local refs with global names. Each segment is replaced only when present in localToGlobalMap;
|
|
370
|
+
* segments not in localToGlobalMap (e.g. namespace, attribute path) are kept as-is. Used for attributeName, targetName, expression.
|
|
371
|
+
*/
|
|
372
|
+
const replaceLocalRefsWithGlobal = (value, localToGlobalMap) => value
|
|
373
|
+
.split('.')
|
|
374
|
+
.map((segment) => localToGlobalMap.get(segment) ?? segment)
|
|
375
|
+
.join('.');
|
|
376
|
+
/**
|
|
377
|
+
* Copies metadata directories from the source package (basePath) to the output directory if they exist.
|
|
378
|
+
* Source path is derived from the agent file location (e.g. force-app/main/default).
|
|
379
|
+
*/
|
|
380
|
+
const copyMetadataDirsIfPresent = (basePath, outputBase) => {
|
|
381
|
+
const METADATA_DIRS_TO_COPY = ['genAiPlugins', 'genAiFunctions', 'classes', 'flows', 'genAiPromptTemplates'];
|
|
382
|
+
const copiedDirs = [];
|
|
383
|
+
for (const dirName of METADATA_DIRS_TO_COPY) {
|
|
384
|
+
const srcDir = join(basePath, dirName);
|
|
385
|
+
if (existsSync(srcDir) && statSync(srcDir).isDirectory()) {
|
|
386
|
+
const destDir = join(outputBase, dirName);
|
|
387
|
+
cpSync(srcDir, destDir, { recursive: true });
|
|
388
|
+
copiedDirs.push(dirName);
|
|
389
|
+
}
|
|
138
390
|
}
|
|
391
|
+
return copiedDirs;
|
|
139
392
|
};
|
|
140
393
|
//# sourceMappingURL=template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqCxD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,yBAAyB,CAAC,CAAC;AAM9F,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAAsC;IAChF,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GA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AAgB,EAAE,UAAkB,EAAY,EAAE;IACnF,MAAM,qBAAqB,GAAG,CAAC,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IAC7G,MAAM,UAAU,GAAG,EAAE,CAAC;IACtB,KAAK,MAAM,OAAO,IAAI,qBAAqB,EAAE,CAAC;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;YACzD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;YAC1C,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7C,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
|
|
@@ -4,23 +4,29 @@ Activate an agent in an org.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
Activating an agent makes it immediately available to your users.
|
|
7
|
+
Activating an agent makes it immediately available to your users. A published agent must be active before you can preview it with the "agent preview" CLI command or VS Code. Agents can have multiple versions; only one version can be active at a time.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
If you run the command without the --api-name or --version flags, the command provides a list of agent API names and versions for you to choose from. Use the flags to specify the exact agent and version without being prompted. If you use the --json flag and not --version, then the latest agent version is automatically activated.
|
|
10
|
+
|
|
11
|
+
The value of the --version flag is always a number, corresponding to the "vX" part of the "BotVersion" metadata in your project. For example, if you have a force-app/main/default/bots/My_Agent/v4.botVersion-meta.xml file in your project, then you activate this version with the "--version 4" flag.
|
|
10
12
|
|
|
11
13
|
# examples
|
|
12
14
|
|
|
13
|
-
- Activate an agent in your default target org by being prompted:
|
|
15
|
+
- Activate an agent in your default target org by being prompted for both its API name and version:
|
|
14
16
|
|
|
15
17
|
<%= config.bin %> <%= command.id %>
|
|
16
18
|
|
|
17
|
-
- Activate an agent with API name Resort_Manager in the org with alias "my-org":
|
|
19
|
+
- Activate version 2 of an agent with API name Resort_Manager in the org with alias "my-org":
|
|
18
20
|
|
|
19
|
-
<%= config.bin %> <%= command.id %> --api-name Resort_Manager --target-org my-org
|
|
21
|
+
<%= config.bin %> <%= command.id %> --api-name Resort_Manager --version 2 --target-org my-org
|
|
20
22
|
|
|
21
23
|
# flags.api-name.summary
|
|
22
24
|
|
|
23
|
-
API name of the agent to activate.
|
|
25
|
+
API name of the agent to activate; if not specified, the command provides a list that you choose from.
|
|
26
|
+
|
|
27
|
+
# flags.version.summary
|
|
28
|
+
|
|
29
|
+
Version number of the agent to activate; if not specified, the command provides a list that you choose from.
|
|
24
30
|
|
|
25
31
|
# error.missingRequiredFlags
|
|
26
32
|
|
|
@@ -13,3 +13,7 @@ Agent %s has been deleted and can't be activated.
|
|
|
13
13
|
# error.agentIsDefault
|
|
14
14
|
|
|
15
15
|
Agent %s is the default Agentforce agent in your org and you can't change its activation status.
|
|
16
|
+
|
|
17
|
+
# error.noVersionsAvailable
|
|
18
|
+
|
|
19
|
+
No versions available to %s. All versions are already in the target state.
|
|
@@ -6,7 +6,7 @@ Deactivate an agent in an org.
|
|
|
6
6
|
|
|
7
7
|
Deactivating an agent makes it unavailable to your users. To make changes to an agent, such as adding or removing topics or actions, you must deactivate it. You can't preview an agent with the "agent preview" CLI command or VS Code if it's deactivated.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
If you run the command without the --api-name flag, the command provides a list of agent API names for you to choose from. Use the flag to specify the exact agent without being prompted.
|
|
10
10
|
|
|
11
11
|
# examples
|
|
12
12
|
|
|
@@ -20,7 +20,7 @@ You must know the agent's API name to deactivate it; you can either be prompted
|
|
|
20
20
|
|
|
21
21
|
# flags.api-name.summary
|
|
22
22
|
|
|
23
|
-
API name of the agent to deactivate.
|
|
23
|
+
API name of the agent to deactivate; if not specified, the command provides a list that you choose from.
|
|
24
24
|
|
|
25
25
|
# error.missingRequiredFlags
|
|
26
26
|
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
Generate an agent template from an existing agent in your DX project so you can then package the template in a managed package.
|
|
3
|
+
Generate an agent template from an existing agent in your DX project so you can then package the template in a second-generation managed package.
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
WARNING: This command doesn't work for agents that were created from an Agent Script file. In other words, you can't currently package an agent template for agents that use Agent Script.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
At a high-level, agents are defined by the Bot, BotVersion, and GenAiPlannerBundle metadata types. The GenAiPlannerBundle type in turn defines the agent's topics and actions. This command uses the metadata files for these three types, located in your local DX project, to generate a BotTemplate metadata file for a specific agent (Bot). You then use the BotTemplate metadata file, along with the GenAiPlannerBundle metadata file that references the BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Use the --agent-file flag to specify the relative or full pathname of the Bot metadata file, such as force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml. A single Bot can have multiple BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion metadata file must exist locally. For example, if you specify "--agent-version 4", then the file force-app/main/default/bots/My_Awesome_Agent/v4.botVersion-meta.xml must exist.
|
|
12
|
+
|
|
13
|
+
The new BotTemplate metadata file is generated in the "botTemplates" directory in the output directory specified with the --output-dir flag, and has the name <Agent_API_name>\_v<Version>\_Template.botTemplate-meta.xml, such as my-package/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of the generated files when it completes.
|
|
14
|
+
|
|
15
|
+
See "Develop and Package Agent Templates Using Scratch Orgs" (https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/dev2gp_package_agent_templates.htm) for details about the complete process, which includes using a scratch org to create and test the agent, retrieving the agent metadata to your DX project, running this command to create the agent template, and then packaging the template.
|
|
12
16
|
|
|
13
17
|
# examples
|
|
14
18
|
|
|
15
|
-
- Generate an agent template from
|
|
19
|
+
- Generate an agent template from the My_Awesome_Agent Bot metadata file in your DX project and save the BotTemplate and GenAiPlannerBundle to the specified directory; use version 1 of the agent:
|
|
16
20
|
|
|
17
|
-
<%= config.bin %> <%= command.id %> --agent-file force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
|
|
21
|
+
<%= config.bin %> <%= command.id %> --agent-file force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1 --output-dir my-package --source-org my-scratch-org
|
|
18
22
|
|
|
19
23
|
# flags.agent-version.summary
|
|
20
24
|
|
|
@@ -24,13 +28,21 @@ Version of the agent (BotVersion).
|
|
|
24
28
|
|
|
25
29
|
Path to an agent (Bot) metadata file.
|
|
26
30
|
|
|
31
|
+
# flags.output-dir.summary
|
|
32
|
+
|
|
33
|
+
Directory where the generated BotTemplate and GenAiPlannerBundle files are saved.
|
|
34
|
+
|
|
35
|
+
# flags.source-org.summary
|
|
36
|
+
|
|
37
|
+
Username or alias of the namespaced scratch org that contains the agent which this template is based on.
|
|
38
|
+
|
|
27
39
|
# error.invalid-agent-file
|
|
28
40
|
|
|
29
|
-
Invalid Agent file. Must be a Bot metadata file. Example: force-app/main/default/bots/MyBot/MyBot.bot-meta.xml
|
|
41
|
+
Invalid Agent file. Must be a Bot metadata file. Example: force-app/main/default/bots/MyBot/MyBot.bot-meta.xml.
|
|
30
42
|
|
|
31
43
|
# error.no-entry-dialog
|
|
32
44
|
|
|
33
|
-
No entryDialog found in BotVersion file.
|
|
45
|
+
No entryDialog found in the BotVersion metadata file.
|
|
34
46
|
|
|
35
47
|
# error.invalid-bot-type
|
|
36
48
|
|
|
@@ -38,8 +50,37 @@ The 'type' attribute of this Bot metadata component XML file can't have a value
|
|
|
38
50
|
|
|
39
51
|
# error.no-label
|
|
40
52
|
|
|
41
|
-
No label found in Agent (Bot) file: %s.
|
|
53
|
+
No label found in Agent (Bot) metadata file: %s.
|
|
42
54
|
|
|
43
55
|
# error.no-ml-domain
|
|
44
56
|
|
|
45
57
|
No botMlDomain found in Agent (Bot) file: %s.
|
|
58
|
+
|
|
59
|
+
# error.local-topics-without-source
|
|
60
|
+
|
|
61
|
+
The local topic (genAiPlugin) you're trying to include in the agent template doesn't have a reference to a global topic. All topics in the agent template must be global assets defined in the Agent Asset Library in the source org that contains the agent that the template is based on.
|
|
62
|
+
%s.
|
|
63
|
+
|
|
64
|
+
# error.local-actions-without-source
|
|
65
|
+
|
|
66
|
+
The local action (genAiFunction) you're trying to include in the agent template doesn't have a reference to a global action. All actions in the agent template must be global assets defined in the Agent Asset Library in the source org that contains the agent that the template is based on.
|
|
67
|
+
%s.
|
|
68
|
+
|
|
69
|
+
# warn.reference-asset-from-managed-package
|
|
70
|
+
|
|
71
|
+
The local asset (genAiPlugin or genAiFunction) you're including in the agent template references an asset from a managed package. Make sure that the managed package is defined as dependency in the sfdx-project.json file:
|
|
72
|
+
%s.
|
|
73
|
+
|
|
74
|
+
# error.global-asset-not-found
|
|
75
|
+
|
|
76
|
+
The following assets (genAiPlugin or genAiFunction) you're including in the agent template reference an asset that is not present in the source org:
|
|
77
|
+
%s.
|
|
78
|
+
|
|
79
|
+
# error.nga-agent-not-supported
|
|
80
|
+
|
|
81
|
+
This command doesn't work for agents that were created from an Agent Script file. In other words, you can't currently package an agent template for agents that use Agent Script.
|
|
82
|
+
|
|
83
|
+
# warn.copied-asset-directories
|
|
84
|
+
|
|
85
|
+
The following directories have been copied to the target path. Review their contents and remove any unnecessary assets:
|
|
86
|
+
%s.
|