@salesforce/plugin-agent 1.23.8 → 1.24.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
@@ -59,7 +59,9 @@ sf plugins
59
59
 
60
60
  <!-- commands -->
61
61
 
62
+ - [`sf agent activate`](#sf-agent-activate)
62
63
  - [`sf agent create`](#sf-agent-create)
64
+ - [`sf agent deactivate`](#sf-agent-deactivate)
63
65
  - [`sf agent generate agent-spec`](#sf-agent-generate-agent-spec)
64
66
  - [`sf agent generate template`](#sf-agent-generate-template)
65
67
  - [`sf agent generate test-spec`](#sf-agent-generate-test-spec)
@@ -70,6 +72,45 @@ sf plugins
70
72
  - [`sf agent test resume`](#sf-agent-test-resume)
71
73
  - [`sf agent test run`](#sf-agent-test-run)
72
74
 
75
+ ## `sf agent activate`
76
+
77
+ Activate an agent in an org.
78
+
79
+ ```
80
+ USAGE
81
+ $ sf agent activate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
82
+
83
+ FLAGS
84
+ -n, --api-name=<value> API name of the agent to activate.
85
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
86
+ configuration variable is already set.
87
+ --api-version=<value> Override the api version used for api requests made by this command
88
+
89
+ GLOBAL FLAGS
90
+ --flags-dir=<value> Import flag values from a directory.
91
+ --json Format output as json.
92
+
93
+ DESCRIPTION
94
+ Activate an agent in an org.
95
+
96
+ Activating an agent makes it immediately available to your users. An agent must be active before you can preview it
97
+ with the "agent preview" CLI command or VS Code.
98
+
99
+ 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
100
+ --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
101
+
102
+ EXAMPLES
103
+ Activate an agent in your default target org by being prompted:
104
+
105
+ $ sf agent activate
106
+
107
+ Activate an agent with API name Resort_Manager in the org with alias "my-org":
108
+
109
+ $ sf agent activate --api-name Resort_Manager --target-org my-org
110
+ ```
111
+
112
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/activate.ts)_
113
+
73
114
  ## `sf agent create`
74
115
 
75
116
  Create an agent in your org using a local agent spec file.
@@ -130,7 +171,47 @@ EXAMPLES
130
171
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
131
172
  ```
132
173
 
133
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/create.ts)_
174
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/create.ts)_
175
+
176
+ ## `sf agent deactivate`
177
+
178
+ Deactivate an agent in an org.
179
+
180
+ ```
181
+ USAGE
182
+ $ sf agent deactivate -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
183
+
184
+ FLAGS
185
+ -n, --api-name=<value> API name of the agent to deactivate.
186
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
187
+ configuration variable is already set.
188
+ --api-version=<value> Override the api version used for api requests made by this command
189
+
190
+ GLOBAL FLAGS
191
+ --flags-dir=<value> Import flag values from a directory.
192
+ --json Format output as json.
193
+
194
+ DESCRIPTION
195
+ Deactivate an agent in an org.
196
+
197
+ Deactivating an agent makes it unavailable to your users. To make changes to an agent, such as adding or removing
198
+ topics or actions, you must deactivate it. You can't preview an agent with the "agent preview" CLI command or VS Code
199
+ if it's deactivated.
200
+
201
+ 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
202
+ --api-name flag. Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup.
203
+
204
+ EXAMPLES
205
+ Deactivate an agent in your default target org by being prompted:
206
+
207
+ $ sf agent deactivate
208
+
209
+ Deactivate the agent Resort_Manager in the org with alias "my_org":
210
+
211
+ $ sf agent deactivate --api-name Resort_Manager --target-org my-org
212
+ ```
213
+
214
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/deactivate.ts)_
134
215
 
135
216
  ## `sf agent generate agent-spec`
136
217
 
@@ -235,7 +316,7 @@ EXAMPLES
235
316
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
236
317
  ```
237
318
 
238
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/generate/agent-spec.ts)_
319
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/generate/agent-spec.ts)_
239
320
 
240
321
  ## `sf agent generate template`
241
322
 
@@ -283,7 +364,7 @@ EXAMPLES
283
364
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
284
365
  ```
285
366
 
286
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/generate/template.ts)_
367
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/generate/template.ts)_
287
368
 
288
369
  ## `sf agent generate test-spec`
289
370
 
@@ -318,6 +399,9 @@ DESCRIPTION
318
399
  - Expected topic: API name of the topic you expect the agent to use when responding to the utterance.
319
400
  - Expected actions: One or more API names of the expection actions the agent takes.
320
401
  - Expected outcome: Natural language description of the outcome you expect.
402
+ - (Optional) Custom evaluation: Test an agent's response for specific strings or numbers.
403
+ - (Optional) Conversation history: Boilerplate for additional context you can add to the test in the form of a
404
+ conversation history.
321
405
 
322
406
  When your test spec is ready, you then run the "agent test create" command to actually create the test in your org and
323
407
  synchronize the metadata with your DX project. The metadata type for an agent test is AiEvaluationDefinition.
@@ -341,7 +425,7 @@ EXAMPLES
341
425
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
342
426
  ```
343
427
 
344
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/generate/test-spec.ts)_
428
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/generate/test-spec.ts)_
345
429
 
346
430
  ## `sf agent preview`
347
431
 
@@ -384,7 +468,8 @@ DESCRIPTION
384
468
  environment variable "SF_AGENT_PREVIEW_OUTPUT_DIR" to the directory. Or you can pass the directory to the --output-dir
385
469
  flag.
386
470
 
387
- Find the agent's API name in its main details page in your org's Agent page in Setup.
471
+ Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup. If your agent is
472
+ currently deactivated, use the "agent activate" CLI command to activate it.
388
473
 
389
474
  IMPORTANT: Before you use this command, you must complete a number of configuration steps in your org and your DX
390
475
  project. The examples in this help assume you've completed the steps. See "Preview an Agent" in the "Agentforce
@@ -392,7 +477,7 @@ DESCRIPTION
392
477
  https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.
393
478
 
394
479
  EXAMPLES
395
- Interact with an agent with API name "Resort_Manager" in the org with alias "my-org" and the linked "agent-app"
480
+ Interact with an agent with API name Resort_Manager in the org with alias "my-org" and the linked "agent-app"
396
481
  connected app:
397
482
 
398
483
  $ sf agent preview --api-name Resort_Manager --target-org my-org --client-app agent-app
@@ -404,7 +489,7 @@ EXAMPLES
404
489
  transcripts/my-preview
405
490
  ```
406
491
 
407
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/preview.ts)_
492
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/preview.ts)_
408
493
 
409
494
  ## `sf agent test create`
410
495
 
@@ -459,7 +544,7 @@ EXAMPLES
459
544
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
460
545
  ```
461
546
 
462
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/test/create.ts)_
547
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/test/create.ts)_
463
548
 
464
549
  ## `sf agent test list`
465
550
 
@@ -494,7 +579,7 @@ EXAMPLES
494
579
  $ sf agent test list --target-org my-org
495
580
  ```
496
581
 
497
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/test/list.ts)_
582
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/test/list.ts)_
498
583
 
499
584
  ## `sf agent test results`
500
585
 
@@ -550,7 +635,7 @@ FLAG DESCRIPTIONS
550
635
  test results aren't written.
551
636
  ```
552
637
 
553
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/test/results.ts)_
638
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/test/results.ts)_
554
639
 
555
640
  ## `sf agent test resume`
556
641
 
@@ -613,7 +698,7 @@ FLAG DESCRIPTIONS
613
698
  test results aren't written.
614
699
  ```
615
700
 
616
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/test/resume.ts)_
701
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/test/resume.ts)_
617
702
 
618
703
  ## `sf agent test run`
619
704
 
@@ -677,6 +762,6 @@ FLAG DESCRIPTIONS
677
762
  test results aren't written.
678
763
  ```
679
764
 
680
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.23.8/src/commands/agent/test/run.ts)_
765
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.1/src/commands/agent/test/run.ts)_
681
766
 
682
767
  <!-- commandsstop -->
@@ -0,0 +1,22 @@
1
+ import { Connection, Org } from '@salesforce/core';
2
+ import { Agent, type BotMetadata } from '@salesforce/agents';
3
+ type Choice<Value> = {
4
+ value: Value;
5
+ name?: string;
6
+ disabled?: boolean | string;
7
+ };
8
+ type AgentValue = {
9
+ Id: string;
10
+ DeveloperName: string;
11
+ };
12
+ export declare const UNSUPPORTED_AGENTS: string[];
13
+ export declare const agentIsUnsupported: (devName: string) => boolean;
14
+ export declare const validateAgent: (agent: BotMetadata) => boolean;
15
+ export declare const getAgentChoices: (agents: BotMetadata[], status: "Active" | "Inactive") => Array<Choice<AgentValue>>;
16
+ export declare const getAgentForActivation: (config: {
17
+ conn: Connection;
18
+ targetOrg: Org;
19
+ status: "Active" | "Inactive";
20
+ apiNameFlag?: string;
21
+ }) => Promise<Agent>;
22
+ export {};
@@ -0,0 +1,74 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { Messages, SfError } from '@salesforce/core';
8
+ import { Agent } from '@salesforce/agents';
9
+ import { select } from '@inquirer/prompts';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.activation');
12
+ export const UNSUPPORTED_AGENTS = ['Copilot_for_Salesforce'];
13
+ export const agentIsUnsupported = (devName) => UNSUPPORTED_AGENTS.includes(devName);
14
+ export const validateAgent = (agent) => {
15
+ if (agent.IsDeleted) {
16
+ throw messages.createError('error.agentIsDeleted', [agent.DeveloperName]);
17
+ }
18
+ if (agentIsUnsupported(agent.DeveloperName)) {
19
+ throw messages.createError('error.agentIsDefault', [agent.DeveloperName]);
20
+ }
21
+ return true;
22
+ };
23
+ export const getAgentChoices = (agents, status) => agents.map((agent) => {
24
+ let disabled = false;
25
+ const lastBotVersion = agent.BotVersions.records[agent.BotVersions.records.length - 1];
26
+ if (lastBotVersion.Status === status) {
27
+ disabled = `(Already ${status})`;
28
+ }
29
+ if (agentIsUnsupported(agent.DeveloperName)) {
30
+ disabled = '(Not Supported)';
31
+ }
32
+ return {
33
+ name: agent.DeveloperName,
34
+ value: {
35
+ Id: agent.Id,
36
+ DeveloperName: agent.DeveloperName,
37
+ },
38
+ disabled,
39
+ };
40
+ });
41
+ export const getAgentForActivation = async (config) => {
42
+ const { conn, targetOrg, status, apiNameFlag } = config;
43
+ let agentsInOrg = [];
44
+ try {
45
+ agentsInOrg = await Agent.listRemote(conn);
46
+ }
47
+ catch (error) {
48
+ throw SfError.create({
49
+ message: 'Error listing agents in org',
50
+ name: 'NoAgentsInOrgError',
51
+ cause: error,
52
+ });
53
+ }
54
+ if (!agentsInOrg.length) {
55
+ throw messages.createError('error.noAgentsInOrg', [targetOrg.getUsername()]);
56
+ }
57
+ let selectedAgent;
58
+ if (apiNameFlag) {
59
+ selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === apiNameFlag);
60
+ if (!selectedAgent) {
61
+ throw messages.createError('error.missingAgentInOrg', [apiNameFlag, targetOrg.getUsername()]);
62
+ }
63
+ validateAgent(selectedAgent);
64
+ }
65
+ else {
66
+ const agentChoice = await select({
67
+ message: 'Select an agent',
68
+ choices: getAgentChoices(agentsInOrg, status),
69
+ });
70
+ selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === agentChoice.DeveloperName);
71
+ }
72
+ return new Agent({ connection: conn, nameOrId: selectedAgent.Id });
73
+ };
74
+ //# sourceMappingURL=agentActivation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agentActivation.js","sourceRoot":"","sources":["../src/agentActivation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAc,QAAQ,EAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAoB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBA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IAC/B,CAAC;SAAM,CAAC;QACN,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC;YAC/B,OAAO,EAAE,iBAAiB;YAC1B,OAAO,EAAE,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC;SAC9C,CAAC,CAAC;QACH,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,KAAK,WAAW,CAAC,aAAa,CAAC,CAAC;IACjG,CAAC;IAED,OAAO,IAAI,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAc,CAAC,EAAE,EAAE,CAAC,CAAC;AACtE,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export default class AgentActivate extends SfCommand<void> {
3
+ static readonly summary: string;
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
8
+ import { Messages } from '@salesforce/core';
9
+ import { getAgentForActivation } from '../../agentActivation.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.activate');
12
+ export default class AgentActivate extends SfCommand {
13
+ static summary = messages.getMessage('summary');
14
+ static description = messages.getMessage('description');
15
+ static examples = messages.getMessages('examples');
16
+ static flags = {
17
+ 'target-org': Flags.requiredOrg(),
18
+ 'api-version': Flags.orgApiVersion(),
19
+ 'api-name': Flags.string({
20
+ summary: messages.getMessage('flags.api-name.summary'),
21
+ char: 'n',
22
+ }),
23
+ };
24
+ async run() {
25
+ const { flags } = await this.parse(AgentActivate);
26
+ const apiNameFlag = flags['api-name'];
27
+ const targetOrg = flags['target-org'];
28
+ const conn = targetOrg.getConnection(flags['api-version']);
29
+ if (!apiNameFlag && this.jsonEnabled()) {
30
+ throw messages.createError('error.missingRequiredFlags', ['api-name']);
31
+ }
32
+ const agent = await getAgentForActivation({ conn, targetOrg, status: 'Active', apiNameFlag });
33
+ await agent.activate();
34
+ const agentName = (await agent.getBotMetadata()).DeveloperName;
35
+ this.log(`Agent ${agentName} activated.`);
36
+ }
37
+ }
38
+ //# sourceMappingURL=activate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activate.js","sourceRoot":"","sources":["../../../src/commands/agent/activate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;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,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,gBAAgB,CAAC,CAAC;AAErF,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAe;IACjD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IAC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': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
14
  name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
- spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
15
  "api-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
17
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
18
18
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
19
  };
@@ -0,0 +1,12 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ export default class AgentDeactivate extends SfCommand<void> {
3
+ static readonly summary: string;
4
+ static readonly description: string;
5
+ static readonly examples: string[];
6
+ static readonly flags: {
7
+ 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ 'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ };
11
+ run(): Promise<void>;
12
+ }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
8
+ import { Messages } from '@salesforce/core';
9
+ import { getAgentForActivation } from '../../agentActivation.js';
10
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
11
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.deactivate');
12
+ export default class AgentDeactivate extends SfCommand {
13
+ static summary = messages.getMessage('summary');
14
+ static description = messages.getMessage('description');
15
+ static examples = messages.getMessages('examples');
16
+ static flags = {
17
+ 'target-org': Flags.requiredOrg(),
18
+ 'api-version': Flags.orgApiVersion(),
19
+ 'api-name': Flags.string({
20
+ summary: messages.getMessage('flags.api-name.summary'),
21
+ char: 'n',
22
+ }),
23
+ };
24
+ async run() {
25
+ const { flags } = await this.parse(AgentDeactivate);
26
+ const apiNameFlag = flags['api-name'];
27
+ const targetOrg = flags['target-org'];
28
+ const conn = targetOrg.getConnection(flags['api-version']);
29
+ if (!apiNameFlag && this.jsonEnabled()) {
30
+ throw messages.createError('error.missingRequiredFlags', ['api-name']);
31
+ }
32
+ const agent = await getAgentForActivation({ conn, targetOrg, status: 'Inactive', apiNameFlag });
33
+ await agent.deactivate();
34
+ const agentName = (await agent.getBotMetadata()).DeveloperName;
35
+ this.log(`Agent ${agentName} deactivated.`);
36
+ }
37
+ }
38
+ //# sourceMappingURL=deactivate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deactivate.js","sourceRoot":"","sources":["../../../src/commands/agent/deactivate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;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,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAEvF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAe;IACnD,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SA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export default class AgentTestCreate extends SfCommand<AgentTestCreateResult> {
14
14
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
15
  preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
16
16
  'force-overwrite': import("@oclif/core/interfaces").BooleanFlag<boolean>;
17
- spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
17
  "api-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
19
  };
20
20
  private mso?;
21
21
  run(): Promise<AgentTestCreateResult>;
@@ -0,0 +1,27 @@
1
+ # summary
2
+
3
+ Activate an agent in an org.
4
+
5
+ # description
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.
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.
10
+
11
+ # examples
12
+
13
+ - Activate an agent in your default target org by being prompted:
14
+
15
+ <%= config.bin %> <%= command.id %>
16
+
17
+ - Activate an agent with API name Resort_Manager in the org with alias "my-org":
18
+
19
+ <%= config.bin %> <%= command.id %> --api-name Resort_Manager --target-org my-org
20
+
21
+ # flags.api-name.summary
22
+
23
+ API name of the agent to activate.
24
+
25
+ # error.missingRequiredFlags
26
+
27
+ Missing required flags: %s.
@@ -0,0 +1,15 @@
1
+ # error.noAgentsInOrg
2
+
3
+ No agents found in org %s.
4
+
5
+ # error.missingAgentInOrg
6
+
7
+ Agent %s not found in org %s.
8
+
9
+ # error.agentIsDeleted
10
+
11
+ Agent %s has been deleted and can't be activated.
12
+
13
+ # error.agentIsDefault
14
+
15
+ Agent %s is the default Agentforce agent in your org and you can't change its activation status.
@@ -0,0 +1,27 @@
1
+ # summary
2
+
3
+ Deactivate an agent in an org.
4
+
5
+ # description
6
+
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
+
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.
10
+
11
+ # examples
12
+
13
+ - Deactivate an agent in your default target org by being prompted:
14
+
15
+ <%= config.bin %> <%= command.id %>
16
+
17
+ - Deactivate the agent Resort_Manager in the org with alias "my_org":
18
+
19
+ <%= config.bin %> <%= command.id %> --api-name Resort_Manager --target-org my-org
20
+
21
+ # flags.api-name.summary
22
+
23
+ API name of the agent to deactivate.
24
+
25
+ # error.missingRequiredFlags
26
+
27
+ Missing required flags: %s.
@@ -12,6 +12,8 @@ To generate a specific agent test case, this command prompts you for this inform
12
12
  - Expected topic: API name of the topic you expect the agent to use when responding to the utterance.
13
13
  - Expected actions: One or more API names of the expection actions the agent takes.
14
14
  - Expected outcome: Natural language description of the outcome you expect.
15
+ - (Optional) Custom evaluation: Test an agent's response for specific strings or numbers.
16
+ - (Optional) Conversation history: Boilerplate for additional context you can add to the test in the form of a conversation history.
15
17
 
16
18
  When your test spec is ready, you then run the "agent test create" command to actually create the test in your org and synchronize the metadata with your DX project. The metadata type for an agent test is AiEvaluationDefinition.
17
19
 
@@ -10,7 +10,7 @@ This command is useful to test if the agent responds to your utterances as you e
10
10
 
11
11
  When the session concludes, the command asks if you want to save the API responses and chat transcripts. By default, the files are saved to the "./temp/agent-preview" directory. Specify a new default directory by setting the environment variable "SF_AGENT_PREVIEW_OUTPUT_DIR" to the directory. Or you can pass the directory to the --output-dir flag.
12
12
 
13
- Find the agent's API name in its main details page in your org's Agent page in Setup.
13
+ Find the agent's API name in its Agent Details page of your org's Agentforce Studio UI in Setup. If your agent is currently deactivated, use the "agent activate" CLI command to activate it.
14
14
 
15
15
  IMPORTANT: Before you use this command, you must complete a number of configuration steps in your org and your DX project. The examples in this help assume you've completed the steps. See "Preview an Agent" in the "Agentforce Developer Guide" for complete documentation: https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.
16
16
 
@@ -32,7 +32,7 @@ Enable Apex debug logging during the agent preview conversation.
32
32
 
33
33
  # examples
34
34
 
35
- - Interact with an agent with API name "Resort_Manager" in the org with alias "my-org" and the linked "agent-app" connected app:
35
+ - Interact with an agent with API name Resort_Manager in the org with alias "my-org" and the linked "agent-app" connected app:
36
36
 
37
37
  <%= config.bin %> <%= command.id %> --api-name Resort_Manager --target-org my-org --client-app agent-app
38
38