@salesforce/plugin-agent 1.32.0 → 1.32.1

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
@@ -85,13 +85,17 @@ Activate an agent in an org.
85
85
 
86
86
  ```
87
87
  USAGE
88
- $ sf agent activate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
88
+ $ sf agent activate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>] [--version
89
+ <value>]
89
90
 
90
91
  FLAGS
91
- -n, --api-name=<value> API name of the agent to activate.
92
+ -n, --api-name=<value> API name of the agent to activate; if not specified, the command provides a list that you
93
+ choose from.
92
94
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
93
95
  configuration variable is already set.
94
96
  --api-version=<value> Override the api version used for api requests made by this command
97
+ --version=<value> Version number of the agent to activate; if not specified, the command provides a list that
98
+ you choose from.
95
99
 
96
100
  GLOBAL FLAGS
97
101
  --flags-dir=<value> Import flag values from a directory.
@@ -100,23 +104,29 @@ GLOBAL FLAGS
100
104
  DESCRIPTION
101
105
  Activate an agent in an org.
102
106
 
103
- Activating an agent makes it immediately available to your users. An agent must be active before you can preview it
104
- with the "agent preview" CLI command or VS Code.
107
+ Activating an agent makes it immediately available to your users. A published agent must be active before you can
108
+ preview it with the "agent preview" CLI command or VS Code. Agents can have multiple versions; only one version can be
109
+ active at a time.
105
110
 
106
- You must know the agent's API name to activate it; you can either be prompted for it or you can specify it with the
107
- --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
111
+ If you run the command without the --api-name or --version flags, the command provides a list of agent API names and
112
+ versions for you to choose from. Use the flags to specify the exact agent and version without being prompted. If you
113
+ use the --json flag and not --version, then the latest agent version is automatically activated.
114
+
115
+ The value of the --version flag is always a number, corresponding to the "vX" part of the "BotVersion" metadata in
116
+ your project. For example, if you have a force-app/main/default/bots/My_Agent/v4.botVersion-meta.xml file in your
117
+ project, then you activate this version with the "--version 4" flag.
108
118
 
109
119
  EXAMPLES
110
- Activate an agent in your default target org by being prompted:
120
+ Activate an agent in your default target org by being prompted for both its API name and version:
111
121
 
112
122
  $ sf agent activate
113
123
 
114
- Activate an agent with API name Resort_Manager in the org with alias "my-org":
124
+ Activate version 2 of an agent with API name Resort_Manager in the org with alias "my-org":
115
125
 
116
- $ sf agent activate --api-name Resort_Manager --target-org my-org
126
+ $ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
117
127
  ```
118
128
 
119
- _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/activate.ts)_
129
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/activate.ts)_
120
130
 
121
131
  ## `sf agent create`
122
132
 
@@ -183,7 +193,7 @@ EXAMPLES
183
193
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
184
194
  ```
185
195
 
186
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/create.ts)_
196
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/create.ts)_
187
197
 
188
198
  ## `sf agent deactivate`
189
199
 
@@ -194,7 +204,8 @@ USAGE
194
204
  $ sf agent deactivate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
195
205
 
196
206
  FLAGS
197
- -n, --api-name=<value> API name of the agent to deactivate.
207
+ -n, --api-name=<value> API name of the agent to deactivate; if not specified, the command provides a list that you
208
+ choose from.
198
209
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
199
210
  configuration variable is already set.
200
211
  --api-version=<value> Override the api version used for api requests made by this command
@@ -210,8 +221,8 @@ DESCRIPTION
210
221
  topics or actions, you must deactivate it. You can't preview an agent with the "agent preview" CLI command or VS Code
211
222
  if it's deactivated.
212
223
 
213
- You must know the agent's API name to deactivate it; you can either be prompted for it or you can specify it with the
214
- --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
224
+ If you run the command without the --api-name flag, the command provides a list of agent API names for you to choose
225
+ from. Use the flag to specify the exact agent without being prompted.
215
226
 
216
227
  EXAMPLES
217
228
  Deactivate an agent in your default target org by being prompted:
@@ -223,7 +234,7 @@ EXAMPLES
223
234
  $ sf agent deactivate --api-name Resort_Manager --target-org my-org
224
235
  ```
225
236
 
226
- _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/deactivate.ts)_
237
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/deactivate.ts)_
227
238
 
228
239
  ## `sf agent generate agent-spec`
229
240
 
@@ -330,7 +341,7 @@ EXAMPLES
330
341
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
331
342
  ```
332
343
 
333
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/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.1/src/commands/agent/generate/agent-spec.ts)_
334
345
 
335
346
  ## `sf agent generate authoring-bundle`
336
347
 
@@ -407,7 +418,7 @@ EXAMPLES
407
418
  other-package-dir/main/default --target-org my-dev-org
408
419
  ```
409
420
 
410
- _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/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.1/src/commands/agent/generate/authoring-bundle.ts)_
411
422
 
412
423
  ## `sf agent generate template`
413
424
 
@@ -455,7 +466,7 @@ EXAMPLES
455
466
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
456
467
  ```
457
468
 
458
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/generate/template.ts)_
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)_
459
470
 
460
471
  ## `sf agent generate test-spec`
461
472
 
@@ -520,7 +531,7 @@ EXAMPLES
520
531
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
521
532
  ```
522
533
 
523
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/generate/test-spec.ts)_
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)_
524
535
 
525
536
  ## `sf agent preview`
526
537
 
@@ -593,7 +604,7 @@ EXAMPLES
593
604
  $ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
594
605
  ```
595
606
 
596
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/preview.ts)_
607
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.1/src/commands/agent/preview.ts)_
597
608
 
598
609
  ## `sf agent preview end`
599
610
 
@@ -648,7 +659,7 @@ EXAMPLES
648
659
  $ sf agent preview end --authoring-bundle My_Local_Agent
649
660
  ```
650
661
 
651
- _See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/preview/end.ts)_
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)_
652
663
 
653
664
  ## `sf agent preview send`
654
665
 
@@ -706,7 +717,7 @@ EXAMPLES
706
717
  $ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
707
718
  ```
708
719
 
709
- _See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/preview/send.ts)_
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)_
710
721
 
711
722
  ## `sf agent preview sessions`
712
723
 
@@ -739,7 +750,7 @@ EXAMPLES
739
750
  $ sf agent preview sessions
740
751
  ```
741
752
 
742
- _See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/preview/sessions.ts)_
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)_
743
754
 
744
755
  ## `sf agent preview start`
745
756
 
@@ -796,7 +807,7 @@ EXAMPLES
796
807
  $ sf agent preview start --api-name My_Published_Agent
797
808
  ```
798
809
 
799
- _See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/preview/start.ts)_
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)_
800
811
 
801
812
  ## `sf agent publish authoring-bundle`
802
813
 
@@ -845,7 +856,7 @@ EXAMPLES
845
856
  $ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
846
857
  ```
847
858
 
848
- _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/publish/authoring-bundle.ts)_
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)_
849
860
 
850
861
  ## `sf agent test create`
851
862
 
@@ -900,7 +911,7 @@ EXAMPLES
900
911
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
901
912
  ```
902
913
 
903
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/test/create.ts)_
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)_
904
915
 
905
916
  ## `sf agent test list`
906
917
 
@@ -935,7 +946,7 @@ EXAMPLES
935
946
  $ sf agent test list --target-org my-org
936
947
  ```
937
948
 
938
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/test/list.ts)_
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)_
939
950
 
940
951
  ## `sf agent test results`
941
952
 
@@ -1001,7 +1012,7 @@ FLAG DESCRIPTIONS
1001
1012
  expression when using custom evaluations.
1002
1013
  ```
1003
1014
 
1004
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/test/results.ts)_
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)_
1005
1016
 
1006
1017
  ## `sf agent test resume`
1007
1018
 
@@ -1074,7 +1085,7 @@ FLAG DESCRIPTIONS
1074
1085
  expression when using custom evaluations.
1075
1086
  ```
1076
1087
 
1077
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/test/resume.ts)_
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)_
1078
1089
 
1079
1090
  ## `sf agent test run`
1080
1091
 
@@ -1148,7 +1159,7 @@ FLAG DESCRIPTIONS
1148
1159
  expression when using custom evaluations.
1149
1160
  ```
1150
1161
 
1151
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/test/run.ts)_
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)_
1152
1163
 
1153
1164
  ## `sf agent validate authoring-bundle`
1154
1165
 
@@ -1195,6 +1206,6 @@ EXAMPLES
1195
1206
  $ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
1196
1207
  ```
1197
1208
 
1198
- _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/src/commands/agent/validate/authoring-bundle.ts)_
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)_
1199
1210
 
1200
1211
  <!-- commandsstop -->
@@ -1,5 +1,5 @@
1
1
  import { Org } from '@salesforce/core';
2
- import { type BotMetadata, ProductionAgent } from '@salesforce/agents';
2
+ import { type BotMetadata, type BotVersionMetadata, ProductionAgent } from '@salesforce/agents';
3
3
  type Choice<Value> = {
4
4
  value: Value;
5
5
  name?: string;
@@ -9,13 +9,27 @@ type AgentValue = {
9
9
  Id: string;
10
10
  DeveloperName: string;
11
11
  };
12
+ type VersionChoice = {
13
+ version: number;
14
+ status: string;
15
+ };
12
16
  export declare const UNSUPPORTED_AGENTS: string[];
13
17
  export declare const agentIsUnsupported: (devName: string) => boolean;
14
18
  export declare const validateAgent: (agent: BotMetadata) => boolean;
15
19
  export declare const getAgentChoices: (agents: BotMetadata[], status: "Active" | "Inactive") => Array<Choice<AgentValue>>;
20
+ export declare const getVersionChoices: (versions: BotVersionMetadata[], status: "Active" | "Inactive") => Array<Choice<VersionChoice>>;
16
21
  export declare const getAgentForActivation: (config: {
17
22
  targetOrg: Org;
18
23
  status: "Active" | "Inactive";
19
24
  apiNameFlag?: string;
20
25
  }) => Promise<ProductionAgent>;
26
+ export declare const getVersionForActivation: (config: {
27
+ agent: ProductionAgent;
28
+ status: "Active" | "Inactive";
29
+ versionFlag?: number;
30
+ jsonEnabled?: boolean;
31
+ }) => Promise<{
32
+ version: number | undefined;
33
+ warning?: string;
34
+ }>;
21
35
  export {};
@@ -29,22 +29,35 @@ export const validateAgent = (agent) => {
29
29
  }
30
30
  return true;
31
31
  };
32
- export const getAgentChoices = (agents, status) => agents.map((agent) => {
33
- let disabled = false;
34
- const lastBotVersion = agent.BotVersions.records[agent.BotVersions.records.length - 1];
35
- if (lastBotVersion.Status === status) {
36
- disabled = `(Already ${status})`;
37
- }
38
- if (agentIsUnsupported(agent.DeveloperName)) {
39
- disabled = '(Not Supported)';
40
- }
32
+ export const getAgentChoices = (agents, status) => agents
33
+ .filter((agent) => {
34
+ // Only one version can be active at a time
35
+ // For activate (status='Active'): show agents that don't have an active version (all versions are inactive)
36
+ // For deactivate (status='Inactive'): show agents that have an active version
37
+ const hasActiveVersion = agent.BotVersions.records.some((version) => version.Status === 'Active');
38
+ const canPerformOperation = status === 'Active' ? !hasActiveVersion : hasActiveVersion;
39
+ // Filter out agents that can't perform the operation or are unsupported
40
+ return canPerformOperation && !agentIsUnsupported(agent.DeveloperName);
41
+ })
42
+ .sort((a, b) => a.DeveloperName.localeCompare(b.DeveloperName))
43
+ .map((agent) => ({
44
+ name: agent.DeveloperName,
45
+ value: {
46
+ Id: agent.Id,
47
+ DeveloperName: agent.DeveloperName,
48
+ },
49
+ }));
50
+ export const getVersionChoices = (versions, status) => versions
51
+ .sort((a, b) => b.VersionNumber - a.VersionNumber)
52
+ .map((version) => {
53
+ const isTargetStatus = version.Status === status;
41
54
  return {
42
- name: agent.DeveloperName,
55
+ name: `Version ${version.VersionNumber}`,
43
56
  value: {
44
- Id: agent.Id,
45
- DeveloperName: agent.DeveloperName,
57
+ version: version.VersionNumber,
58
+ status: version.Status,
46
59
  },
47
- disabled,
60
+ disabled: isTargetStatus ? `(Already ${status})` : false,
48
61
  };
49
62
  });
50
63
  export const getAgentForActivation = async (config) => {
@@ -84,4 +97,46 @@ export const getAgentForActivation = async (config) => {
84
97
  project: SfProject.getInstance(),
85
98
  });
86
99
  };
100
+ export const getVersionForActivation = async (config) => {
101
+ const { agent, status, versionFlag, jsonEnabled } = config;
102
+ // If version flag is provided, return it
103
+ if (versionFlag !== undefined) {
104
+ return { version: versionFlag };
105
+ }
106
+ // Get bot metadata to access versions
107
+ const botMetadata = await agent.getBotMetadata();
108
+ // Filter out deleted versions as a defensive measure
109
+ const versions = botMetadata.BotVersions.records.filter((v) => !v.IsDeleted);
110
+ // If there's only one version, return it
111
+ if (versions.length === 1) {
112
+ return { version: versions[0].VersionNumber };
113
+ }
114
+ // Get version choices and filter out disabled ones
115
+ const choices = getVersionChoices(versions, status);
116
+ const availableChoices = choices.filter((choice) => !choice.disabled);
117
+ // If there's only one available choice, return it automatically
118
+ if (availableChoices.length === 1) {
119
+ return { version: availableChoices[0].value.version };
120
+ }
121
+ // If no versions are available, throw an error
122
+ if (availableChoices.length === 0) {
123
+ const action = status === 'Active' ? 'activate' : 'deactivate';
124
+ throw messages.createError('error.noVersionsAvailable', [action]);
125
+ }
126
+ // If JSON mode is enabled, automatically select the latest available version
127
+ if (jsonEnabled) {
128
+ // Find the latest (highest version number) available version
129
+ const latestVersion = availableChoices.reduce((latest, choice) => choice.value.version > latest.value.version ? choice : latest);
130
+ return {
131
+ version: latestVersion.value.version,
132
+ warning: `No version specified, automatically selected latest available version: ${latestVersion.value.version}`,
133
+ };
134
+ }
135
+ // Prompt user to select a version
136
+ const versionChoice = await select({
137
+ message: 'Select a version',
138
+ choices,
139
+ });
140
+ return { version: versionChoice.version };
141
+ };
87
142
  //# sourceMappingURL=agentActivation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentActivation.js","sourceRoot":"","sources":["../src/agentActivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAO,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,KAAK,EA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AAO,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO;YACpC,OAAO,EAAE,0EAA0E,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE;SACjH,CAAC;IACJ,CAAC;IAED,kCAAkC;IAClC,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC;QACjC,OAAO,EAAE,kBAAkB;QAC3B,OAAO;KACR,CAAC,CAAC;IAEH,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,CAAC;AAC5C,CAAC,CAAC"}
@@ -1,12 +1,18 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- export default class AgentActivate extends SfCommand<void> {
2
+ export type AgentActivateResult = {
3
+ success: boolean;
4
+ version: number;
5
+ };
6
+ export default class AgentActivate extends SfCommand<AgentActivateResult> {
3
7
  static readonly summary: string;
4
8
  static readonly description: string;
5
9
  static readonly examples: string[];
10
+ static readonly enableJsonFlag = true;
6
11
  static readonly flags: {
7
12
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
8
13
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
14
  'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ version: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
16
  };
11
- run(): Promise<void>;
17
+ run(): Promise<AgentActivateResult>;
12
18
  }
@@ -15,13 +15,14 @@
15
15
  */
16
16
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
17
17
  import { Messages } from '@salesforce/core';
18
- import { getAgentForActivation } from '../../agentActivation.js';
18
+ import { getAgentForActivation, getVersionForActivation } from '../../agentActivation.js';
19
19
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
20
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.activate');
21
21
  export default class AgentActivate extends SfCommand {
22
22
  static summary = messages.getMessage('summary');
23
23
  static description = messages.getMessage('description');
24
24
  static examples = messages.getMessages('examples');
25
+ static enableJsonFlag = true;
25
26
  static flags = {
26
27
  'target-org': Flags.requiredOrg(),
27
28
  'api-version': Flags.orgApiVersion(),
@@ -29,6 +30,7 @@ export default class AgentActivate extends SfCommand {
29
30
  summary: messages.getMessage('flags.api-name.summary'),
30
31
  char: 'n',
31
32
  }),
33
+ version: Flags.integer({ summary: messages.getMessage('flags.version.summary') }),
32
34
  };
33
35
  async run() {
34
36
  const { flags } = await this.parse(AgentActivate);
@@ -38,9 +40,19 @@ export default class AgentActivate extends SfCommand {
38
40
  throw messages.createError('error.missingRequiredFlags', ['api-name']);
39
41
  }
40
42
  const agent = await getAgentForActivation({ targetOrg, status: 'Active', apiNameFlag });
41
- await agent.activate();
42
- const agentName = (await agent.getBotMetadata()).DeveloperName;
43
- this.log(`Agent ${agentName} activated.`);
43
+ const { version, warning } = await getVersionForActivation({
44
+ agent,
45
+ status: 'Active',
46
+ versionFlag: flags.version,
47
+ jsonEnabled: this.jsonEnabled(),
48
+ });
49
+ const result = await agent.activate(version);
50
+ const metadata = await agent.getBotMetadata();
51
+ this.log(`${metadata.DeveloperName} v${result.VersionNumber} activated.`);
52
+ if (warning) {
53
+ this.warn(warning);
54
+ }
55
+ return { success: true, version: result.VersionNumber };
44
56
  }
45
57
  }
46
58
  //# sourceMappingURL=activate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"activate.js","sourceRoot":"","sources":["../../../src/commands/agent/activate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG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EK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAElD,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAEtC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvC,MAAM,QAAQ,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QACzE,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,qBAAqB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QACxF,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,uBAAuB,CAAC;YACzD,KAAK;YACL,MAAM,EAAE,QAAQ;YAChB,WAAW,EAAE,KAAK,CAAC,OAAO;YAC1B,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SAChC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QAE9C,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,aAAa,KAAK,MAAM,CAAC,aAAa,aAAa,CAAC,CAAC;QAC1E,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrB,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;IAC1D,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- export default class AgentDeactivate extends SfCommand<void> {
2
+ import { AgentActivateResult } from './activate.js';
3
+ export default class AgentDeactivate extends SfCommand<AgentActivateResult> {
3
4
  static readonly summary: string;
4
5
  static readonly description: string;
5
6
  static readonly examples: string[];
7
+ static enableJsonFlag: boolean;
6
8
  static readonly flags: {
7
9
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
8
10
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
11
  'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
12
  };
11
- run(): Promise<void>;
13
+ run(): Promise<AgentActivateResult>;
12
14
  }
@@ -22,6 +22,7 @@ export default class AgentDeactivate extends SfCommand {
22
22
  static summary = messages.getMessage('summary');
23
23
  static description = messages.getMessage('description');
24
24
  static examples = messages.getMessages('examples');
25
+ static enableJsonFlag = true;
25
26
  static flags = {
26
27
  'target-org': Flags.requiredOrg(),
27
28
  'api-version': Flags.orgApiVersion(),
@@ -38,9 +39,10 @@ export default class AgentDeactivate extends SfCommand {
38
39
  throw messages.createError('error.missingRequiredFlags', ['api-name']);
39
40
  }
40
41
  const agent = await getAgentForActivation({ targetOrg, status: 'Inactive', apiNameFlag });
41
- await agent.deactivate();
42
- const agentName = (await agent.getBotMetadata()).DeveloperName;
43
- this.log(`Agent ${agentName} deactivated.`);
42
+ const result = await agent.deactivate();
43
+ const metadata = await agent.getBotMetadata();
44
+ this.log(`${metadata.DeveloperName} v${result.VersionNumber} deactivated.`);
45
+ return { success: true, version: result.VersionNumber };
44
46
  }
45
47
  }
46
48
  //# sourceMappingURL=deactivate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deactivate.js","sourceRoot":"","sources":["../../../src/commands/agent/deactivate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAA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AAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAEpD,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;QACtC,MAAM,SAAS,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QAEtC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACvC,MAAM,QAAQ,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,qBAAqB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;QAC1F,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;QACxC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;QAE9C,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,aAAa,KAAK,MAAM,CAAC,aAAa,eAAe,CAAC,CAAC;QAC5E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,aAAa,EAAE,CAAC;IAC1D,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. An agent must be active before you can preview it with the "agent preview" CLI command or VS Code.
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
- You must know the agent's API name to activate it; you can either be prompted for it or you can specify it with the --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
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
- You must know the agent's API name to deactivate it; you can either be prompted for it or you can specify it with the --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
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