@salesforce/plugin-agent 1.27.7 → 1.28.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 +223 -16
- package/lib/commands/agent/preview/end.d.ts +20 -0
- package/lib/commands/agent/preview/end.js +77 -0
- package/lib/commands/agent/preview/end.js.map +1 -0
- package/lib/commands/agent/preview/send.d.ts +23 -0
- package/lib/commands/agent/preview/send.js +74 -0
- package/lib/commands/agent/preview/send.js.map +1 -0
- package/lib/commands/agent/preview/sessions.d.ts +14 -0
- package/lib/commands/agent/preview/sessions.js +58 -0
- package/lib/commands/agent/preview/sessions.js.map +1 -0
- package/lib/commands/agent/preview/start.d.ts +19 -0
- package/lib/commands/agent/preview/start.js +66 -0
- package/lib/commands/agent/preview/start.js.map +1 -0
- package/lib/components/agent-preview-react.js.map +1 -1
- package/lib/previewSessionStore.d.ts +45 -0
- package/lib/previewSessionStore.js +159 -0
- package/lib/previewSessionStore.js.map +1 -0
- package/messages/agent.preview.end.md +47 -0
- package/messages/agent.preview.md +1 -1
- package/messages/agent.preview.send.md +47 -0
- package/messages/agent.preview.sessions.md +27 -0
- package/messages/agent.preview.start.md +41 -0
- package/oclif.manifest.json +365 -20
- package/package.json +3 -3
- package/schemas/agent-preview-end.json +19 -0
- package/schemas/agent-preview-send.json +28 -0
- package/schemas/agent-preview-sessions.json +25 -0
- package/schemas/agent-preview-start.json +16 -0
package/README.md
CHANGED
|
@@ -67,6 +67,10 @@ sf plugins
|
|
|
67
67
|
- [`sf agent generate template`](#sf-agent-generate-template)
|
|
68
68
|
- [`sf agent generate test-spec`](#sf-agent-generate-test-spec)
|
|
69
69
|
- [`sf agent preview`](#sf-agent-preview)
|
|
70
|
+
- [`sf agent preview end`](#sf-agent-preview-end)
|
|
71
|
+
- [`sf agent preview send`](#sf-agent-preview-send)
|
|
72
|
+
- [`sf agent preview sessions`](#sf-agent-preview-sessions)
|
|
73
|
+
- [`sf agent preview start`](#sf-agent-preview-start)
|
|
70
74
|
- [`sf agent publish authoring-bundle`](#sf-agent-publish-authoring-bundle)
|
|
71
75
|
- [`sf agent test create`](#sf-agent-test-create)
|
|
72
76
|
- [`sf agent test list`](#sf-agent-test-list)
|
|
@@ -112,7 +116,7 @@ EXAMPLES
|
|
|
112
116
|
$ sf agent activate --api-name Resort_Manager --target-org my-org
|
|
113
117
|
```
|
|
114
118
|
|
|
115
|
-
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
119
|
+
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/activate.ts)_
|
|
116
120
|
|
|
117
121
|
## `sf agent create`
|
|
118
122
|
|
|
@@ -179,7 +183,7 @@ EXAMPLES
|
|
|
179
183
|
$ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
|
|
180
184
|
```
|
|
181
185
|
|
|
182
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
186
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/create.ts)_
|
|
183
187
|
|
|
184
188
|
## `sf agent deactivate`
|
|
185
189
|
|
|
@@ -219,7 +223,7 @@ EXAMPLES
|
|
|
219
223
|
$ sf agent deactivate --api-name Resort_Manager --target-org my-org
|
|
220
224
|
```
|
|
221
225
|
|
|
222
|
-
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
226
|
+
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/deactivate.ts)_
|
|
223
227
|
|
|
224
228
|
## `sf agent generate agent-spec`
|
|
225
229
|
|
|
@@ -326,7 +330,7 @@ EXAMPLES
|
|
|
326
330
|
$ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
|
|
327
331
|
```
|
|
328
332
|
|
|
329
|
-
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
333
|
+
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/generate/agent-spec.ts)_
|
|
330
334
|
|
|
331
335
|
## `sf agent generate authoring-bundle`
|
|
332
336
|
|
|
@@ -401,7 +405,7 @@ EXAMPLES
|
|
|
401
405
|
other-package-dir/main/default --target-org my-dev-org
|
|
402
406
|
```
|
|
403
407
|
|
|
404
|
-
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
408
|
+
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/generate/authoring-bundle.ts)_
|
|
405
409
|
|
|
406
410
|
## `sf agent generate template`
|
|
407
411
|
|
|
@@ -449,7 +453,7 @@ EXAMPLES
|
|
|
449
453
|
force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
|
|
450
454
|
```
|
|
451
455
|
|
|
452
|
-
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
456
|
+
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/generate/template.ts)_
|
|
453
457
|
|
|
454
458
|
## `sf agent generate test-spec`
|
|
455
459
|
|
|
@@ -510,7 +514,7 @@ EXAMPLES
|
|
|
510
514
|
force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
|
|
511
515
|
```
|
|
512
516
|
|
|
513
|
-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
517
|
+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/generate/test-spec.ts)_
|
|
514
518
|
|
|
515
519
|
## `sf agent preview`
|
|
516
520
|
|
|
@@ -523,7 +527,7 @@ USAGE
|
|
|
523
527
|
|
|
524
528
|
FLAGS
|
|
525
529
|
-d, --output-dir=<value> Directory where conversation transcripts are saved.
|
|
526
|
-
-n, --api-name=<value> API name of the published
|
|
530
|
+
-n, --api-name=<value> API name of the activated published agent you want to interact with.
|
|
527
531
|
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
528
532
|
configuration variable is already set.
|
|
529
533
|
-x, --apex-debug Enable Apex debug logging during the agent preview conversation.
|
|
@@ -583,7 +587,210 @@ EXAMPLES
|
|
|
583
587
|
$ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
|
|
584
588
|
```
|
|
585
589
|
|
|
586
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
590
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/preview.ts)_
|
|
591
|
+
|
|
592
|
+
## `sf agent preview end`
|
|
593
|
+
|
|
594
|
+
End an existing programmatic agent preview session and get trace location.
|
|
595
|
+
|
|
596
|
+
```
|
|
597
|
+
USAGE
|
|
598
|
+
$ sf agent preview end -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--session-id <value>] [-n
|
|
599
|
+
<value>] [--authoring-bundle <value>]
|
|
600
|
+
|
|
601
|
+
FLAGS
|
|
602
|
+
-n, --api-name=<value> API name of the activated published agent you want to preview.
|
|
603
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
604
|
+
configuration variable is already set.
|
|
605
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
606
|
+
--authoring-bundle=<value> API name of the authoring bundle metadata component that contains the agent's Agent
|
|
607
|
+
Script file.
|
|
608
|
+
--session-id=<value> Session ID outputted by "agent preview start". Not required when the agent has exactly
|
|
609
|
+
one active session. Run "agent preview sessions" to see the list of all sessions.
|
|
610
|
+
|
|
611
|
+
GLOBAL FLAGS
|
|
612
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
613
|
+
--json Format output as json.
|
|
614
|
+
|
|
615
|
+
DESCRIPTION
|
|
616
|
+
End an existing programmatic agent preview session and get trace location.
|
|
617
|
+
|
|
618
|
+
You must have previously started a programmatic agent preview session with the "agent preview start" command to then
|
|
619
|
+
use this command to end it. This command also displays the local directory where the session trace files are stored.
|
|
620
|
+
|
|
621
|
+
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this
|
|
622
|
+
command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview
|
|
623
|
+
session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring
|
|
624
|
+
bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX
|
|
625
|
+
project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata
|
|
626
|
+
directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata
|
|
627
|
+
directory.
|
|
628
|
+
|
|
629
|
+
EXAMPLES
|
|
630
|
+
End a preview session of a published agent by specifying its session ID and API name ; use the default org:
|
|
631
|
+
|
|
632
|
+
$ sf agent preview end --session-id <SESSION_ID> --api-name My_Published_Agent
|
|
633
|
+
|
|
634
|
+
Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than
|
|
635
|
+
one active session. Use the org with alias "my-dev-org":
|
|
636
|
+
|
|
637
|
+
$ sf agent preview end --api-name My_Published_Agent --target-org my-dev-org
|
|
638
|
+
|
|
639
|
+
End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than
|
|
640
|
+
one active session.
|
|
641
|
+
|
|
642
|
+
$ sf agent preview end --authoring-bundle My_Local_Agent
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
_See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/preview/end.ts)_
|
|
646
|
+
|
|
647
|
+
## `sf agent preview send`
|
|
648
|
+
|
|
649
|
+
Send a message to an existing agent preview session.
|
|
650
|
+
|
|
651
|
+
```
|
|
652
|
+
USAGE
|
|
653
|
+
$ sf agent preview send -o <value> -u <value> [--json] [--flags-dir <value>] [--api-version <value>] [--session-id
|
|
654
|
+
<value>] [-n <value>] [--authoring-bundle <value>]
|
|
655
|
+
|
|
656
|
+
FLAGS
|
|
657
|
+
-n, --api-name=<value> API name of the activated published agent you want to preview.
|
|
658
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
659
|
+
configuration variable is already set.
|
|
660
|
+
-u, --utterance=<value> (required) Utterance to send to the agent, enclosed in double quotes.
|
|
661
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
662
|
+
--authoring-bundle=<value> API name of the authoring bundle metadata component that contains the agent's Agent
|
|
663
|
+
Script file.
|
|
664
|
+
--session-id=<value> Session ID outputted by "agent preview start". Not required when the agent has exactly
|
|
665
|
+
one active session. Run "agent preview sessions" to see list of all sessions.
|
|
666
|
+
|
|
667
|
+
GLOBAL FLAGS
|
|
668
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
669
|
+
--json Format output as json.
|
|
670
|
+
|
|
671
|
+
DESCRIPTION
|
|
672
|
+
Send a message to an existing agent preview session.
|
|
673
|
+
|
|
674
|
+
You must have previously started a programmatic agent preview session with the "agent preview start" command to then
|
|
675
|
+
use this command to send the agent a message (utterance). This command then displays the agent's response.
|
|
676
|
+
|
|
677
|
+
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this
|
|
678
|
+
command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview
|
|
679
|
+
session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring
|
|
680
|
+
bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX
|
|
681
|
+
project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata
|
|
682
|
+
directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata
|
|
683
|
+
directory.
|
|
684
|
+
|
|
685
|
+
EXAMPLES
|
|
686
|
+
Send a message to an activated published agent using its API name and session ID; use the default org:
|
|
687
|
+
|
|
688
|
+
$ sf agent preview send --utterance "What can you help me with?" --api-name My_Published_Agent --session-id \
|
|
689
|
+
<SESSION_ID>
|
|
690
|
+
|
|
691
|
+
Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active
|
|
692
|
+
session. Use the org with alias "my-dev-org":
|
|
693
|
+
|
|
694
|
+
$ sf agent preview send --utterance "What can you help me with?" --api-name My_Published_Agent --target-org \
|
|
695
|
+
my-dev-org
|
|
696
|
+
|
|
697
|
+
Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one
|
|
698
|
+
active session:
|
|
699
|
+
|
|
700
|
+
$ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
_See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/preview/send.ts)_
|
|
704
|
+
|
|
705
|
+
## `sf agent preview sessions`
|
|
706
|
+
|
|
707
|
+
List all known programmatic agent preview sessions.
|
|
708
|
+
|
|
709
|
+
```
|
|
710
|
+
USAGE
|
|
711
|
+
$ sf agent preview sessions [--json] [--flags-dir <value>]
|
|
712
|
+
|
|
713
|
+
GLOBAL FLAGS
|
|
714
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
715
|
+
--json Format output as json.
|
|
716
|
+
|
|
717
|
+
DESCRIPTION
|
|
718
|
+
List all known programmatic agent preview sessions.
|
|
719
|
+
|
|
720
|
+
This command lists the agent preview sessions that were started with the "agent preview start" command and are still
|
|
721
|
+
in the local cache. Use this command to discover specific session IDs that you can pass to the "agent preview send" or
|
|
722
|
+
"agent preview end" commands with the --session-id flag.
|
|
723
|
+
|
|
724
|
+
Programmatic agent preview sessions can be started for both published activated agents and by using an agent's local
|
|
725
|
+
authoring bundle, which contains its Agent Script file. In this command's output table, the Agent column contains
|
|
726
|
+
either the API name of the authoring bundle or the published agent, whichever was used when starting the session. In
|
|
727
|
+
the table, if the same API name has multiple rows with different session IDs, then it means that you previously
|
|
728
|
+
started multiple preview sessions with the associated agent.
|
|
729
|
+
|
|
730
|
+
EXAMPLES
|
|
731
|
+
List all cached agent preview sessions:
|
|
732
|
+
|
|
733
|
+
$ sf agent preview sessions
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
_See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/preview/sessions.ts)_
|
|
737
|
+
|
|
738
|
+
## `sf agent preview start`
|
|
739
|
+
|
|
740
|
+
Start a programmatic agent preview session.
|
|
741
|
+
|
|
742
|
+
```
|
|
743
|
+
USAGE
|
|
744
|
+
$ sf agent preview start -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-n <value>]
|
|
745
|
+
[--authoring-bundle <value>] [--use-live-actions]
|
|
746
|
+
|
|
747
|
+
FLAGS
|
|
748
|
+
-n, --api-name=<value> API name of the activated published agent you want to preview.
|
|
749
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
750
|
+
configuration variable is already set.
|
|
751
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
752
|
+
--authoring-bundle=<value> API name of the authoring bundle metadata component that contains the agent's Agent
|
|
753
|
+
Script file.
|
|
754
|
+
--use-live-actions Use real actions in the org; if not specified, preview uses AI to simulate (mock)
|
|
755
|
+
actions.
|
|
756
|
+
|
|
757
|
+
GLOBAL FLAGS
|
|
758
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
759
|
+
--json Format output as json.
|
|
760
|
+
|
|
761
|
+
DESCRIPTION
|
|
762
|
+
Start a programmatic agent preview session.
|
|
763
|
+
|
|
764
|
+
This command outputs a session ID that you then use with the "agent preview send" command to send an utterance to the
|
|
765
|
+
agent. Use the "agent preview sessions" command to list all active sessions and the "agent preview end" command to
|
|
766
|
+
end a specific session.
|
|
767
|
+
|
|
768
|
+
Identify the agent you want to start previewing with either the --authoring-bundle flag to specify a local authoring
|
|
769
|
+
bundle's API name or --api-name to specify an activated published agent's API name. To find either API name, navigate
|
|
770
|
+
to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name
|
|
771
|
+
under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its
|
|
772
|
+
directory name under the "Bots" metadata directory.
|
|
773
|
+
|
|
774
|
+
When starting a preview session using the authoring bundle, which contains the agent's Agent Script file, the preview
|
|
775
|
+
uses mocked actions by default. Specify --use-live-actions for live mode, which uses the real Apex classes, flows,
|
|
776
|
+
etc, in the org for the actions.
|
|
777
|
+
|
|
778
|
+
EXAMPLES
|
|
779
|
+
Start a programmatic agent preview session by specifying an authoring bundle; uses mocked actions by default. Use
|
|
780
|
+
the org with alias "my-dev-org":
|
|
781
|
+
|
|
782
|
+
$ sf agent preview start --authoring-bundle My_Agent_Bundle --target-org my-dev-org
|
|
783
|
+
|
|
784
|
+
Similar to previous example but use live actions and the default org:
|
|
785
|
+
|
|
786
|
+
$ sf agent preview start --authoring-bundle My_Agent_Bundle --use-live-actions
|
|
787
|
+
|
|
788
|
+
Start a preview session with an activated published agent:
|
|
789
|
+
|
|
790
|
+
$ sf agent preview start --api-name My_Published_Agent
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
_See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/preview/start.ts)_
|
|
587
794
|
|
|
588
795
|
## `sf agent publish authoring-bundle`
|
|
589
796
|
|
|
@@ -632,7 +839,7 @@ EXAMPLES
|
|
|
632
839
|
$ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
|
|
633
840
|
```
|
|
634
841
|
|
|
635
|
-
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
842
|
+
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/publish/authoring-bundle.ts)_
|
|
636
843
|
|
|
637
844
|
## `sf agent test create`
|
|
638
845
|
|
|
@@ -687,7 +894,7 @@ EXAMPLES
|
|
|
687
894
|
$ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
|
|
688
895
|
```
|
|
689
896
|
|
|
690
|
-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
897
|
+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/test/create.ts)_
|
|
691
898
|
|
|
692
899
|
## `sf agent test list`
|
|
693
900
|
|
|
@@ -722,7 +929,7 @@ EXAMPLES
|
|
|
722
929
|
$ sf agent test list --target-org my-org
|
|
723
930
|
```
|
|
724
931
|
|
|
725
|
-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
932
|
+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/test/list.ts)_
|
|
726
933
|
|
|
727
934
|
## `sf agent test results`
|
|
728
935
|
|
|
@@ -788,7 +995,7 @@ FLAG DESCRIPTIONS
|
|
|
788
995
|
expression when using custom evaluations.
|
|
789
996
|
```
|
|
790
997
|
|
|
791
|
-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
998
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/test/results.ts)_
|
|
792
999
|
|
|
793
1000
|
## `sf agent test resume`
|
|
794
1001
|
|
|
@@ -861,7 +1068,7 @@ FLAG DESCRIPTIONS
|
|
|
861
1068
|
expression when using custom evaluations.
|
|
862
1069
|
```
|
|
863
1070
|
|
|
864
|
-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1071
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/test/resume.ts)_
|
|
865
1072
|
|
|
866
1073
|
## `sf agent test run`
|
|
867
1074
|
|
|
@@ -935,7 +1142,7 @@ FLAG DESCRIPTIONS
|
|
|
935
1142
|
expression when using custom evaluations.
|
|
936
1143
|
```
|
|
937
1144
|
|
|
938
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1145
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/test/run.ts)_
|
|
939
1146
|
|
|
940
1147
|
## `sf agent validate authoring-bundle`
|
|
941
1148
|
|
|
@@ -982,6 +1189,6 @@ EXAMPLES
|
|
|
982
1189
|
$ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
|
|
983
1190
|
```
|
|
984
1191
|
|
|
985
|
-
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1192
|
+
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.28.0/src/commands/agent/validate/authoring-bundle.ts)_
|
|
986
1193
|
|
|
987
1194
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type AgentPreviewEndResult = {
|
|
3
|
+
sessionId: string;
|
|
4
|
+
tracesPath: string;
|
|
5
|
+
};
|
|
6
|
+
export default class AgentPreviewEnd extends SfCommand<AgentPreviewEndResult> {
|
|
7
|
+
static readonly summary: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly examples: string[];
|
|
10
|
+
static readonly state = "beta";
|
|
11
|
+
static readonly requiresProject = true;
|
|
12
|
+
static readonly flags: {
|
|
13
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'session-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<AgentPreviewEndResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
18
|
+
import { Agent, ProductionAgent, ScriptAgent } from '@salesforce/agents';
|
|
19
|
+
import { getCachedSessionIds, removeCache, validatePreviewSession } from '../../../previewSessionStore.js';
|
|
20
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview.end');
|
|
22
|
+
export default class AgentPreviewEnd extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static state = 'beta';
|
|
27
|
+
static requiresProject = true;
|
|
28
|
+
static flags = {
|
|
29
|
+
'target-org': Flags.requiredOrg(),
|
|
30
|
+
'api-version': Flags.orgApiVersion(),
|
|
31
|
+
'session-id': Flags.string({
|
|
32
|
+
summary: messages.getMessage('flags.session-id.summary'),
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
'api-name': Flags.string({
|
|
36
|
+
summary: messages.getMessage('flags.api-name.summary'),
|
|
37
|
+
char: 'n',
|
|
38
|
+
exactlyOne: ['api-name', 'authoring-bundle'],
|
|
39
|
+
}),
|
|
40
|
+
'authoring-bundle': Flags.string({
|
|
41
|
+
summary: messages.getMessage('flags.authoring-bundle.summary'),
|
|
42
|
+
exactlyOne: ['api-name', 'authoring-bundle'],
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
async run() {
|
|
46
|
+
const { flags } = await this.parse(AgentPreviewEnd);
|
|
47
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
48
|
+
const agent = flags['authoring-bundle']
|
|
49
|
+
? await Agent.init({ connection: conn, project: this.project, aabName: flags['authoring-bundle'] })
|
|
50
|
+
: await Agent.init({ connection: conn, project: this.project, apiNameOrId: flags['api-name'] });
|
|
51
|
+
let sessionId = flags['session-id'];
|
|
52
|
+
if (sessionId === undefined) {
|
|
53
|
+
const cached = await getCachedSessionIds(this.project, agent);
|
|
54
|
+
if (cached.length === 0) {
|
|
55
|
+
throw new SfError(messages.getMessage('error.noSession'), 'PreviewSessionNotFound');
|
|
56
|
+
}
|
|
57
|
+
if (cached.length > 1) {
|
|
58
|
+
throw new SfError(messages.getMessage('error.multipleSessions', [cached.join(', ')]), 'PreviewSessionAmbiguous');
|
|
59
|
+
}
|
|
60
|
+
sessionId = cached[0];
|
|
61
|
+
}
|
|
62
|
+
agent.setSessionId(sessionId);
|
|
63
|
+
await validatePreviewSession(agent);
|
|
64
|
+
const tracesPath = await agent.getHistoryDir();
|
|
65
|
+
await removeCache(agent);
|
|
66
|
+
if (agent instanceof ScriptAgent) {
|
|
67
|
+
await agent.preview.end();
|
|
68
|
+
}
|
|
69
|
+
else if (agent instanceof ProductionAgent) {
|
|
70
|
+
await agent.preview.end('UserRequest');
|
|
71
|
+
}
|
|
72
|
+
const result = { sessionId, tracesPath };
|
|
73
|
+
this.log(messages.getMessage('output.tracesPath', [tracesPath]));
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=end.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"end.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/end.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE3G,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC;AAOxF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAgC;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAA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AC,UAAU,CAAC,mBAAmB,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACjE,OAAO,MAAM,CAAC;IAChB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type AgentPreviewSendResult = {
|
|
3
|
+
messages: Array<{
|
|
4
|
+
message?: string;
|
|
5
|
+
role?: string;
|
|
6
|
+
}>;
|
|
7
|
+
};
|
|
8
|
+
export default class AgentPreviewSend extends SfCommand<AgentPreviewSendResult> {
|
|
9
|
+
static readonly summary: string;
|
|
10
|
+
static readonly description: string;
|
|
11
|
+
static readonly examples: string[];
|
|
12
|
+
static readonly state = "beta";
|
|
13
|
+
static readonly requiresProject = true;
|
|
14
|
+
static readonly flags: {
|
|
15
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'session-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
utterance: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
'api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
+
'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
+
};
|
|
22
|
+
run(): Promise<AgentPreviewSendResult>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { Messages, SfError } from '@salesforce/core';
|
|
18
|
+
import { Agent } from '@salesforce/agents';
|
|
19
|
+
import { getCachedSessionIds, validatePreviewSession } from '../../../previewSessionStore.js';
|
|
20
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
21
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview.send');
|
|
22
|
+
export default class AgentPreviewSend extends SfCommand {
|
|
23
|
+
static summary = messages.getMessage('summary');
|
|
24
|
+
static description = messages.getMessage('description');
|
|
25
|
+
static examples = messages.getMessages('examples');
|
|
26
|
+
static state = 'beta';
|
|
27
|
+
static requiresProject = true;
|
|
28
|
+
static flags = {
|
|
29
|
+
'target-org': Flags.requiredOrg(),
|
|
30
|
+
'api-version': Flags.orgApiVersion(),
|
|
31
|
+
'session-id': Flags.string({
|
|
32
|
+
summary: messages.getMessage('flags.session-id.summary'),
|
|
33
|
+
required: false,
|
|
34
|
+
}),
|
|
35
|
+
utterance: Flags.string({
|
|
36
|
+
summary: messages.getMessage('flags.utterance.summary'),
|
|
37
|
+
required: true,
|
|
38
|
+
char: 'u',
|
|
39
|
+
}),
|
|
40
|
+
'api-name': Flags.string({
|
|
41
|
+
summary: messages.getMessage('flags.api-name.summary'),
|
|
42
|
+
char: 'n',
|
|
43
|
+
exactlyOne: ['api-name', 'authoring-bundle'],
|
|
44
|
+
}),
|
|
45
|
+
'authoring-bundle': Flags.string({
|
|
46
|
+
summary: messages.getMessage('flags.authoring-bundle.summary'),
|
|
47
|
+
exactlyOne: ['api-name', 'authoring-bundle'],
|
|
48
|
+
}),
|
|
49
|
+
};
|
|
50
|
+
async run() {
|
|
51
|
+
const { flags } = await this.parse(AgentPreviewSend);
|
|
52
|
+
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
53
|
+
const agent = flags['authoring-bundle']
|
|
54
|
+
? await Agent.init({ connection: conn, project: this.project, aabName: flags['authoring-bundle'] })
|
|
55
|
+
: await Agent.init({ connection: conn, project: this.project, apiNameOrId: flags['api-name'] });
|
|
56
|
+
let sessionId = flags['session-id'];
|
|
57
|
+
if (sessionId === undefined) {
|
|
58
|
+
const cached = await getCachedSessionIds(this.project, agent);
|
|
59
|
+
if (cached.length === 0) {
|
|
60
|
+
throw new SfError(messages.getMessage('error.noSession'), 'PreviewSessionNotFound');
|
|
61
|
+
}
|
|
62
|
+
if (cached.length > 1) {
|
|
63
|
+
throw new SfError(messages.getMessage('error.multipleSessions', [cached.join(', ')]), 'PreviewSessionAmbiguous');
|
|
64
|
+
}
|
|
65
|
+
sessionId = cached[0];
|
|
66
|
+
}
|
|
67
|
+
agent.setSessionId(sessionId);
|
|
68
|
+
await validatePreviewSession(agent);
|
|
69
|
+
const response = await agent.preview.send(flags.utterance);
|
|
70
|
+
this.log(response.messages[0].message);
|
|
71
|
+
return { messages: response.messages ?? [] };
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/send.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,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,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAClE,yBAAyB,CAC1B,CAAC;YACJ,CAAC;YACD,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;QACD,KAAK,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAC9B,MAAM,sBAAsB,CAAC,KAAK,CAAC,CAAC;QAEpC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;QACvC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;IAC/C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type AgentPreviewSessionsResult = Array<{
|
|
3
|
+
agentId: string;
|
|
4
|
+
displayName?: string;
|
|
5
|
+
sessionId: string;
|
|
6
|
+
}>;
|
|
7
|
+
export default class AgentPreviewSessions extends SfCommand<AgentPreviewSessionsResult> {
|
|
8
|
+
static readonly summary: string;
|
|
9
|
+
static readonly description: string;
|
|
10
|
+
static readonly examples: string[];
|
|
11
|
+
static readonly state = "beta";
|
|
12
|
+
static readonly requiresProject = true;
|
|
13
|
+
run(): Promise<AgentPreviewSessionsResult>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026, Salesforce, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { Messages } from '@salesforce/core';
|
|
18
|
+
import { listCachedSessions } from '../../../previewSessionStore.js';
|
|
19
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
20
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview.sessions');
|
|
21
|
+
export default class AgentPreviewSessions extends SfCommand {
|
|
22
|
+
static summary = messages.getMessage('summary');
|
|
23
|
+
static description = messages.getMessage('description');
|
|
24
|
+
static examples = messages.getMessages('examples');
|
|
25
|
+
static state = 'beta';
|
|
26
|
+
static requiresProject = true;
|
|
27
|
+
async run() {
|
|
28
|
+
const entries = await listCachedSessions(this.project);
|
|
29
|
+
const rows = [];
|
|
30
|
+
for (const { agentId, displayName, sessionIds } of entries) {
|
|
31
|
+
for (const sessionId of sessionIds) {
|
|
32
|
+
rows.push({ agentId, displayName, sessionId });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (rows.length === 0) {
|
|
36
|
+
this.log(messages.getMessage('output.empty'));
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
if (this.jsonEnabled()) {
|
|
40
|
+
return rows;
|
|
41
|
+
}
|
|
42
|
+
const agentColumnHeader = messages.getMessage('output.tableHeader.agent');
|
|
43
|
+
const sessionIdHeader = messages.getMessage('output.tableHeader.sessionId');
|
|
44
|
+
const tableData = rows.map((r) => ({
|
|
45
|
+
agent: r.displayName ?? r.agentId,
|
|
46
|
+
sessionId: r.sessionId,
|
|
47
|
+
}));
|
|
48
|
+
this.table({
|
|
49
|
+
data: tableData,
|
|
50
|
+
columns: [
|
|
51
|
+
{ key: 'agent', name: agentColumnHeader },
|
|
52
|
+
{ key: 'sessionId', name: sessionIdHeader },
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
return rows;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=sessions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessions.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/sessions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,wBAAwB,CAAC,CAAC;AAI7F,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,SAAqC;IAC9E,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,KAAK,GAAG,MAAM,CAAC;IAC/B,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IAEvC,KAAK,CAAC,GAAG;QACd,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,IAAI,CAAC,OAAQ,CAAC,CAAC;QACxD,MAAM,IAAI,GAA+B,EAAE,CAAC;QAC5C,KAAK,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,OAAO,EAAE,CAAC;YAC3D,KAAK,MAAM,S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