@salesforce/plugin-agent 1.32.0 → 1.32.2-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -47
- package/lib/agentActivation.d.ts +15 -1
- package/lib/agentActivation.js +68 -13
- package/lib/agentActivation.js.map +1 -1
- package/lib/commands/agent/activate.d.ts +8 -2
- package/lib/commands/agent/activate.js +16 -4
- package/lib/commands/agent/activate.js.map +1 -1
- package/lib/commands/agent/deactivate.d.ts +4 -2
- package/lib/commands/agent/deactivate.js +5 -3
- package/lib/commands/agent/deactivate.js.map +1 -1
- package/lib/commands/agent/generate/template.d.ts +45 -2
- package/lib/commands/agent/generate/template.js +261 -8
- package/lib/commands/agent/generate/template.js.map +1 -1
- package/messages/agent.activate.md +12 -6
- package/messages/agent.activation.md +4 -0
- package/messages/agent.deactivate.md +2 -2
- package/messages/agent.generate.template.md +50 -9
- package/oclif.manifest.json +499 -474
- package/package.json +4 -4
- package/schemas/agent-activate.json +19 -0
- package/schemas/agent-deactivate.json +19 -0
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.
|
|
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
|
-
|
|
107
|
-
|
|
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.2-dev.0/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.2-dev.0/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
|
-
|
|
214
|
-
|
|
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.2-dev.0/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.2-dev.0/src/commands/agent/generate/agent-spec.ts)_
|
|
334
345
|
|
|
335
346
|
## `sf agent generate authoring-bundle`
|
|
336
347
|
|
|
@@ -407,18 +418,22 @@ 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.2-dev.0/src/commands/agent/generate/authoring-bundle.ts)_
|
|
411
422
|
|
|
412
423
|
## `sf agent generate template`
|
|
413
424
|
|
|
414
|
-
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.
|
|
415
426
|
|
|
416
427
|
```
|
|
417
428
|
USAGE
|
|
418
|
-
$ sf agent generate template --agent-version <value> -f <value> [--json] [--flags-dir <value>] [--api-version
|
|
429
|
+
$ sf agent generate template -o <value> --agent-version <value> -f <value> [--json] [--flags-dir <value>] [--api-version
|
|
430
|
+
<value>] [-r <value>]
|
|
419
431
|
|
|
420
432
|
FLAGS
|
|
421
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.
|
|
422
437
|
--agent-version=<value> (required) Version of the agent (BotVersion).
|
|
423
438
|
--api-version=<value> Override the api version used for api requests made by this command
|
|
424
439
|
|
|
@@ -427,35 +442,44 @@ GLOBAL FLAGS
|
|
|
427
442
|
--json Format output as json.
|
|
428
443
|
|
|
429
444
|
DESCRIPTION
|
|
430
|
-
Generate an agent template from an existing agent in your DX project so you can then package the template in a
|
|
431
|
-
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.
|
|
432
450
|
|
|
433
451
|
At a high-level, agents are defined by the Bot, BotVersion, and GenAiPlannerBundle metadata types. The
|
|
434
452
|
GenAiPlannerBundle type in turn defines the agent's topics and actions. This command uses the metadata files for these
|
|
435
|
-
three types, located in your local DX project, to generate a BotTemplate file for a specific agent (Bot). You
|
|
436
|
-
the BotTemplate file, along with the GenAiPlannerBundle file that references the
|
|
437
|
-
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.
|
|
438
456
|
|
|
439
457
|
Use the --agent-file flag to specify the relative or full pathname of the Bot metadata file, such as
|
|
440
458
|
force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml. A single Bot can have multiple
|
|
441
|
-
BotVersions, so use the --agent-version flag to specify the version. The corresponding BotVersion file must
|
|
442
|
-
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
|
|
443
461
|
force-app/main/default/bots/My_Awesome_Agent/v4.botVersion-meta.xml must exist.
|
|
444
462
|
|
|
445
|
-
The new BotTemplate file is generated in the "botTemplates" directory in
|
|
446
|
-
name <Agent_API_name
|
|
447
|
-
|
|
448
|
-
|
|
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.
|
|
449
472
|
|
|
450
473
|
EXAMPLES
|
|
451
|
-
Generate an agent template from
|
|
452
|
-
|
|
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:
|
|
453
476
|
|
|
454
477
|
$ sf agent generate template --agent-file \
|
|
455
|
-
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
|
|
456
480
|
```
|
|
457
481
|
|
|
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)_
|
|
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)_
|
|
459
483
|
|
|
460
484
|
## `sf agent generate test-spec`
|
|
461
485
|
|
|
@@ -520,7 +544,7 @@ EXAMPLES
|
|
|
520
544
|
force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
|
|
521
545
|
```
|
|
522
546
|
|
|
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)_
|
|
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)_
|
|
524
548
|
|
|
525
549
|
## `sf agent preview`
|
|
526
550
|
|
|
@@ -593,7 +617,7 @@ EXAMPLES
|
|
|
593
617
|
$ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
|
|
594
618
|
```
|
|
595
619
|
|
|
596
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.32.0/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)_
|
|
597
621
|
|
|
598
622
|
## `sf agent preview end`
|
|
599
623
|
|
|
@@ -648,7 +672,7 @@ EXAMPLES
|
|
|
648
672
|
$ sf agent preview end --authoring-bundle My_Local_Agent
|
|
649
673
|
```
|
|
650
674
|
|
|
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)_
|
|
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)_
|
|
652
676
|
|
|
653
677
|
## `sf agent preview send`
|
|
654
678
|
|
|
@@ -706,7 +730,7 @@ EXAMPLES
|
|
|
706
730
|
$ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
|
|
707
731
|
```
|
|
708
732
|
|
|
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)_
|
|
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)_
|
|
710
734
|
|
|
711
735
|
## `sf agent preview sessions`
|
|
712
736
|
|
|
@@ -739,7 +763,7 @@ EXAMPLES
|
|
|
739
763
|
$ sf agent preview sessions
|
|
740
764
|
```
|
|
741
765
|
|
|
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)_
|
|
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)_
|
|
743
767
|
|
|
744
768
|
## `sf agent preview start`
|
|
745
769
|
|
|
@@ -796,7 +820,7 @@ EXAMPLES
|
|
|
796
820
|
$ sf agent preview start --api-name My_Published_Agent
|
|
797
821
|
```
|
|
798
822
|
|
|
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)_
|
|
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)_
|
|
800
824
|
|
|
801
825
|
## `sf agent publish authoring-bundle`
|
|
802
826
|
|
|
@@ -845,7 +869,7 @@ EXAMPLES
|
|
|
845
869
|
$ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
|
|
846
870
|
```
|
|
847
871
|
|
|
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)_
|
|
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)_
|
|
849
873
|
|
|
850
874
|
## `sf agent test create`
|
|
851
875
|
|
|
@@ -900,7 +924,7 @@ EXAMPLES
|
|
|
900
924
|
$ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
|
|
901
925
|
```
|
|
902
926
|
|
|
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)_
|
|
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)_
|
|
904
928
|
|
|
905
929
|
## `sf agent test list`
|
|
906
930
|
|
|
@@ -935,7 +959,7 @@ EXAMPLES
|
|
|
935
959
|
$ sf agent test list --target-org my-org
|
|
936
960
|
```
|
|
937
961
|
|
|
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)_
|
|
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)_
|
|
939
963
|
|
|
940
964
|
## `sf agent test results`
|
|
941
965
|
|
|
@@ -1001,7 +1025,7 @@ FLAG DESCRIPTIONS
|
|
|
1001
1025
|
expression when using custom evaluations.
|
|
1002
1026
|
```
|
|
1003
1027
|
|
|
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)_
|
|
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)_
|
|
1005
1029
|
|
|
1006
1030
|
## `sf agent test resume`
|
|
1007
1031
|
|
|
@@ -1074,7 +1098,7 @@ FLAG DESCRIPTIONS
|
|
|
1074
1098
|
expression when using custom evaluations.
|
|
1075
1099
|
```
|
|
1076
1100
|
|
|
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)_
|
|
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)_
|
|
1078
1102
|
|
|
1079
1103
|
## `sf agent test run`
|
|
1080
1104
|
|
|
@@ -1148,7 +1172,7 @@ FLAG DESCRIPTIONS
|
|
|
1148
1172
|
expression when using custom evaluations.
|
|
1149
1173
|
```
|
|
1150
1174
|
|
|
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)_
|
|
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)_
|
|
1152
1176
|
|
|
1153
1177
|
## `sf agent validate authoring-bundle`
|
|
1154
1178
|
|
|
@@ -1195,6 +1219,6 @@ EXAMPLES
|
|
|
1195
1219
|
$ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
|
|
1196
1220
|
```
|
|
1197
1221
|
|
|
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)_
|
|
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)_
|
|
1199
1223
|
|
|
1200
1224
|
<!-- commandsstop -->
|
package/lib/agentActivation.d.ts
CHANGED
|
@@ -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 {};
|
package/lib/agentActivation.js
CHANGED
|
@@ -29,22 +29,35 @@ export const validateAgent = (agent) => {
|
|
|
29
29
|
}
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
|
-
export const getAgentChoices = (agents, status) => agents
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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:
|
|
55
|
+
name: `Version ${version.VersionNumber}`,
|
|
43
56
|
value: {
|
|
44
|
-
|
|
45
|
-
|
|
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,
|
|
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,EAA8D,MAAM,oBAAoB,CAAC;AACvG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAiB3C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAEvF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAe,EAAW,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAErG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAkB,EAAW,EAAE;IAC3D,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;QACpB,MAAM,QAAQ,CAAC,WAAW,CAAC,sBAAsB,EAAE,CAAC,K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;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
|
|
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<
|
|
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
|
|
42
|
-
|
|
43
|
-
|
|
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":"AA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12 +1,14 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
|
|
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<
|
|
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
|
|
43
|
-
this.log(
|
|
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,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;
|
|
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,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAEvF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAA8B;IAClE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC;IAE7B,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,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