@salesforce/plugin-agent 1.26.5 → 1.26.7

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
@@ -112,7 +112,7 @@ EXAMPLES
112
112
  $ sf agent activate --api-name Resort_Manager --target-org my-org
113
113
  ```
114
114
 
115
- _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/activate.ts)_
115
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/activate.ts)_
116
116
 
117
117
  ## `sf agent create`
118
118
 
@@ -179,7 +179,7 @@ EXAMPLES
179
179
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
180
180
  ```
181
181
 
182
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/create.ts)_
182
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/create.ts)_
183
183
 
184
184
  ## `sf agent deactivate`
185
185
 
@@ -219,7 +219,7 @@ EXAMPLES
219
219
  $ sf agent deactivate --api-name Resort_Manager --target-org my-org
220
220
  ```
221
221
 
222
- _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/deactivate.ts)_
222
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/deactivate.ts)_
223
223
 
224
224
  ## `sf agent generate agent-spec`
225
225
 
@@ -326,7 +326,7 @@ EXAMPLES
326
326
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
327
327
  ```
328
328
 
329
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/generate/agent-spec.ts)_
329
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/generate/agent-spec.ts)_
330
330
 
331
331
  ## `sf agent generate authoring-bundle`
332
332
 
@@ -392,7 +392,7 @@ EXAMPLES
392
392
  other-package-dir/main/default --target-org my-dev-org
393
393
  ```
394
394
 
395
- _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/generate/authoring-bundle.ts)_
395
+ _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/generate/authoring-bundle.ts)_
396
396
 
397
397
  ## `sf agent generate template`
398
398
 
@@ -440,7 +440,7 @@ EXAMPLES
440
440
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
441
441
  ```
442
442
 
443
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/generate/template.ts)_
443
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/generate/template.ts)_
444
444
 
445
445
  ## `sf agent generate test-spec`
446
446
 
@@ -501,7 +501,7 @@ EXAMPLES
501
501
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
502
502
  ```
503
503
 
504
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/generate/test-spec.ts)_
504
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/generate/test-spec.ts)_
505
505
 
506
506
  ## `sf agent preview`
507
507
 
@@ -509,12 +509,10 @@ Interact with an agent to preview how it responds to your statements, questions,
509
509
 
510
510
  ```
511
511
  USAGE
512
- $ sf agent preview [--flags-dir <value>] [--api-version <value>] (-c <value> -o <value>) [-n <value>]
513
- [--authoring-bundle <value>] [-d <value>] [-x] [--use-live-actions]
512
+ $ sf agent preview -o <value> [--flags-dir <value>] [--api-version <value>] [-n <value>] [--authoring-bundle
513
+ <value>] [-d <value>] [-x] [--use-live-actions]
514
514
 
515
515
  FLAGS
516
- -c, --client-app=<value> Name of the linked client app to use for the connection to the published and active
517
- agent.
518
516
  -d, --output-dir=<value> Directory where conversation transcripts are saved.
519
517
  -n, --api-name=<value> API name of the published and active agent you want to interact with.
520
518
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
@@ -532,45 +530,41 @@ GLOBAL FLAGS
532
530
  DESCRIPTION
533
531
  Interact with an agent to preview how it responds to your statements, questions, and commands (utterances).
534
532
 
535
- Use this command to have a natural language conversation with an agent while you code its Agent Script file.
536
- Previewing an agent works like an initial test to make sure it responds to your utterances as you expect. For example,
537
- you can test that the agent uses a particular topic when asked a question, and then whether it invokes the correct
538
- action associated with that topic. This command is the CLI-equivalent of the Preview panel in your org's Agentforce
539
- Builder UI.
533
+ Use this command to have a natural language conversation with an agent, either while you code its local Agent Script
534
+ file or when it's published to an org. Previewing an agent acts like an initial test to make sure it responds to your
535
+ utterances as you expect. For example, you can test that the agent uses a particular topic when asked a question, and
536
+ then whether it invokes the correct action associated with that topic. This command is the CLI-equivalent of the
537
+ Preview panel in your org's Agentforce Builder UI.
540
538
 
541
- This command uses the agent's local authoring bundle, which contains its Agent Script file. You can let the command
542
- provide a list of authoring bundles (labeled "(Agent Script)") to choose from or use the --authoring-bundle flag to
543
- specify a bundle's API name.
539
+ Run without flags, this command provides a list of agents to preview, divided into two categories: "Agent Script",
540
+ which are agents that have a local authoring bundle in your DX project, or "Published", which are agents that are
541
+ published and activated in your org. Authoring bundles contain an agent's Agent Script file. You then choose the agent
542
+ you want to preview from the list. Or you can use the --authoring-bundle flag to specify a local authoring bundle's
543
+ API name or --api-name to specify an activated published agent.
544
544
 
545
- You can use these two modes when previewing an agent from its Agent Script file:
545
+ When previewing an agent from its Agent Script file, you can use these two modes:
546
546
 
547
547
  - Simulated mode (Default): Uses only the Agent Script file to converse, and it simulates (mocks) all the actions. Use
548
- this mode if none of the Apex classes, flows, and prompt templates that implement your actions are available yet. The
548
+ this mode if none of the Apex classes, flows, or prompt templates that implement your actions are available yet. The
549
549
  LLM uses the information about topics in the Agent Script file to simulate what the action does or how it responds.
550
550
  - Live mode: Uses the actual Apex classes, flows, and prompt templates in your development org in the agent preview.
551
551
  If you've changed the Apex classe, flows, or prompt templates in your local DX project, then you must deploy them to
552
- your development org if you want to use them in your live preview. You can use the Apex Replay Debugger to debug your
553
- Apex classes when using live mode.
552
+ your development org if you want to use them in your live preview.
554
553
 
555
- The interface is simple: in the "Start typing..." prompt, enter a statement, question, or command; when you're done,
556
- enter Return. Your utterance is posted on the right along with a timestamp. The agent then responds on the left. To
557
- exit the conversation, hit ESC or Control+C.
554
+ You can use the Apex Replay Debugger to debug your Apex classes when using live mode for Agent Script files and for
555
+ activated published agents; specify the --apex-debug flag.
556
+
557
+ Once connected to your agent, the preview interface is simple: in the "Start typing..." prompt, enter a statement,
558
+ question, or command; when you're done, enter Return. Your utterance is posted on the right along with a timestamp.
559
+ The agent then responds on the left. To exit the conversation, hit ESC or Control+C.
558
560
 
559
561
  When the session concludes, the command asks if you want to save the API responses and chat transcripts. By default,
560
562
  the files are saved to the "./temp/agent-preview" directory. Specify a new default directory with the --output-dir
561
563
  flag.
562
564
 
563
- NOTE: You can also use this command to connect to a published and active agent, which are labeled "(Published)" if you
564
- let this command provide the list of agents to preview. That use case, however, requires additional security and
565
- configuration in both your org and your DX project. The examples in this help are for previewing an agent from its
566
- Agent Script file in your DX project and require only simple authorization of your org, such as with the "org login
567
- web" command. The --client-app and --api-name flags are used only for previewing published and active agents, they
568
- don't apply to Agent Script agents. See "Connect to a Published Agent" in the "Agentforce Developer Guide" for
569
- complete documentation: https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.
570
-
571
565
  EXAMPLES
572
- Preview an agent in simulated mode by choosing from a list of authoring bundles provided by the command; use the org
573
- with alias "my-dev-org":
566
+ Preview an agent by choosing from the list of available local Agent Script or published agents. If previewing a
567
+ local Agent Script agent, use simulated mode. Use the org with alias "my-dev-org".
574
568
 
575
569
  $ sf agent preview --target-org my-dev-org
576
570
 
@@ -580,7 +574,7 @@ EXAMPLES
580
574
  $ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
581
575
  ```
582
576
 
583
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/preview.ts)_
577
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/preview.ts)_
584
578
 
585
579
  ## `sf agent publish authoring-bundle`
586
580
 
@@ -627,7 +621,7 @@ EXAMPLES
627
621
  $ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
628
622
  ```
629
623
 
630
- _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/publish/authoring-bundle.ts)_
624
+ _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/publish/authoring-bundle.ts)_
631
625
 
632
626
  ## `sf agent test create`
633
627
 
@@ -682,7 +676,7 @@ EXAMPLES
682
676
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
683
677
  ```
684
678
 
685
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/test/create.ts)_
679
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/test/create.ts)_
686
680
 
687
681
  ## `sf agent test list`
688
682
 
@@ -717,7 +711,7 @@ EXAMPLES
717
711
  $ sf agent test list --target-org my-org
718
712
  ```
719
713
 
720
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/test/list.ts)_
714
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/test/list.ts)_
721
715
 
722
716
  ## `sf agent test results`
723
717
 
@@ -783,7 +777,7 @@ FLAG DESCRIPTIONS
783
777
  expression when using custom evaluations.
784
778
  ```
785
779
 
786
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/test/results.ts)_
780
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/test/results.ts)_
787
781
 
788
782
  ## `sf agent test resume`
789
783
 
@@ -856,7 +850,7 @@ FLAG DESCRIPTIONS
856
850
  expression when using custom evaluations.
857
851
  ```
858
852
 
859
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/test/resume.ts)_
853
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/test/resume.ts)_
860
854
 
861
855
  ## `sf agent test run`
862
856
 
@@ -930,7 +924,7 @@ FLAG DESCRIPTIONS
930
924
  expression when using custom evaluations.
931
925
  ```
932
926
 
933
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/test/run.ts)_
927
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/test/run.ts)_
934
928
 
935
929
  ## `sf agent validate authoring-bundle`
936
930
 
@@ -977,6 +971,6 @@ EXAMPLES
977
971
  $ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
978
972
  ```
979
973
 
980
- _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.5/src/commands/agent/validate/authoring-bundle.ts)_
974
+ _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.26.7/src/commands/agent/validate/authoring-bundle.ts)_
981
975
 
982
976
  <!-- commandsstop -->
@@ -1,5 +1,5 @@
1
- import { Connection, Org } from '@salesforce/core';
2
- import { Agent, type BotMetadata } from '@salesforce/agents';
1
+ import { Org } from '@salesforce/core';
2
+ import { type BotMetadata, ProductionAgent } from '@salesforce/agents';
3
3
  type Choice<Value> = {
4
4
  value: Value;
5
5
  name?: string;
@@ -14,9 +14,8 @@ export declare const agentIsUnsupported: (devName: string) => boolean;
14
14
  export declare const validateAgent: (agent: BotMetadata) => boolean;
15
15
  export declare const getAgentChoices: (agents: BotMetadata[], status: "Active" | "Inactive") => Array<Choice<AgentValue>>;
16
16
  export declare const getAgentForActivation: (config: {
17
- conn: Connection;
18
17
  targetOrg: Org;
19
18
  status: "Active" | "Inactive";
20
19
  apiNameFlag?: string;
21
- }) => Promise<Agent>;
20
+ }) => Promise<ProductionAgent>;
22
21
  export {};
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Messages, SfError } from '@salesforce/core';
16
+ import { Messages, SfError, SfProject } from '@salesforce/core';
17
17
  import { Agent } from '@salesforce/agents';
18
18
  import { select } from '@inquirer/prompts';
19
19
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
@@ -48,10 +48,10 @@ export const getAgentChoices = (agents, status) => agents.map((agent) => {
48
48
  };
49
49
  });
50
50
  export const getAgentForActivation = async (config) => {
51
- const { conn, targetOrg, status, apiNameFlag } = config;
51
+ const { targetOrg, status, apiNameFlag } = config;
52
52
  let agentsInOrg = [];
53
53
  try {
54
- agentsInOrg = await Agent.listRemote(conn);
54
+ agentsInOrg = await Agent.listRemote(targetOrg.getConnection());
55
55
  }
56
56
  catch (error) {
57
57
  throw SfError.create({
@@ -78,6 +78,10 @@ export const getAgentForActivation = async (config) => {
78
78
  });
79
79
  selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === agentChoice.DeveloperName);
80
80
  }
81
- return new Agent({ connection: conn, nameOrId: selectedAgent.Id });
81
+ return Agent.init({
82
+ connection: targetOrg.getConnection(),
83
+ apiNameOrId: selectedAgent.Id,
84
+ project: SfProject.getInstance(),
85
+ });
82
86
  };
83
87
  //# sourceMappingURL=agentActivation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agentActivation.js","sourceRoot":"","sources":["../src/agentActivation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAc,QAAQ,EAAO,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAoB,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAY3C,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,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5E,CAAC;IACD,IAAI,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5C,MAAM,QAAQ,CAAC,WAAW,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,CAA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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,KAAK,CAAC,IAAI,CAAC;QAChB,UAAU,EAAE,SAAS,CAAC,aAAa,EAAE;QACrC,WAAW,EAAE,aAAc,CAAC,EAAE;QAC9B,OAAO,EAAE,SAAS,CAAC,WAAW,EAAE;KACjC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -34,11 +34,10 @@ export default class AgentActivate extends SfCommand {
34
34
  const { flags } = await this.parse(AgentActivate);
35
35
  const apiNameFlag = flags['api-name'];
36
36
  const targetOrg = flags['target-org'];
37
- const conn = targetOrg.getConnection(flags['api-version']);
38
37
  if (!apiNameFlag && this.jsonEnabled()) {
39
38
  throw messages.createError('error.missingRequiredFlags', ['api-name']);
40
39
  }
41
- const agent = await getAgentForActivation({ conn, targetOrg, status: 'Active', apiNameFlag });
40
+ const agent = await getAgentForActivation({ targetOrg, status: 'Active', apiNameFlag });
42
41
  await agent.activate();
43
42
  const agentName = (await agent.getBotMetadata()).DeveloperName;
44
43
  this.log(`Agent ${agentName} activated.`);
@@ -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,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,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W,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,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC;QACxF,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC;QAE/D,IAAI,CAAC,GAAG,CAAC,SAAS,SAAS,aAAa,CAAC,CAAC;IAC5C,CAAC"}
@@ -34,11 +34,10 @@ export default class AgentDeactivate extends SfCommand {
34
34
  const { flags } = await this.parse(AgentDeactivate);
35
35
  const apiNameFlag = flags['api-name'];
36
36
  const targetOrg = flags['target-org'];
37
- const conn = targetOrg.getConnection(flags['api-version']);
38
37
  if (!apiNameFlag && this.jsonEnabled()) {
39
38
  throw messages.createError('error.missingRequiredFlags', ['api-name']);
40
39
  }
41
- const agent = await getAgentForActivation({ conn, targetOrg, status: 'Inactive', apiNameFlag });
40
+ const agent = await getAgentForActivation({ targetOrg, status: 'Inactive', apiNameFlag });
42
41
  await agent.deactivate();
43
42
  const agentName = (await agent.getBotMetadata()).DeveloperName;
44
43
  this.log(`Agent ${agentName} deactivated.`);
@@ -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,kBAA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BAAwB,CAAC;YACtD,IAAI,EAAE,GAAG;SACV,CAAC;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,KAAK,CAAC,UAAU,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,aAAa,CAAC;QAE/D,IAAI,CAAC,GAAG,CAAC,SAAS,SAAS,eAAe,CAAC,CAAC;IAC9C,CAAC"}
@@ -17,11 +17,11 @@ import { join, resolve } from 'node:path';
17
17
  import { readFileSync, existsSync } from 'node:fs';
18
18
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
19
19
  import { generateApiName, Messages, SfError } from '@salesforce/core';
20
- import { Agent } from '@salesforce/agents';
20
+ import { ScriptAgent } from '@salesforce/agents';
21
21
  import YAML from 'yaml';
22
22
  import { input as inquirerInput } from '@inquirer/prompts';
23
23
  import { theme } from '../../../inquirer-theme.js';
24
- import { promptForFlag, promptForYamlFile } from '../../../flags.js';
24
+ import { promptForFlag, promptForSpecYaml } from '../../../flags.js';
25
25
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
26
26
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.authoring-bundle');
27
27
  export default class AgentGenerateAuthoringBundle extends SfCommand {
@@ -89,9 +89,9 @@ export default class AgentGenerateAuthoringBundle extends SfCommand {
89
89
  };
90
90
  async run() {
91
91
  const { flags } = await this.parse(AgentGenerateAuthoringBundle);
92
- const { 'output-dir': outputDir, 'target-org': targetOrg } = flags;
92
+ const { 'output-dir': outputDir } = flags;
93
93
  // If we don't have a spec yet, prompt for it
94
- const spec = flags.spec ?? (await promptForYamlFile(AgentGenerateAuthoringBundle.FLAGGABLE_PROMPTS['spec']));
94
+ const spec = flags.spec ?? (await promptForSpecYaml(AgentGenerateAuthoringBundle.FLAGGABLE_PROMPTS['spec']));
95
95
  // If we don't have a name yet, prompt for it
96
96
  const name = flags['name'] ?? (await promptForFlag(AgentGenerateAuthoringBundle.FLAGGABLE_PROMPTS['name']));
97
97
  // If we don't have an api name yet, prompt for it
@@ -116,11 +116,10 @@ export default class AgentGenerateAuthoringBundle extends SfCommand {
116
116
  const agentPath = join(targetOutputDir, `${bundleApiName}.agent`);
117
117
  const metaXmlPath = join(targetOutputDir, `${bundleApiName}.bundle-meta.xml`);
118
118
  // Write Agent file
119
- const conn = targetOrg.getConnection(flags['api-version']);
120
- const specContents = YAML.parse(readFileSync(spec, 'utf8'));
121
- await Agent.createAuthoringBundle({
122
- connection: conn,
123
- agentSpec: { ...specContents, ...{ name, developerName: bundleApiName } },
119
+ await ScriptAgent.createAuthoringBundle({
120
+ agentSpec: spec
121
+ ? { ...YAML.parse(readFileSync(spec, 'utf8')), ...{ name, developerName: bundleApiName } }
122
+ : undefined,
124
123
  project: this.project,
125
124
  bundleApiName,
126
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"authoring-bundle.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/authoring-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,M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AE,EAAE;oBAC5G,CAAC,CAAC,SAAS;gBACb,OAAO,EAAE,IAAI,CAAC,OAAQ;gBACtB,aAAa;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,UAAU,CAAC,0BAA0B,aAAa,mBAAmB,CAAC,CAAC;YAE5E,OAAO;gBACL,SAAS;gBACT,WAAW;gBACX,SAAS,EAAE,eAAe;aAC3B,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,MAAM,IAAI,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC,EAAE,sBAAsB,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;QAChH,CAAC;IACH,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
- import { AuthInfo } from '@salesforce/core';
3
2
  type BotVersionStatus = {
4
3
  Status: 'Active' | 'Inactive';
5
4
  };
@@ -22,7 +21,6 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
22
21
  static readonly flags: {
23
22
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
24
23
  'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
- 'client-app': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
24
  'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
25
  'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
26
  'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
@@ -30,10 +28,8 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
30
28
  'use-live-actions': import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
29
  };
32
30
  run(): Promise<AgentPreviewResult>;
33
- private getAgentChoices;
34
31
  }
35
32
  export declare const agentIsUnsupported: (devName: string) => boolean;
36
33
  export declare const agentIsInactive: (agent: AgentData) => boolean;
37
34
  export declare const validateAgent: (agent: AgentData) => boolean;
38
- export declare const getClientAppsFromAuth: (authInfo: AuthInfo) => string[];
39
35
  export {};
@@ -13,25 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import * as path from 'node:path';
17
- import { join, resolve } from 'node:path';
18
- import { globSync } from 'glob';
16
+ import { resolve } from 'node:path';
19
17
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
20
- import { AuthInfo, Connection, Lifecycle, Logger, Messages, SfError } from '@salesforce/core';
21
18
  import React from 'react';
22
19
  import { render } from 'ink';
23
- import { AgentPreview as Preview, AgentSimulate, AgentSource, findAuthoringBundle, } from '@salesforce/agents';
20
+ import { Agent, AgentSource, ProductionAgent, ScriptAgent } from '@salesforce/agents';
24
21
  import { select } from '@inquirer/prompts';
22
+ import { Lifecycle, Messages, SfError } from '@salesforce/core';
25
23
  import { AgentPreviewReact } from '../../components/agent-preview-react.js';
26
24
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
27
25
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview');
28
- let logger;
29
- const getLogger = () => {
30
- if (!logger) {
31
- logger = Logger.childFromRoot('plugin-agent-preview');
32
- }
33
- return logger;
34
- };
35
26
  // https://developer.salesforce.com/docs/einstein/genai/guide/agent-api-get-started.html#prerequisites
36
27
  export const UNSUPPORTED_AGENTS = ['Copilot_for_Salesforce'];
37
28
  export default class AgentPreview extends SfCommand {
@@ -44,11 +35,6 @@ export default class AgentPreview extends SfCommand {
44
35
  static flags = {
45
36
  'target-org': Flags.requiredOrg(),
46
37
  'api-version': Flags.orgApiVersion(),
47
- 'client-app': Flags.string({
48
- char: 'c',
49
- summary: messages.getMessage('flags.client-app.summary'),
50
- dependsOn: ['target-org'],
51
- }),
52
38
  'api-name': Flags.string({
53
39
  summary: messages.getMessage('flags.api-name.summary'),
54
40
  char: 'n',
@@ -74,124 +60,60 @@ export default class AgentPreview extends SfCommand {
74
60
  // get user's agent selection either from flags, or interaction
75
61
  // if .agent selected, use the AgentSimulate class to preview
76
62
  // if published agent, use AgentPreview for preview
77
- // based on agent, differing auth mechanisms required
78
63
  const { flags } = await this.parse(AgentPreview);
79
- const { 'api-name': apiNameFlag, 'use-live-actions': useLiveActions } = flags;
64
+ const { 'api-name': apiNameOrId, 'use-live-actions': useLiveActions, 'authoring-bundle': aabName } = flags;
80
65
  const conn = flags['target-org'].getConnection(flags['api-version']);
81
- const agentsInOrg = (await conn.query('SELECT Id, DeveloperName, (SELECT Status FROM BotVersions) FROM BotDefinition WHERE IsDeleted = false')).records;
82
66
  let selectedAgent;
83
- if (flags['authoring-bundle']) {
84
- // user specified --authoring-bundle, we'll find the script and use it
85
- const bundlePath = findAuthoringBundle(this.project.getPath(), flags['authoring-bundle']);
86
- if (!bundlePath) {
87
- throw new SfError(`Could not find authoring bundle for ${flags['authoring-bundle']}`);
88
- }
89
- selectedAgent = {
90
- DeveloperName: flags['authoring-bundle'],
91
- source: AgentSource.SCRIPT,
92
- path: join(bundlePath, `${flags['authoring-bundle']}.agent`),
93
- };
67
+ if (aabName) {
68
+ // user specified --authoring-bundle, use the API name directly
69
+ selectedAgent = await Agent.init({ connection: conn, project: this.project, aabName });
94
70
  }
95
- else if (apiNameFlag) {
96
- // user specified --api-name, it should be in the list of agents from the org
97
- const agent = agentsInOrg.find((a) => a.DeveloperName === apiNameFlag);
98
- if (!agent)
99
- throw new Error(`No valid Agents were found with the Api Name ${apiNameFlag}.`);
100
- validateAgent(agent);
101
- selectedAgent = {
102
- Id: agent.Id,
103
- DeveloperName: agent.DeveloperName,
104
- source: AgentSource.PUBLISHED,
105
- };
106
- if (!selectedAgent)
107
- throw new Error(`No valid Agents were found with the Api Name ${apiNameFlag}.`);
71
+ else if (apiNameOrId) {
72
+ selectedAgent = await Agent.init({ connection: conn, project: this.project, apiNameOrId });
108
73
  }
109
74
  else {
110
- selectedAgent = await select({
75
+ const previewableAgents = await Agent.listPreviewable(conn, this.project);
76
+ const choices = previewableAgents.map((agent) => ({
77
+ name: agent.source === AgentSource.PUBLISHED ? `${agent.name} (Published)` : `${agent.name} (Agent Script)`,
78
+ value: agent,
79
+ }));
80
+ const choice = await select({
111
81
  message: 'Select an agent',
112
- choices: this.getAgentChoices(agentsInOrg),
82
+ choices,
113
83
  });
114
- }
115
- // we have the selected agent, create the appropriate connection
116
- const authInfo = await AuthInfo.create({
117
- username: flags['target-org'].getUsername(),
118
- });
119
- // Get client app - check flag first, then auth file, then env var
120
- let clientApp = flags['client-app'];
121
- if (!clientApp && selectedAgent?.source === AgentSource.PUBLISHED) {
122
- const clientApps = getClientAppsFromAuth(authInfo);
123
- if (clientApps.length === 1) {
124
- clientApp = clientApps[0];
125
- }
126
- else if (clientApps.length > 1) {
127
- clientApp = await select({
128
- message: 'Select a client app',
129
- choices: clientApps.map((app) => ({ value: app, name: app })),
84
+ if (choice.source === AgentSource.SCRIPT && choice.name) {
85
+ // Use the API name directly
86
+ selectedAgent = await Agent.init({
87
+ connection: conn,
88
+ project: this.project,
89
+ aabName: choice.name,
130
90
  });
91
+ selectedAgent.preview.setMockMode(flags['use-live-actions'] ? 'Live Test' : 'Mock');
131
92
  }
132
93
  else {
133
- throw new SfError('No client app found.');
94
+ selectedAgent = await Agent.init({
95
+ connection: conn,
96
+ project: this.project,
97
+ // developerName will be set at this point since the user selected a production agent, even ID will be defined
98
+ apiNameOrId: choice.developerName ?? choice.id ?? '',
99
+ });
134
100
  }
135
101
  }
136
- if (useLiveActions && selectedAgent.source === AgentSource.PUBLISHED) {
102
+ if (useLiveActions && selectedAgent instanceof ProductionAgent) {
137
103
  void Lifecycle.getInstance().emitWarning('Published agents will always use real actions in your org, specifying --use-live-actions and selecting a published agent has no effect');
138
104
  }
139
- const jwtConn = selectedAgent?.source === AgentSource.PUBLISHED
140
- ? await Connection.create({
141
- authInfo,
142
- clientApp,
143
- })
144
- : await Connection.create({ authInfo });
145
105
  // Only resolve outputDir if explicitly provided via flag
146
106
  // Otherwise, let user decide when exiting
147
107
  const outputDir = flags['output-dir'] ? resolve(flags['output-dir']) : undefined;
148
- // Both classes share the same interface for the methods we need
149
- const agentPreview = selectedAgent.source === AgentSource.PUBLISHED
150
- ? new Preview(jwtConn, selectedAgent.Id)
151
- : new AgentSimulate(jwtConn, selectedAgent.path, !useLiveActions);
152
- agentPreview.setApexDebugMode(flags['apex-debug']);
108
+ selectedAgent.preview.setApexDebugging(flags['apex-debug']);
153
109
  const instance = render(React.createElement(AgentPreviewReact, {
154
- connection: conn,
155
- agent: agentPreview,
156
- name: selectedAgent.DeveloperName,
110
+ agent: selectedAgent.preview,
111
+ name: selectedAgent.name ?? '',
157
112
  outputDir,
158
- isLocalAgent: selectedAgent.source === AgentSource.SCRIPT,
159
- apexDebug: flags['apex-debug'],
160
- logger: getLogger(),
113
+ isLocalAgent: selectedAgent instanceof ScriptAgent,
161
114
  }), { exitOnCtrlC: false });
162
115
  await instance.waitUntilExit();
163
116
  }
164
- getAgentChoices(agents) {
165
- const choices = [];
166
- // Add org agents
167
- for (const agent of agents) {
168
- if (agentIsInactive(agent) || agentIsUnsupported(agent.DeveloperName)) {
169
- continue;
170
- }
171
- choices.push({
172
- name: `${agent.DeveloperName} (Published)`,
173
- value: {
174
- Id: agent.Id,
175
- DeveloperName: agent.DeveloperName,
176
- source: AgentSource.PUBLISHED,
177
- },
178
- });
179
- }
180
- // Add local agents from .agent files
181
- const localAgentPaths = globSync('**/*.agent', { cwd: this.project.getPath() });
182
- for (const agentPath of localAgentPaths) {
183
- const agentName = path.basename(agentPath, '.agent');
184
- choices.push({
185
- name: `${agentName} (Agent Script)`,
186
- value: {
187
- DeveloperName: agentName,
188
- source: AgentSource.SCRIPT,
189
- path: path.join(this.project.getPath(), agentPath),
190
- },
191
- });
192
- }
193
- return choices;
194
- }
195
117
  }
196
118
  export const agentIsUnsupported = (devName) => UNSUPPORTED_AGENTS.includes(devName);
197
119
  export const agentIsInactive = (agent) =>
@@ -210,5 +132,4 @@ export const validateAgent = (agent) => {
210
132
  }
211
133
  return true;
212
134
  };
213
- export const getClientAppsFromAuth = (authInfo) => Object.keys(authInfo.getFields().clientApps ?? {});
214
135
  //# sourceMappingURL=preview.js.map