@salesforce/plugin-agent 1.24.14-demo.8 → 1.24.14-nga.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -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.24.14-demo.8/src/commands/agent/activate.ts)_
115
+ _See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/activate.ts)_
116
116
 
117
117
  ## `sf agent create`
118
118
 
@@ -174,7 +174,7 @@ EXAMPLES
174
174
  $ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
175
175
  ```
176
176
 
177
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/create.ts)_
177
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/create.ts)_
178
178
 
179
179
  ## `sf agent deactivate`
180
180
 
@@ -214,7 +214,7 @@ EXAMPLES
214
214
  $ sf agent deactivate --api-name Resort_Manager --target-org my-org
215
215
  ```
216
216
 
217
- _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/deactivate.ts)_
217
+ _See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/deactivate.ts)_
218
218
 
219
219
  ## `sf agent generate agent-spec`
220
220
 
@@ -319,11 +319,11 @@ EXAMPLES
319
319
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
320
320
  ```
321
321
 
322
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/agent-spec.ts)_
322
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/generate/agent-spec.ts)_
323
323
 
324
324
  ## `sf agent generate authoring-bundle`
325
325
 
326
- Generate an authoring bundle from an agent specification.
326
+ Generate a local authoring bundle from an existing agent spec YAML file.
327
327
 
328
328
  ```
329
329
  USAGE
@@ -331,13 +331,13 @@ USAGE
331
331
  <value>] [-d <value>] [-n <value>]
332
332
 
333
333
  FLAGS
334
- -d, --output-dir=<value> Directory where the authoring bundle files will be generated.
335
- -f, --spec=<value> Path to the agent specification file.
334
+ -d, --output-dir=<value> Directory where the authoring bundle files are generated.
335
+ -f, --spec=<value> Path to the agent spec YAML file.
336
336
  -n, --name=<value> Name (label) of the authoring bundle.
337
337
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
338
338
  configuration variable is already set.
339
339
  --api-name=<value> API name of the new authoring bundle; if not specified, the API name is derived from the
340
- authoring bundle name (label); the API name must not exist in the org.
340
+ authoring bundle name (label); the API name can't exist in the org.
341
341
  --api-version=<value> Override the api version used for api requests made by this command
342
342
 
343
343
  GLOBAL FLAGS
@@ -345,22 +345,29 @@ GLOBAL FLAGS
345
345
  --json Format output as json.
346
346
 
347
347
  DESCRIPTION
348
- Generate an authoring bundle from an agent specification.
348
+ Generate a local authoring bundle from an existing agent spec YAML file.
349
349
 
350
- Generates an authoring bundle containing Agent and its meta.xml file from an agent specification file.
350
+ Authoring bundles are metadata types that represent the next-gen Salesforce agents. Their exact metadata name is
351
+ AiAuthoringBundle and they consist of a standard "\*-meta.xml" metadata file and an agent file (with extension
352
+ ".agent") that fully describes the next-gen agent. Use this command to generate an authoring bundle based on an agent
353
+ spec YAML file, which you create with the "agent create agent-spec" command.
354
+
355
+ By default, authoring bundles are generated in the force-app/main/default/aiAuthoringBundles/<api-name> directory. Use
356
+ the --output-dir to generate them elsewhere.
351
357
 
352
358
  EXAMPLES
353
- Generate an authoring bundle from a specification file:
359
+ Generate an authoring bundle from the "specs/agentSpec.yaml" agent spec YAML file and give it the label "My
360
+ Authoring Bundle":
354
361
 
355
- $ sf agent generate authoring-bundle --spec-file path/to/spec.yaml --name "My Authoring Bundle"
362
+ $ sf agent generate authoring-bundle --spec-file specs/agentSpec.yaml --name "My Authoring Bundle"
356
363
 
357
- Generate an authoring bundle with a custom output directory:
364
+ Same as previous example, but generate the files in the other-package-dir/main/default/aiAuthoringBundles directory:
358
365
 
359
- $ sf agent generate authoring-bundle --spec-file path/to/spec.yaml --name "My Authoring Bundle" --output-dir \
360
- path/to/output
366
+ $ sf agent generate authoring-bundle --spec-file specs/agentSpec.yaml --name "My Authoring Bundle" --output-dir \
367
+ other-package-dir/main/default/aiAuthoringBundles
361
368
  ```
362
369
 
363
- _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/authoring-bundle.ts)_
370
+ _See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/generate/authoring-bundle.ts)_
364
371
 
365
372
  ## `sf agent generate template`
366
373
 
@@ -408,7 +415,7 @@ EXAMPLES
408
415
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
409
416
  ```
410
417
 
411
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/template.ts)_
418
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/generate/template.ts)_
412
419
 
413
420
  ## `sf agent generate test-spec`
414
421
 
@@ -469,7 +476,7 @@ EXAMPLES
469
476
  force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
470
477
  ```
471
478
 
472
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/generate/test-spec.ts)_
479
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/generate/test-spec.ts)_
473
480
 
474
481
  ## `sf agent preview`
475
482
 
@@ -478,19 +485,19 @@ Interact with an active agent to preview how the agent responds to your statemen
478
485
  ```
479
486
  USAGE
480
487
  $ sf agent preview [--flags-dir <value>] [--api-version <value>] (-c <value> -o <value>) [-n <value>]
481
- [--authoring-bundle <value>] [-d <value>] [-x]
488
+ [--authoring-bundle <value>] [-d <value>] [-x] [--use-live-actions]
482
489
 
483
490
  FLAGS
484
- -c, --client-app=<value> Name of the linked client app to use for the agent connection. You must have
485
- previously created this link with "org login web --client-app". Run "org display" to
486
- see the available linked client apps.
491
+ -c, --client-app=<value> Name of the linked client app to use for the agent connection.
487
492
  -d, --output-dir=<value> Directory where conversation transcripts are saved.
488
493
  -n, --api-name=<value> API name of the agent you want to interact with.
489
494
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
490
495
  configuration variable is already set.
491
496
  -x, --apex-debug Enable Apex debug logging during the agent preview conversation.
492
497
  --api-version=<value> Override the api version used for api requests made by this command
493
- --authoring-bundle=<value> Preview an ephemeral agent by specifying the API name of the Authoring Bundle metadata
498
+ --authoring-bundle=<value> Preview a next-gen agent by specifying the API name of the authoring bundle metadata
499
+ component that implements it.
500
+ --use-live-actions Use real actions in the org; if not specified, preview uses AI to mock actions.
494
501
 
495
502
  GLOBAL FLAGS
496
503
  --flags-dir=<value> Import flag values from a directory.
@@ -517,8 +524,9 @@ DESCRIPTION
517
524
  currently deactivated, use the "agent activate" CLI command to activate it.
518
525
 
519
526
  IMPORTANT: Before you use this command, you must complete a number of configuration steps in your org and your DX
520
- project. The examples in this help assume you've completed the steps. See "Preview an Agent" in the "Agentforce
521
- Developer Guide" for complete documentation:
527
+ project. For example, you must first create the link to a client connected app using the "org login web --client-app"
528
+ CLI command to then get the value of the --client-app flag of this command. The examples in this help assume you've
529
+ completed the steps. See "Preview an Agent" in the "Agentforce Developer Guide" for complete documentation:
522
530
  https://developer.salesforce.com/docs/einstein/genai/guide/agent-dx-preview.html.
523
531
 
524
532
  EXAMPLES
@@ -534,18 +542,18 @@ EXAMPLES
534
542
  transcripts/my-preview
535
543
  ```
536
544
 
537
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/preview.ts)_
545
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/preview.ts)_
538
546
 
539
547
  ## `sf agent publish authoring-bundle`
540
548
 
541
- Publish an Agent Authoring Bundle as a new agent
549
+ Publish an authoring bundle to your org, which results in a new next-gen agent.
542
550
 
543
551
  ```
544
552
  USAGE
545
553
  $ sf agent publish authoring-bundle -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
546
554
 
547
555
  FLAGS
548
- -n, --api-name=<value> API name of the Agent Authoring Bundle to publish.
556
+ -n, --api-name=<value> API name of the authoring bundle you want to publish.
549
557
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
550
558
  configuration variable is already set.
551
559
  --api-version=<value> Override the api version used for api requests made by this command
@@ -555,18 +563,29 @@ GLOBAL FLAGS
555
563
  --json Format output as json.
556
564
 
557
565
  DESCRIPTION
558
- Publish an Agent Authoring Bundle as a new agent
566
+ Publish an authoring bundle to your org, which results in a new next-gen agent.
567
+
568
+ When you publish an authoring bundle to your org, a number of things happen. First, this command validates that the
569
+ agent file (with extension ".agent") successfully compiles. Then the authoring bundle metadata component is deployed
570
+ to the org, and all associated metadata components, such as the Bot, BotVersion, and GenAiXXX components, are either
571
+ created or updated. The org then creates a new next-gen agent based on the deployed authoring bundle and associated
572
+ metadata. Finally, all the metadata associated with the new agent is retrieved back to your local DX project.
573
+
574
+ Authoring bundles are metadata types that represent the next-gen Salesforce agents. Their exact metadata name is
575
+ AiAuthoringBundle and they consist of a standard "\*-meta.xml" metadata file and an agent file (with extension
576
+ ".agent") that fully describes the next-gen agent.
559
577
 
560
- Publishes an Agent Authoring Bundle by compiling the .agent file and creating a new agent in your org.
578
+ This command requires the API name of the authoring bundle; if you don't provide it with the --api-name flag, the
579
+ command prompts you for it.
561
580
 
562
581
  EXAMPLES
563
- Publish an Agent Authoring Bundle:
582
+ Publish an authoring bundle with API name MyAuthoringBundle to the org with alias "my-org", resulting in a new agent
583
+ named "My Fab Agent"::
564
584
 
565
- $ sf agent publish authoring-bundle --api-name path/to/bundle --agent-name "My New Agent" --target-org \
566
- myorg@example.com
585
+ $ sf agent publish authoring-bundle --api-name MyAuthoringbundle --agent-name "My Fab Agent" --target-org my-org
567
586
  ```
568
587
 
569
- _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/publish/authoring-bundle.ts)_
588
+ _See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/publish/authoring-bundle.ts)_
570
589
 
571
590
  ## `sf agent test create`
572
591
 
@@ -621,7 +640,7 @@ EXAMPLES
621
640
  $ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
622
641
  ```
623
642
 
624
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/create.ts)_
643
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/test/create.ts)_
625
644
 
626
645
  ## `sf agent test list`
627
646
 
@@ -656,7 +675,7 @@ EXAMPLES
656
675
  $ sf agent test list --target-org my-org
657
676
  ```
658
677
 
659
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/list.ts)_
678
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/test/list.ts)_
660
679
 
661
680
  ## `sf agent test results`
662
681
 
@@ -722,7 +741,7 @@ FLAG DESCRIPTIONS
722
741
  expression when using custom evaluations.
723
742
  ```
724
743
 
725
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/results.ts)_
744
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/test/results.ts)_
726
745
 
727
746
  ## `sf agent test resume`
728
747
 
@@ -795,7 +814,7 @@ FLAG DESCRIPTIONS
795
814
  expression when using custom evaluations.
796
815
  ```
797
816
 
798
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/resume.ts)_
817
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/test/resume.ts)_
799
818
 
800
819
  ## `sf agent test run`
801
820
 
@@ -869,18 +888,18 @@ FLAG DESCRIPTIONS
869
888
  expression when using custom evaluations.
870
889
  ```
871
890
 
872
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/test/run.ts)_
891
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/test/run.ts)_
873
892
 
874
893
  ## `sf agent validate authoring-bundle`
875
894
 
876
- Validate an Agent Authoring Bundle
895
+ Validate a local authoring bundle to ensure it compiles successfully and can be used to create a next-gen agent.
877
896
 
878
897
  ```
879
898
  USAGE
880
899
  $ sf agent validate authoring-bundle -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
881
900
 
882
901
  FLAGS
883
- -n, --api-name=<value> API name of the Agent Authoring Bundle to validate.
902
+ -n, --api-name=<value> API name of the authoring bundle you want to validate.
884
903
  -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
885
904
  configuration variable is already set.
886
905
  --api-version=<value> Override the api version used for api requests made by this command
@@ -890,16 +909,25 @@ GLOBAL FLAGS
890
909
  --json Format output as json.
891
910
 
892
911
  DESCRIPTION
893
- Validate an Agent Authoring Bundle
912
+ Validate a local authoring bundle to ensure it compiles successfully and can be used to create a next-gen agent.
913
+
914
+ Authoring bundles are metadata types that represent the next-gen Salesforce agents. Their exact metadata name is
915
+ AiAuthoringBundle and they consist of a standard "\*-meta.xml" metadata file and an agent file (with extension
916
+ ".agent") that fully describes the next-gen agent. Generate a local authoring bundle with the "agent generate
917
+ authoring-bundle" command.
918
+
919
+ This command validates that the agent file (with extension ".agent") that's part of the authoring bundle compiles
920
+ without errors and can later be used to successfully create a next-gen agent.
894
921
 
895
- Validates an Agent Authoring Bundle by compiling the .agent file and checking for errors.
922
+ This command requires the API name of the authoring bundle; if you don't provide it with the --api-name flag, the
923
+ command prompts you for it.
896
924
 
897
925
  EXAMPLES
898
- Validate an Agent Authoring Bundle:
926
+ Validate a local authoring bundle with API name MyAuthoringBundle:
899
927
 
900
- $ sf agent validate authoring-bundle --api-name path/to/bundle
928
+ $ sf agent validate authoring-bundle --api-name MyAuthoringBundle
901
929
  ```
902
930
 
903
- _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-demo.8/src/commands/agent/validate/authoring-bundle.ts)_
931
+ _See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.24.14-nga.0/src/commands/agent/validate/authoring-bundle.ts)_
904
932
 
905
933
  <!-- commandsstop -->
@@ -115,7 +115,7 @@ export default class AgentGenerateAuthoringBundle extends SfCommand {
115
115
  // Write Agent file
116
116
  const conn = targetOrg.getConnection(flags['api-version']);
117
117
  const specContents = YAML.parse(readFileSync(spec, 'utf8'));
118
- const agent = await Agent.createAgent(conn, specContents);
118
+ const agent = await Agent.createAgentScript(conn, { ...specContents, ...{ name, developerName: bundleApiName } });
119
119
  // Create output directory if it doesn't exist
120
120
  mkdirSync(targetOutputDir, { recursive: true });
121
121
  writeFileSync(agentPath, agent);
@@ -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,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,KAAK,EAAgB,MAAM,oBAAoB,CAAC;AACzD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,KAAK,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAmB,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtF,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,iCAAiC,CAAC,CAAC;AAQtG,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,SAA6C;IAC9F,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,QAA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3
  type BotVersionStatus = {
3
4
  Status: 'Active' | 'Inactive';
4
5
  };
@@ -9,15 +10,6 @@ export type AgentData = {
9
10
  records: BotVersionStatus[];
10
11
  };
11
12
  };
12
- type Choice<Value> = {
13
- value: Value;
14
- name?: string;
15
- disabled?: boolean | string;
16
- };
17
- type AgentValue = {
18
- Id: string;
19
- DeveloperName: string;
20
- };
21
13
  export declare const UNSUPPORTED_AGENTS: string[];
22
14
  export type AgentPreviewResult = void;
23
15
  export default class AgentPreview extends SfCommand<AgentPreviewResult> {
@@ -34,12 +26,14 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
34
26
  'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
27
  'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
36
28
  'apex-debug': import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ 'use-live-actions': import("@oclif/core/interfaces").BooleanFlag<boolean>;
37
30
  };
38
31
  run(): Promise<AgentPreviewResult>;
32
+ private getAgentChoices;
39
33
  }
40
34
  export declare const agentIsUnsupported: (devName: string) => boolean;
41
35
  export declare const agentIsInactive: (agent: AgentData) => boolean;
42
36
  export declare const validateAgent: (agent: AgentData) => boolean;
43
- export declare const getAgentChoices: (agents: AgentData[]) => Array<Choice<AgentValue>>;
37
+ export declare const getClientAppsFromAuth: (authInfo: AuthInfo) => string[];
44
38
  export declare const resolveOutputDir: (outputDir: string | undefined, apexDebug: boolean | undefined) => Promise<string | undefined>;
45
39
  export {};
@@ -13,14 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { resolve, join } from 'node:path';
17
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
18
- import { AuthInfo, Connection, Messages, SfError } from '@salesforce/core';
16
+ import * as path from 'node:path';
17
+ import { join, resolve } from 'node:path';
18
+ import { globSync } from 'glob';
19
+ import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
20
+ import { AuthInfo, Connection, Lifecycle, Messages, SfError } from '@salesforce/core';
19
21
  import React from 'react';
20
22
  import { render } from 'ink';
21
23
  import { env } from '@salesforce/kit';
22
- import { AgentPreview as Preview } from '@salesforce/agents';
23
- import { select, confirm, input } from '@inquirer/prompts';
24
+ import { AgentPreview as Preview, AgentSimulate, AgentSource, findAuthoringBundle, } from '@salesforce/agents';
25
+ import { confirm, input, select } from '@inquirer/prompts';
24
26
  import { AgentPreviewReact } from '../../components/agent-preview-react.js';
25
27
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
26
28
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview');
@@ -55,58 +57,130 @@ export default class AgentPreview extends SfCommand {
55
57
  summary: messages.getMessage('flags.apex-debug.summary'),
56
58
  char: 'x',
57
59
  }),
60
+ 'use-live-actions': Flags.boolean({
61
+ summary: messages.getMessage('flags.use-live-actions.summary'),
62
+ default: false,
63
+ }),
58
64
  };
59
65
  async run() {
66
+ // STAGES OF PREVIEW
67
+ // get user's agent selection either from flags, or interaction
68
+ // if .agent selected, use the AgentSimulate class to preview
69
+ // if published agent, use AgentPreview for preview
70
+ // based on agent, differing auth mechanisms required
60
71
  const { flags } = await this.parse(AgentPreview);
61
- const { 'api-name': apiNameFlag } = flags;
72
+ const { 'api-name': apiNameFlag, 'use-live-actions': useLiveActions } = flags;
62
73
  const conn = flags['target-org'].getConnection(flags['api-version']);
63
- const authInfo = await AuthInfo.create({
64
- username: flags['target-org'].getUsername(),
65
- });
66
- if (!(flags['client-app'] ?? env.getString('SF_DEMO_AGENT_CLIENT_APP'))) {
67
- throw new SfError('SF_DEMO_AGENT_CLIENT_APP is unset!');
68
- }
69
- const jwtConn = await Connection.create({
70
- authInfo,
71
- clientApp: env.getString('SF_DEMO_AGENT_CLIENT_APP') ?? flags['client-app'],
72
- });
73
- const agentsQuery = await conn.query('SELECT Id, DeveloperName, (SELECT Status FROM BotVersions) FROM BotDefinition WHERE IsDeleted = false');
74
- if (agentsQuery.totalSize === 0)
75
- throw new SfError('No Agents found in the org');
76
- const agentsInOrg = agentsQuery.records;
74
+ const agentsInOrg = (await conn.query('SELECT Id, DeveloperName, (SELECT Status FROM BotVersions) FROM BotDefinition WHERE IsDeleted = false')).records;
77
75
  let selectedAgent;
78
76
  if (flags['authoring-bundle']) {
79
- const envAgentName = env.getString('SF_DEMO_AGENT');
80
- const agent = agentsQuery.records.find((a) => a.DeveloperName === envAgentName);
77
+ // user specified --authoring-bundle, we'll find the script and use it
78
+ const bundlePath = findAuthoringBundle(this.project.getPath(), flags['authoring-bundle']);
79
+ if (!bundlePath) {
80
+ throw new SfError(`Could not find authoring bundle for ${flags['authoring-bundle']}`);
81
+ }
81
82
  selectedAgent = {
82
- Id: agent?.Id ??
83
- `Couldn't find an agent in ${agentsQuery.records.map((a) => a.DeveloperName).join(', ')} matching ${envAgentName ?? '!SF_DEMO_AGENT is unset!'}`,
84
83
  DeveloperName: flags['authoring-bundle'],
84
+ source: AgentSource.SCRIPT,
85
+ path: join(bundlePath, `${flags['authoring-bundle']}.agent`),
85
86
  };
86
87
  }
87
88
  else if (apiNameFlag) {
88
- selectedAgent = agentsInOrg.find((agent) => agent.DeveloperName === apiNameFlag);
89
+ // user specified --api-name, it should be in the list of agents from the org
90
+ const agent = agentsInOrg.find((a) => a.DeveloperName === apiNameFlag);
91
+ if (!agent)
92
+ throw new Error(`No valid Agents were found with the Api Name ${apiNameFlag}.`);
93
+ validateAgent(agent);
94
+ selectedAgent = {
95
+ Id: agent.Id,
96
+ DeveloperName: agent.DeveloperName,
97
+ source: AgentSource.PUBLISHED,
98
+ };
89
99
  if (!selectedAgent)
90
100
  throw new Error(`No valid Agents were found with the Api Name ${apiNameFlag}.`);
91
- validateAgent(selectedAgent);
92
101
  }
93
102
  else {
94
103
  selectedAgent = await select({
95
104
  message: 'Select an agent',
96
- choices: getAgentChoices(agentsInOrg),
105
+ choices: this.getAgentChoices(agentsInOrg),
97
106
  });
98
107
  }
108
+ // we have the selected agent, create the appropriate connection
109
+ const authInfo = await AuthInfo.create({
110
+ username: flags['target-org'].getUsername(),
111
+ });
112
+ // Get client app - check flag first, then auth file, then env var
113
+ let clientApp = flags['client-app'];
114
+ if (!clientApp && selectedAgent?.source === AgentSource.PUBLISHED) {
115
+ const clientApps = getClientAppsFromAuth(authInfo);
116
+ if (clientApps.length === 1) {
117
+ clientApp = clientApps[0];
118
+ }
119
+ else if (clientApps.length > 1) {
120
+ clientApp = await select({
121
+ message: 'Select a client app',
122
+ choices: clientApps.map((app) => ({ value: app, name: app })),
123
+ });
124
+ }
125
+ else {
126
+ throw new SfError('No client app found.');
127
+ }
128
+ }
129
+ if (useLiveActions && selectedAgent.source === AgentSource.PUBLISHED) {
130
+ 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');
131
+ }
132
+ const jwtConn = selectedAgent?.source === AgentSource.PUBLISHED
133
+ ? await Connection.create({
134
+ authInfo,
135
+ clientApp,
136
+ })
137
+ : await Connection.create({ authInfo });
99
138
  const outputDir = await resolveOutputDir(flags['output-dir'], flags['apex-debug']);
100
- const agentPreview = new Preview(jwtConn, selectedAgent.Id);
101
- agentPreview.toggleApexDebugMode(flags['apex-debug']);
139
+ // Both classes share the same interface for the methods we need
140
+ const agentPreview = selectedAgent.source === AgentSource.PUBLISHED
141
+ ? new Preview(jwtConn, selectedAgent.Id)
142
+ : new AgentSimulate(jwtConn, selectedAgent.path, useLiveActions);
143
+ agentPreview.setApexDebugMode(flags['apex-debug']);
102
144
  const instance = render(React.createElement(AgentPreviewReact, {
103
145
  connection: conn,
104
146
  agent: agentPreview,
105
147
  name: selectedAgent.DeveloperName,
106
148
  outputDir,
149
+ isLocalAgent: selectedAgent.source === AgentSource.SCRIPT,
107
150
  }), { exitOnCtrlC: false });
108
151
  await instance.waitUntilExit();
109
152
  }
153
+ getAgentChoices(agents) {
154
+ const choices = [];
155
+ // Add org agents
156
+ for (const agent of agents) {
157
+ if (agentIsInactive(agent) || agentIsUnsupported(agent.DeveloperName)) {
158
+ continue;
159
+ }
160
+ choices.push({
161
+ name: `${agent.DeveloperName} (Published)`,
162
+ value: {
163
+ Id: agent.Id,
164
+ DeveloperName: agent.DeveloperName,
165
+ source: AgentSource.PUBLISHED,
166
+ },
167
+ });
168
+ }
169
+ // Add local agents from .agent files
170
+ const localAgentPaths = globSync('**/*.agent', { cwd: this.project.getPath() });
171
+ for (const agentPath of localAgentPaths) {
172
+ const agentName = path.basename(agentPath, '.agent');
173
+ choices.push({
174
+ name: `${agentName} (Agent Script)`,
175
+ value: {
176
+ DeveloperName: agentName,
177
+ source: AgentSource.SCRIPT,
178
+ path: path.join(this.project.getPath(), agentPath),
179
+ },
180
+ });
181
+ }
182
+ return choices;
183
+ }
110
184
  }
111
185
  export const agentIsUnsupported = (devName) => UNSUPPORTED_AGENTS.includes(devName);
112
186
  export const agentIsInactive = (agent) =>
@@ -125,21 +199,7 @@ export const validateAgent = (agent) => {
125
199
  }
126
200
  return true;
127
201
  };
128
- export const getAgentChoices = (agents) => agents.map((agent) => {
129
- let disabled = false;
130
- if (agentIsInactive(agent))
131
- disabled = '(Inactive)';
132
- if (agentIsUnsupported(agent.DeveloperName))
133
- disabled = '(Not Supported)';
134
- return {
135
- name: agent.DeveloperName,
136
- value: {
137
- Id: agent.Id,
138
- DeveloperName: agent.DeveloperName,
139
- },
140
- disabled,
141
- };
142
- });
202
+ export const getClientAppsFromAuth = (authInfo) => Object.keys(authInfo.getFields().clientApps ?? {});
143
203
  export const resolveOutputDir = async (outputDir, apexDebug) => {
144
204
  if (!outputDir) {
145
205
  const response = apexDebug
@@ -1 +1 @@
1
- {"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/commands/agent/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OA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