@salesforce/plugin-agent 1.32.1 → 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 CHANGED
@@ -126,7 +126,7 @@ EXAMPLES
126
126
  $ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
127
127
  ```
128
128
 
129
- _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/activate.ts)_
129
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/activate.ts)_
130
130
 
131
131
  ## `sf agent create`
132
132
 
@@ -193,7 +193,7 @@ EXAMPLES
193
193
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
194
194
  ```
195
195
 
196
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/create.ts)_
196
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/create.ts)_
197
197
 
198
198
  ## `sf agent deactivate`
199
199
 
@@ -234,7 +234,7 @@ EXAMPLES
234
234
  $ sf agent deactivate --api-name Resort_Manager --target-org my-org
235
235
  ```
236
236
 
237
- _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/deactivate.ts)_
237
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/deactivate.ts)_
238
238
 
239
239
  ## `sf agent generate agent-spec`
240
240
 
@@ -341,7 +341,7 @@ EXAMPLES
341
341
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
342
342
  ```
343
343
 
344
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/generate/agent-spec.ts)_
344
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/generate/agent-spec.ts)_
345
345
 
346
346
  ## `sf agent generate authoring-bundle`
347
347
 
@@ -418,18 +418,22 @@ EXAMPLES
418
418
  other-package-dir/main/default --target-org my-dev-org
419
419
  ```
420
420
 
421
- _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/generate/authoring-bundle.ts)_
421
+ _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/generate/authoring-bundle.ts)_
422
422
 
423
423
  ## `sf agent generate template`
424
424
 
425
- Generate an agent template from an existing agent in your DX project so you can then package the template in a managed package.
425
+ 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.
426
426
 
427
427
  ```
428
428
  USAGE
429
- $ sf agent generate template --agent-version <value> -f <value> [--json] [--flags-dir <value>] [--api-version <value>]
429
+ $ sf agent generate template -o <value> --agent-version <value> -f <value> [--json] [--flags-dir <value>] [--api-version
430
+ <value>] [-r <value>]
430
431
 
431
432
  FLAGS
432
433
  -f, --agent-file=<value> (required) Path to an agent (Bot) metadata file.
434
+ -o, --source-org=<value> (required) Username or alias of the namespaced scratch org that contains the agent which
435
+ this template is based on.
436
+ -r, --output-dir=<value> Directory where the generated BotTemplate and GenAiPlannerBundle files are saved.
433
437
  --agent-version=<value> (required) Version of the agent (BotVersion).
434
438
  --api-version=<value> Override the api version used for api requests made by this command
435
439
 
@@ -438,35 +442,44 @@ GLOBAL FLAGS
438
442
  --json Format output as json.
439
443
 
440
444
  DESCRIPTION
441
- Generate an agent template from an existing agent in your DX project so you can then package the template in a managed
442
- package.
445
+ Generate an agent template from an existing agent in your DX project so you can then package the template in a
446
+ second-generation managed package.
447
+
448
+ WARNING: This command doesn't work for agents that were created from an Agent Script file. In other words, you can't
449
+ currently package an agent template for agents that use Agent Script.
443
450
 
444
451
  At a high-level, agents are defined by the Bot, BotVersion, and GenAiPlannerBundle metadata types. The
445
452
  GenAiPlannerBundle type in turn defines the agent's topics and actions. This command uses the metadata files for these
446
- three types, located in your local DX project, to generate a BotTemplate file for a specific agent (Bot). You then use
447
- the BotTemplate file, along with the GenAiPlannerBundle file that references the BotTemplate, to package the template
448
- in a managed package that you can share between orgs or on AppExchange.
453
+ three types, located in your local DX project, to generate a BotTemplate metadata file for a specific agent (Bot). You
454
+ then use the BotTemplate metadata file, along with the GenAiPlannerBundle metadata file that references the
455
+ BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.
449
456
 
450
457
  Use the --agent-file flag to specify the relative or full pathname of the Bot metadata file, such as
451
458
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml. A single Bot can have multiple
452
- BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion file must exist
453
- locally. For example, if you specify "--agent-version 4", then the file
459
+ BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion metadata file must
460
+ exist locally. For example, if you specify "--agent-version 4", then the file
454
461
  force-app/main/default/bots/My_Awesome_Agent/v4.botVersion-meta.xml must exist.
455
462
 
456
- The new BotTemplate file is generated in the "botTemplates" directory in your local package directory, and has the
457
- name <Agent_API_name>_v<Version>_Template.botTemplate-meta.xml, such as
458
- force-app/main/default/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full
459
- pathname of the generated files when it completes.
463
+ The new BotTemplate metadata file is generated in the "botTemplates" directory in the output directory specified with
464
+ the --output-dir flag, and has the name <Agent_API_name>\_v<Version>\_Template.botTemplate-meta.xml, such as
465
+ my-package/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of
466
+ the generated files when it completes.
467
+
468
+ See "Develop and Package Agent Templates Using Scratch Orgs"
469
+ (https://developer.salesforce.com/docs/atlas.en-us.pkg2_dev.meta/pkg2_dev/dev2gp_package_agent_templates.htm) for
470
+ details about the complete process, which includes using a scratch org to create and test the agent, retrieving the
471
+ agent metadata to your DX project, running this command to create the agent template, and then packaging the template.
460
472
 
461
473
  EXAMPLES
462
- Generate an agent template from a Bot metadata file in your DX project that corresponds to the My_Awesome_Agent
463
- agent; use version 1 of the agent.
474
+ Generate an agent template from the My_Awesome_Agent Bot metadata file in your DX project and save the BotTemplate
475
+ and GenAiPlannerBundle to the specified directory; use version 1 of the agent:
464
476
 
465
477
  $ sf agent generate template --agent-file \
466
- force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
478
+ force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1 --output-dir \
479
+ my-package --source-org my-scratch-org
467
480
  ```
468
481
 
469
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/generate/template.ts)_
482
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/generate/template.ts)_
470
483
 
471
484
  ## `sf agent generate test-spec`
472
485
 
@@ -531,7 +544,7 @@ EXAMPLES
531
544
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
532
545
  ```
533
546
 
534
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/generate/test-spec.ts)_
547
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/generate/test-spec.ts)_
535
548
 
536
549
  ## `sf agent preview`
537
550
 
@@ -604,7 +617,7 @@ EXAMPLES
604
617
  $ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
605
618
  ```
606
619
 
607
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview.ts)_
620
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/preview.ts)_
608
621
 
609
622
  ## `sf agent preview end`
610
623
 
@@ -659,7 +672,7 @@ EXAMPLES
659
672
  $ sf agent preview end --authoring-bundle My_Local_Agent
660
673
  ```
661
674
 
662
- _See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview/end.ts)_
675
+ _See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/preview/end.ts)_
663
676
 
664
677
  ## `sf agent preview send`
665
678
 
@@ -717,7 +730,7 @@ EXAMPLES
717
730
  $ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
718
731
  ```
719
732
 
720
- _See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview/send.ts)_
733
+ _See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/preview/send.ts)_
721
734
 
722
735
  ## `sf agent preview sessions`
723
736
 
@@ -750,7 +763,7 @@ EXAMPLES
750
763
  $ sf agent preview sessions
751
764
  ```
752
765
 
753
- _See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview/sessions.ts)_
766
+ _See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/preview/sessions.ts)_
754
767
 
755
768
  ## `sf agent preview start`
756
769
 
@@ -807,7 +820,7 @@ EXAMPLES
807
820
  $ sf agent preview start --api-name My_Published_Agent
808
821
  ```
809
822
 
810
- _See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview/start.ts)_
823
+ _See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/preview/start.ts)_
811
824
 
812
825
  ## `sf agent publish authoring-bundle`
813
826
 
@@ -856,7 +869,7 @@ EXAMPLES
856
869
  $ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
857
870
  ```
858
871
 
859
- _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/publish/authoring-bundle.ts)_
872
+ _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/publish/authoring-bundle.ts)_
860
873
 
861
874
  ## `sf agent test create`
862
875
 
@@ -911,7 +924,7 @@ EXAMPLES
911
924
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
912
925
  ```
913
926
 
914
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/test/create.ts)_
927
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/test/create.ts)_
915
928
 
916
929
  ## `sf agent test list`
917
930
 
@@ -946,7 +959,7 @@ EXAMPLES
946
959
  $ sf agent test list --target-org my-org
947
960
  ```
948
961
 
949
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/test/list.ts)_
962
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/test/list.ts)_
950
963
 
951
964
  ## `sf agent test results`
952
965
 
@@ -1012,7 +1025,7 @@ FLAG DESCRIPTIONS
1012
1025
  expression when using custom evaluations.
1013
1026
  ```
1014
1027
 
1015
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/test/results.ts)_
1028
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/test/results.ts)_
1016
1029
 
1017
1030
  ## `sf agent test resume`
1018
1031
 
@@ -1085,7 +1098,7 @@ FLAG DESCRIPTIONS
1085
1098
  expression when using custom evaluations.
1086
1099
  ```
1087
1100
 
1088
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/test/resume.ts)_
1101
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/test/resume.ts)_
1089
1102
 
1090
1103
  ## `sf agent test run`
1091
1104
 
@@ -1159,7 +1172,7 @@ FLAG DESCRIPTIONS
1159
1172
  expression when using custom evaluations.
1160
1173
  ```
1161
1174
 
1162
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/test/run.ts)_
1175
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/test/run.ts)_
1163
1176
 
1164
1177
  ## `sf agent validate authoring-bundle`
1165
1178
 
@@ -1206,6 +1219,6 @@ EXAMPLES
1206
1219
  $ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
1207
1220
  ```
1208
1221
 
1209
- _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/validate/authoring-bundle.ts)_
1222
+ _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.2-dev.0/src/commands/agent/validate/authoring-bundle.ts)_
1210
1223
 
1211
1224
  <!-- commandsstop -->
@@ -1,8 +1,15 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import type { BotTemplate, GenAiPlanner, BotDialogGroup, ConversationDefinitionGoal, ConversationVariable } from '@salesforce/types/metadata';
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: GenAiPlanner & {
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
- // Build the base dir from the AgentFile
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 botTemplateDir = join(basePath, 'botTemplates');
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(genAiPlannerBundleDir, finalFilename, `${finalFilename}.genAiPlannerBundle`);
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,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,GAAG,CAAC,KAAa,EAAE,gBAAqC,EAAU,EAAE,CAClG,KAAK;KACF,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;KAC1D,IAAI,CAAC,GAAG,CAAC,CAAC;AAEf;;;GAGG;AACH,MAAM,yBAAyB,GAAG,CAAC,QAAgB,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"}
@@ -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
- 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 file for a specific agent (Bot). You then use the BotTemplate file, along with the GenAiPlannerBundle file that references the BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.
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
- 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 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.
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
- The new BotTemplate file is generated in the "botTemplates" directory in your local package directory, and has the name <Agent_API_name>_v<Version>_Template.botTemplate-meta.xml, such as force-app/main/default/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of the generated files when it completes.
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 a Bot metadata file in your DX project that corresponds to the My_Awesome_Agent agent; use version 1 of the agent.
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.
@@ -657,9 +657,9 @@
657
657
  "agent:generate:template": {
658
658
  "aliases": [],
659
659
  "args": {},
660
- "description": "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 file for a specific agent (Bot). You then use the BotTemplate file, along with the GenAiPlannerBundle file that references the BotTemplate, to package the template in a managed package that you can share between orgs or on AppExchange.\n\nUse 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 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.\n\nThe new BotTemplate file is generated in the \"botTemplates\" directory in your local package directory, and has the name <Agent_API_name>_v<Version>_Template.botTemplate-meta.xml, such as force-app/main/default/botTemplates/My_Awesome_Agent_v4_Template.botTemplate-meta.xml. The command displays the full pathname of the generated files when it completes.",
660
+ "description": "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.\n\nAt 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.\n\nUse 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.\n\nThe 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.\n\nSee \"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.",
661
661
  "examples": [
662
- "Generate an agent template from a Bot metadata file in your DX project that corresponds to the My_Awesome_Agent agent; use version 1 of the agent.\n<%= config.bin %> <%= command.id %> --agent-file force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1"
662
+ "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:\n<%= 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"
663
663
  ],
664
664
  "flags": {
665
665
  "json": {
@@ -684,6 +684,16 @@
684
684
  "multiple": false,
685
685
  "type": "option"
686
686
  },
687
+ "source-org": {
688
+ "char": "o",
689
+ "name": "source-org",
690
+ "noCacheDefault": true,
691
+ "required": true,
692
+ "summary": "Username or alias of the namespaced scratch org that contains the agent which this template is based on.",
693
+ "hasDynamicHelp": true,
694
+ "multiple": false,
695
+ "type": "option"
696
+ },
687
697
  "agent-version": {
688
698
  "name": "agent-version",
689
699
  "required": true,
@@ -700,16 +710,24 @@
700
710
  "hasDynamicHelp": false,
701
711
  "multiple": false,
702
712
  "type": "option"
713
+ },
714
+ "output-dir": {
715
+ "char": "r",
716
+ "name": "output-dir",
717
+ "summary": "Directory where the generated BotTemplate and GenAiPlannerBundle files are saved.",
718
+ "hasDynamicHelp": false,
719
+ "multiple": false,
720
+ "type": "option"
703
721
  }
704
722
  },
705
- "hasDynamicHelp": false,
723
+ "hasDynamicHelp": true,
706
724
  "hiddenAliases": [],
707
725
  "id": "agent:generate:template",
708
726
  "pluginAlias": "@salesforce/plugin-agent",
709
727
  "pluginName": "@salesforce/plugin-agent",
710
728
  "pluginType": "core",
711
729
  "strict": true,
712
- "summary": "Generate an agent template from an existing agent in your DX project so you can then package the template in a managed package.",
730
+ "summary": "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.",
713
731
  "enableJsonFlag": true,
714
732
  "requiresProject": true,
715
733
  "isESM": true,
@@ -798,96 +816,6 @@
798
816
  "test-spec:generate:agent"
799
817
  ]
800
818
  },
801
- "agent:publish:authoring-bundle": {
802
- "aliases": [],
803
- "args": {},
804
- "description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
805
- "examples": [
806
- "Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
807
- "Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org"
808
- ],
809
- "flags": {
810
- "json": {
811
- "description": "Format output as json.",
812
- "helpGroup": "GLOBAL",
813
- "name": "json",
814
- "allowNo": false,
815
- "type": "boolean"
816
- },
817
- "flags-dir": {
818
- "helpGroup": "GLOBAL",
819
- "name": "flags-dir",
820
- "summary": "Import flag values from a directory.",
821
- "hasDynamicHelp": false,
822
- "multiple": false,
823
- "type": "option"
824
- },
825
- "target-org": {
826
- "char": "o",
827
- "name": "target-org",
828
- "noCacheDefault": true,
829
- "required": true,
830
- "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
831
- "hasDynamicHelp": true,
832
- "multiple": false,
833
- "type": "option"
834
- },
835
- "api-version": {
836
- "description": "Override the api version used for api requests made by this command",
837
- "name": "api-version",
838
- "hasDynamicHelp": false,
839
- "multiple": false,
840
- "type": "option"
841
- },
842
- "api-name": {
843
- "char": "n",
844
- "name": "api-name",
845
- "summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
846
- "hasDynamicHelp": false,
847
- "multiple": false,
848
- "type": "option"
849
- },
850
- "skip-retrieve": {
851
- "name": "skip-retrieve",
852
- "summary": "Don't retrieve the metadata associated with the agent to your DX project.",
853
- "allowNo": false,
854
- "type": "boolean"
855
- }
856
- },
857
- "hasDynamicHelp": true,
858
- "hiddenAliases": [],
859
- "id": "agent:publish:authoring-bundle",
860
- "pluginAlias": "@salesforce/plugin-agent",
861
- "pluginName": "@salesforce/plugin-agent",
862
- "pluginType": "core",
863
- "strict": true,
864
- "summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
865
- "enableJsonFlag": true,
866
- "requiresProject": true,
867
- "FLAGGABLE_PROMPTS": {
868
- "api-name": {
869
- "message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
870
- "promptMessage": "API name of the authoring bundle to publish"
871
- }
872
- },
873
- "isESM": true,
874
- "relativePath": [
875
- "lib",
876
- "commands",
877
- "agent",
878
- "publish",
879
- "authoring-bundle.js"
880
- ],
881
- "aliasPermutations": [],
882
- "permutations": [
883
- "agent:publish:authoring-bundle",
884
- "publish:agent:authoring-bundle",
885
- "publish:authoring-bundle:agent",
886
- "agent:authoring-bundle:publish",
887
- "authoring-bundle:agent:publish",
888
- "authoring-bundle:publish:agent"
889
- ]
890
- },
891
819
  "agent:test:create": {
892
820
  "aliases": [],
893
821
  "args": {},
@@ -1959,7 +1887,97 @@
1959
1887
  "start:agent:preview",
1960
1888
  "start:preview:agent"
1961
1889
  ]
1890
+ },
1891
+ "agent:publish:authoring-bundle": {
1892
+ "aliases": [],
1893
+ "args": {},
1894
+ "description": "An authoring bundle is a metadata type (named aiAuthoringBundle) that provides the blueprint for an agent. The metadata type contains two files: the standard metatada XML file and an Agent Script file (extension \".agent\") that fully describes the agent using the Agent Script language.\n\nWhen you publish an authoring bundle to your org, a number of things happen. First, this command validates that the Agent Script file successfully compiles. If there are compilation errors, the command exits and you must fix the Agent Script file to continue. Once the Agent Script file compiles, then it's published to the org, which in turn creates new associated metadata (Bot, BotVersion, GenAiX), or new versions of the metadata if the agent already exists. The new or updated metadata is retrieved back to your DX project; specify the --skip-retrieve flag to skip this step. Finally, the authoring bundle metadata (AiAuthoringBundle) is deployed to your org.\n\nThis command uses the API name of the authoring bundle.",
1895
+ "examples": [
1896
+ "Publish an authoring bundle by being prompted for its API name; use your default org:\n<%= config.bin %> <%= command.id %>",
1897
+ "Publish an authoring bundle with API name MyAuthoringBundle to the org with alias \"my-dev-org\":\n<%= config.bin %> <%= command.id %> --api-name MyAuthoringbundle --target-org my-dev-org"
1898
+ ],
1899
+ "flags": {
1900
+ "json": {
1901
+ "description": "Format output as json.",
1902
+ "helpGroup": "GLOBAL",
1903
+ "name": "json",
1904
+ "allowNo": false,
1905
+ "type": "boolean"
1906
+ },
1907
+ "flags-dir": {
1908
+ "helpGroup": "GLOBAL",
1909
+ "name": "flags-dir",
1910
+ "summary": "Import flag values from a directory.",
1911
+ "hasDynamicHelp": false,
1912
+ "multiple": false,
1913
+ "type": "option"
1914
+ },
1915
+ "target-org": {
1916
+ "char": "o",
1917
+ "name": "target-org",
1918
+ "noCacheDefault": true,
1919
+ "required": true,
1920
+ "summary": "Username or alias of the target org. Not required if the `target-org` configuration variable is already set.",
1921
+ "hasDynamicHelp": true,
1922
+ "multiple": false,
1923
+ "type": "option"
1924
+ },
1925
+ "api-version": {
1926
+ "description": "Override the api version used for api requests made by this command",
1927
+ "name": "api-version",
1928
+ "hasDynamicHelp": false,
1929
+ "multiple": false,
1930
+ "type": "option"
1931
+ },
1932
+ "api-name": {
1933
+ "char": "n",
1934
+ "name": "api-name",
1935
+ "summary": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
1936
+ "hasDynamicHelp": false,
1937
+ "multiple": false,
1938
+ "type": "option"
1939
+ },
1940
+ "skip-retrieve": {
1941
+ "name": "skip-retrieve",
1942
+ "summary": "Don't retrieve the metadata associated with the agent to your DX project.",
1943
+ "allowNo": false,
1944
+ "type": "boolean"
1945
+ }
1946
+ },
1947
+ "hasDynamicHelp": true,
1948
+ "hiddenAliases": [],
1949
+ "id": "agent:publish:authoring-bundle",
1950
+ "pluginAlias": "@salesforce/plugin-agent",
1951
+ "pluginName": "@salesforce/plugin-agent",
1952
+ "pluginType": "core",
1953
+ "strict": true,
1954
+ "summary": "Publish an authoring bundle to your org, which results in a new agent or a new version of an existing agent.",
1955
+ "enableJsonFlag": true,
1956
+ "requiresProject": true,
1957
+ "FLAGGABLE_PROMPTS": {
1958
+ "api-name": {
1959
+ "message": "API name of the authoring bundle you want to publish; if not specified, the command provides a list that you can choose from.",
1960
+ "promptMessage": "API name of the authoring bundle to publish"
1961
+ }
1962
+ },
1963
+ "isESM": true,
1964
+ "relativePath": [
1965
+ "lib",
1966
+ "commands",
1967
+ "agent",
1968
+ "publish",
1969
+ "authoring-bundle.js"
1970
+ ],
1971
+ "aliasPermutations": [],
1972
+ "permutations": [
1973
+ "agent:publish:authoring-bundle",
1974
+ "publish:agent:authoring-bundle",
1975
+ "publish:authoring-bundle:agent",
1976
+ "agent:authoring-bundle:publish",
1977
+ "authoring-bundle:agent:publish",
1978
+ "authoring-bundle:publish:agent"
1979
+ ]
1962
1980
  }
1963
1981
  },
1964
- "version": "1.32.1"
1982
+ "version": "1.32.2-dev.0"
1965
1983
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-agent",
3
3
  "description": "Commands to interact with Salesforce agents",
4
- "version": "1.32.1",
4
+ "version": "1.32.2-dev.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "enableO11y": true,
@@ -240,7 +240,7 @@
240
240
  "exports": "./lib/index.js",
241
241
  "type": "module",
242
242
  "sfdx": {
243
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.32.1.crt",
244
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.32.1.sig"
243
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.32.2-dev.0.crt",
244
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.32.2-dev.0.sig"
245
245
  }
246
246
  }