@salesforce/plugin-agent 1.34.1 → 1.35.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 +19 -19
- package/lib/commands/agent/preview/start.d.ts +1 -0
- package/lib/commands/agent/preview/start.js +19 -4
- package/lib/commands/agent/preview/start.js.map +1 -1
- package/lib/commands/agent/preview.d.ts +1 -0
- package/lib/commands/agent/preview.js +16 -2
- package/lib/commands/agent/preview.js.map +1 -1
- package/lib/common.d.ts +2 -1
- package/lib/common.js +13 -1
- package/lib/common.js.map +1 -1
- package/messages/agent.preview.md +4 -0
- package/messages/agent.preview.start.md +4 -0
- package/oclif.manifest.json +23 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -126,7 +126,7 @@ EXAMPLES
|
|
|
126
126
|
$ sf agent activate --api-name Resort_Manager --version 2 --target-org my-org
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
129
|
+
_See code: [src/commands/agent/activate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/activate.ts)_
|
|
130
130
|
|
|
131
131
|
## `sf agent create`
|
|
132
132
|
|
|
@@ -193,7 +193,7 @@ EXAMPLES
|
|
|
193
193
|
$ sf agent create --name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
196
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/create.ts)_
|
|
197
197
|
|
|
198
198
|
## `sf agent deactivate`
|
|
199
199
|
|
|
@@ -234,7 +234,7 @@ EXAMPLES
|
|
|
234
234
|
$ sf agent deactivate --api-name Resort_Manager --target-org my-org
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
237
|
+
_See code: [src/commands/agent/deactivate.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/deactivate.ts)_
|
|
238
238
|
|
|
239
239
|
## `sf agent generate agent-spec`
|
|
240
240
|
|
|
@@ -341,7 +341,7 @@ EXAMPLES
|
|
|
341
341
|
$ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
|
|
342
342
|
```
|
|
343
343
|
|
|
344
|
-
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
344
|
+
_See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/generate/agent-spec.ts)_
|
|
345
345
|
|
|
346
346
|
## `sf agent generate authoring-bundle`
|
|
347
347
|
|
|
@@ -418,7 +418,7 @@ EXAMPLES
|
|
|
418
418
|
other-package-dir/main/default --target-org my-dev-org
|
|
419
419
|
```
|
|
420
420
|
|
|
421
|
-
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
421
|
+
_See code: [src/commands/agent/generate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/generate/authoring-bundle.ts)_
|
|
422
422
|
|
|
423
423
|
## `sf agent generate template`
|
|
424
424
|
|
|
@@ -480,7 +480,7 @@ EXAMPLES
|
|
|
480
480
|
my-package --source-org my-scratch-org
|
|
481
481
|
```
|
|
482
482
|
|
|
483
|
-
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
483
|
+
_See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/generate/template.ts)_
|
|
484
484
|
|
|
485
485
|
## `sf agent generate test-spec`
|
|
486
486
|
|
|
@@ -545,7 +545,7 @@ EXAMPLES
|
|
|
545
545
|
force-app//main/default/aiEvaluationDefinitions/Resort_Manager_Tests.aiEvaluationDefinition-meta.xml
|
|
546
546
|
```
|
|
547
547
|
|
|
548
|
-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
548
|
+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/generate/test-spec.ts)_
|
|
549
549
|
|
|
550
550
|
## `sf agent preview`
|
|
551
551
|
|
|
@@ -618,7 +618,7 @@ EXAMPLES
|
|
|
618
618
|
$ sf agent preview --use-live-actions --apex-debug --output-dir transcripts/my-preview
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
621
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/preview.ts)_
|
|
622
622
|
|
|
623
623
|
## `sf agent preview end`
|
|
624
624
|
|
|
@@ -673,7 +673,7 @@ EXAMPLES
|
|
|
673
673
|
$ sf agent preview end --authoring-bundle My_Local_Agent
|
|
674
674
|
```
|
|
675
675
|
|
|
676
|
-
_See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
676
|
+
_See code: [src/commands/agent/preview/end.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/preview/end.ts)_
|
|
677
677
|
|
|
678
678
|
## `sf agent preview send`
|
|
679
679
|
|
|
@@ -731,7 +731,7 @@ EXAMPLES
|
|
|
731
731
|
$ sf agent preview send --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
|
|
732
732
|
```
|
|
733
733
|
|
|
734
|
-
_See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
734
|
+
_See code: [src/commands/agent/preview/send.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/preview/send.ts)_
|
|
735
735
|
|
|
736
736
|
## `sf agent preview sessions`
|
|
737
737
|
|
|
@@ -764,7 +764,7 @@ EXAMPLES
|
|
|
764
764
|
$ sf agent preview sessions
|
|
765
765
|
```
|
|
766
766
|
|
|
767
|
-
_See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
767
|
+
_See code: [src/commands/agent/preview/sessions.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/preview/sessions.ts)_
|
|
768
768
|
|
|
769
769
|
## `sf agent preview start`
|
|
770
770
|
|
|
@@ -829,7 +829,7 @@ EXAMPLES
|
|
|
829
829
|
$ sf agent preview start --api-name My_Published_Agent
|
|
830
830
|
```
|
|
831
831
|
|
|
832
|
-
_See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
832
|
+
_See code: [src/commands/agent/preview/start.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/preview/start.ts)_
|
|
833
833
|
|
|
834
834
|
## `sf agent publish authoring-bundle`
|
|
835
835
|
|
|
@@ -878,7 +878,7 @@ EXAMPLES
|
|
|
878
878
|
$ sf agent publish authoring-bundle --api-name MyAuthoringbundle --target-org my-dev-org
|
|
879
879
|
```
|
|
880
880
|
|
|
881
|
-
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
881
|
+
_See code: [src/commands/agent/publish/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/publish/authoring-bundle.ts)_
|
|
882
882
|
|
|
883
883
|
## `sf agent test create`
|
|
884
884
|
|
|
@@ -933,7 +933,7 @@ EXAMPLES
|
|
|
933
933
|
$ sf agent test create --spec specs/Resort_Manager-testSpec.yaml --api-name Resort_Manager_Test --preview
|
|
934
934
|
```
|
|
935
935
|
|
|
936
|
-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
936
|
+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/test/create.ts)_
|
|
937
937
|
|
|
938
938
|
## `sf agent test list`
|
|
939
939
|
|
|
@@ -968,7 +968,7 @@ EXAMPLES
|
|
|
968
968
|
$ sf agent test list --target-org my-org
|
|
969
969
|
```
|
|
970
970
|
|
|
971
|
-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
971
|
+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/test/list.ts)_
|
|
972
972
|
|
|
973
973
|
## `sf agent test results`
|
|
974
974
|
|
|
@@ -1034,7 +1034,7 @@ FLAG DESCRIPTIONS
|
|
|
1034
1034
|
expression when using custom evaluations.
|
|
1035
1035
|
```
|
|
1036
1036
|
|
|
1037
|
-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1037
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/test/results.ts)_
|
|
1038
1038
|
|
|
1039
1039
|
## `sf agent test resume`
|
|
1040
1040
|
|
|
@@ -1107,7 +1107,7 @@ FLAG DESCRIPTIONS
|
|
|
1107
1107
|
expression when using custom evaluations.
|
|
1108
1108
|
```
|
|
1109
1109
|
|
|
1110
|
-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1110
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/test/resume.ts)_
|
|
1111
1111
|
|
|
1112
1112
|
## `sf agent test run`
|
|
1113
1113
|
|
|
@@ -1181,7 +1181,7 @@ FLAG DESCRIPTIONS
|
|
|
1181
1181
|
expression when using custom evaluations.
|
|
1182
1182
|
```
|
|
1183
1183
|
|
|
1184
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1184
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/test/run.ts)_
|
|
1185
1185
|
|
|
1186
1186
|
## `sf agent validate authoring-bundle`
|
|
1187
1187
|
|
|
@@ -1228,6 +1228,6 @@ EXAMPLES
|
|
|
1228
1228
|
$ sf agent validate authoring-bundle --api-name MyAuthoringBundle --target-org my-dev-org
|
|
1229
1229
|
```
|
|
1230
1230
|
|
|
1231
|
-
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
1231
|
+
_See code: [src/commands/agent/validate/authoring-bundle.ts](https://github.com/salesforcecli/plugin-agent/blob/1.35.0/src/commands/agent/validate/authoring-bundle.ts)_
|
|
1232
1232
|
|
|
1233
1233
|
<!-- commandsstop -->
|
|
@@ -17,6 +17,7 @@ export default class AgentPreviewStart extends SfCommand<AgentPreviewStartResult
|
|
|
17
17
|
'authoring-bundle': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
18
|
'use-live-actions': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
19
19
|
'simulate-actions': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
|
+
'agent-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
21
|
};
|
|
21
22
|
run(): Promise<AgentPreviewStartResult>;
|
|
22
23
|
}
|
|
@@ -17,7 +17,7 @@ import { Flags, SfCommand, toHelpSection } from '@salesforce/sf-plugins-core';
|
|
|
17
17
|
import { EnvironmentVariable, Lifecycle, Messages, SfError } from '@salesforce/core';
|
|
18
18
|
import { Agent, ProductionAgent, ScriptAgent } from '@salesforce/agents';
|
|
19
19
|
import { createCache } from '../../../previewSessionStore.js';
|
|
20
|
-
import { COMPILATION_API_EXIT_CODES } from '../../../common.js';
|
|
20
|
+
import { COMPILATION_API_EXIT_CODES, loadAgentJson } from '../../../common.js';
|
|
21
21
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
22
22
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview.start');
|
|
23
23
|
export default class AgentPreviewStart extends SfCommand {
|
|
@@ -53,6 +53,12 @@ export default class AgentPreviewStart extends SfCommand {
|
|
|
53
53
|
summary: messages.getMessage('flags.simulate-actions.summary'),
|
|
54
54
|
exclusive: ['use-live-actions'],
|
|
55
55
|
}),
|
|
56
|
+
'agent-json': Flags.file({
|
|
57
|
+
summary: messages.getMessage('flags.agent-json.summary'),
|
|
58
|
+
hidden: true,
|
|
59
|
+
exists: true,
|
|
60
|
+
dependsOn: ['authoring-bundle'],
|
|
61
|
+
}),
|
|
56
62
|
};
|
|
57
63
|
async run() {
|
|
58
64
|
const { flags } = await this.parse(AgentPreviewStart);
|
|
@@ -65,12 +71,21 @@ export default class AgentPreviewStart extends SfCommand {
|
|
|
65
71
|
const useLiveActions = flags['use-live-actions'];
|
|
66
72
|
const simulateActions = flags['simulate-actions'];
|
|
67
73
|
const agentIdentifier = flags['authoring-bundle'] ?? flags['api-name'];
|
|
74
|
+
const preloadedAgentJson = await loadAgentJson(flags['agent-json']);
|
|
68
75
|
// Track telemetry for agent initialization
|
|
69
76
|
let agent;
|
|
70
77
|
try {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
if (flags['authoring-bundle']) {
|
|
79
|
+
agent = await Agent.init({
|
|
80
|
+
connection: conn,
|
|
81
|
+
project: this.project,
|
|
82
|
+
aabName: flags['authoring-bundle'],
|
|
83
|
+
agentJson: preloadedAgentJson,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
agent = await Agent.init({ connection: conn, project: this.project, apiNameOrId: flags['api-name'] });
|
|
88
|
+
}
|
|
74
89
|
}
|
|
75
90
|
catch (error) {
|
|
76
91
|
const wrapped = SfError.wrap(error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAe,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../../../src/commands/agent/preview/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAe,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE/E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;AAO1F,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAkC;IACxE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CA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AC,OAAO,CAAC,OAAO,CAAC,EACjB,CAAC,EACD,OAAO,CACR,CAAC;QACJ,CAAC;QAED,MAAM,WAAW,GAAG,KAAK,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;QAC/D,MAAM,WAAW,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC,CAAC;QAEvD,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,6BAA6B,EAAE,CAAC,CAAC;QAC1F,MAAM,MAAM,GAA4B,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;QACxG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;;AAGH,SAAS,kBAAkB,CAAC,KAAoC,EAAE,eAAoC;IACpG,IAAI,KAAK,YAAY,eAAe;QAAE,OAAO,WAAW,CAAC;IACzD,OAAO,eAAe,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;AAChD,CAAC"}
|
|
@@ -26,6 +26,7 @@ export default class AgentPreview extends SfCommand<AgentPreviewResult> {
|
|
|
26
26
|
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
27
|
'apex-debug': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
28
28
|
'use-live-actions': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
29
|
+
'agent-json': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
29
30
|
};
|
|
30
31
|
run(): Promise<AgentPreviewResult>;
|
|
31
32
|
}
|
|
@@ -21,6 +21,7 @@ import { Agent, AgentSource, ProductionAgent, ScriptAgent } from '@salesforce/ag
|
|
|
21
21
|
import { select } from '@inquirer/prompts';
|
|
22
22
|
import { Lifecycle, Messages, SfError } from '@salesforce/core';
|
|
23
23
|
import { AgentPreviewReact } from '../../components/agent-preview-react.js';
|
|
24
|
+
import { loadAgentJson } from '../../common.js';
|
|
24
25
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
25
26
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview');
|
|
26
27
|
// https://developer.salesforce.com/docs/einstein/genai/guide/agent-api-get-started.html#prerequisites
|
|
@@ -53,6 +54,12 @@ export default class AgentPreview extends SfCommand {
|
|
|
53
54
|
summary: messages.getMessage('flags.use-live-actions.summary'),
|
|
54
55
|
default: false,
|
|
55
56
|
}),
|
|
57
|
+
'agent-json': Flags.file({
|
|
58
|
+
summary: messages.getMessage('flags.agent-json.summary'),
|
|
59
|
+
hidden: true,
|
|
60
|
+
exists: true,
|
|
61
|
+
dependsOn: ['authoring-bundle'],
|
|
62
|
+
}),
|
|
56
63
|
};
|
|
57
64
|
async run() {
|
|
58
65
|
// STAGES OF PREVIEW
|
|
@@ -62,11 +69,18 @@ export default class AgentPreview extends SfCommand {
|
|
|
62
69
|
const { flags } = await this.parse(AgentPreview);
|
|
63
70
|
const { 'api-name': apiNameOrId, 'use-live-actions': useLiveActions, 'authoring-bundle': aabName } = flags;
|
|
64
71
|
const conn = flags['target-org'].getConnection(flags['api-version']);
|
|
72
|
+
const preloadedAgentJson = await loadAgentJson(flags['agent-json']);
|
|
65
73
|
let selectedAgent;
|
|
66
74
|
if (aabName) {
|
|
67
75
|
// user specified --authoring-bundle, use the API name directly
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
const scriptAgent = await Agent.init({
|
|
77
|
+
connection: conn,
|
|
78
|
+
project: this.project,
|
|
79
|
+
aabName,
|
|
80
|
+
agentJson: preloadedAgentJson,
|
|
81
|
+
});
|
|
82
|
+
scriptAgent.preview.setMockMode(flags['use-live-actions'] ? 'Live Test' : 'Mock');
|
|
83
|
+
selectedAgent = scriptAgent;
|
|
70
84
|
}
|
|
71
85
|
else if (apiNameOrId) {
|
|
72
86
|
selectedAgent = await Agent.init({ connection: conn, project: this.project, apiNameOrId });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/commands/agent/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAoB,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/commands/agent/preview.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,WAAW,EAAoB,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAA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KAAK,CAAC;IAClC,KAAK,EAAE,KAAK;CACb,CAAC,CAAC,CAAC"}
|
package/lib/common.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CompilationError, COMPILATION_API_EXIT_CODES } from '@salesforce/agents';
|
|
1
|
+
import { CompilationError, COMPILATION_API_EXIT_CODES, type AgentJson } from '@salesforce/agents';
|
|
2
2
|
/** Re-export so consumers can use the library's exit code contract (404 → 2, 500 → 3). */
|
|
3
3
|
export { COMPILATION_API_EXIT_CODES };
|
|
4
|
+
export declare function loadAgentJson(filePath: string | undefined): Promise<AgentJson | undefined>;
|
|
4
5
|
/**
|
|
5
6
|
* Utility function to generate SfError when there are agent compilation errors.
|
|
6
7
|
*
|
package/lib/common.js
CHANGED
|
@@ -13,11 +13,23 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { readFile } from 'node:fs/promises';
|
|
16
17
|
import { EOL } from 'node:os';
|
|
17
|
-
import { SfError } from '@salesforce/core';
|
|
18
|
+
import { Lifecycle, SfError } from '@salesforce/core';
|
|
18
19
|
import { COMPILATION_API_EXIT_CODES } from '@salesforce/agents';
|
|
19
20
|
/** Re-export so consumers can use the library's exit code contract (404 → 2, 500 → 3). */
|
|
20
21
|
export { COMPILATION_API_EXIT_CODES };
|
|
22
|
+
export async function loadAgentJson(filePath) {
|
|
23
|
+
if (!filePath)
|
|
24
|
+
return undefined;
|
|
25
|
+
try {
|
|
26
|
+
return JSON.parse(await readFile(filePath, 'utf-8'));
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
await Lifecycle.getInstance().emitTelemetry({ eventName: 'agent_preview_agent_json_read_failed' });
|
|
30
|
+
throw new SfError(`Failed to read or parse --agent-json file '${filePath}': ${SfError.wrap(error).message}`, 'AgentJsonReadError');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
/**
|
|
22
34
|
* Utility function to generate SfError when there are agent compilation errors.
|
|
23
35
|
*
|
package/lib/common.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAoB,0BAA0B,EAAkB,MAAM,oBAAoB,CAAC;AAElG,0FAA0F;AAC1F,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAEtC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAA4B;IAC9D,IAAI,CAAC,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAc,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,SAAS,CAAC,WAAW,EAAE,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,sCAAsC,EAAE,CAAC,CAAC;QACnG,MAAM,IAAI,OAAO,CACf,8CAA8C,QAAQ,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EACzF,oBAAoB,CACrB,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,iBAAqC;IAC9E,IAAI,iBAAiB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnC,MAAM,OAAO,CAAC,MAAM,CAAC;YACnB,IAAI,EAAE,yBAAyB;YAC/B,OAAO,EAAE,oCAAoC;YAC7C,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,CAAC;SACZ,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,iBAAiB,CAAC;IAEjC,MAAM,OAAO,CAAC,MAAM,CAAC;QACnB,IAAI,EAAE,yBAAyB;QAC/B,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,WAAW,QAAQ,CAAC,CAAC,SAAS,SAAS,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAC/G,IAAI,EAAE,EAAE,MAAM,EAAE;QAChB,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -39,6 +39,10 @@ Use real actions in the org; if not specified, preview uses AI to simulate (mock
|
|
|
39
39
|
|
|
40
40
|
Enable Apex debug logging during the agent preview conversation.
|
|
41
41
|
|
|
42
|
+
# flags.agent-json.summary
|
|
43
|
+
|
|
44
|
+
Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.
|
|
45
|
+
|
|
42
46
|
# examples
|
|
43
47
|
|
|
44
48
|
- Preview an agent by choosing from the list of available local Agent Script or published agents. If previewing a local Agent Script agent, use simulated mode. Use the org with alias "my-dev-org".
|
|
@@ -23,6 +23,10 @@ API name of the activated published agent you want to preview.
|
|
|
23
23
|
|
|
24
24
|
API name of the authoring bundle metadata component that contains the agent's Agent Script file.
|
|
25
25
|
|
|
26
|
+
# flags.agent-json.summary
|
|
27
|
+
|
|
28
|
+
Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.
|
|
29
|
+
|
|
26
30
|
# flags.use-live-actions.summary
|
|
27
31
|
|
|
28
32
|
Execute real actions in the org (Apex classes, flows, etc.). Required with --authoring-bundle.
|
package/oclif.manifest.json
CHANGED
|
@@ -373,6 +373,17 @@
|
|
|
373
373
|
"summary": "Use real actions in the org; if not specified, preview uses AI to simulate (mock) actions.",
|
|
374
374
|
"allowNo": false,
|
|
375
375
|
"type": "boolean"
|
|
376
|
+
},
|
|
377
|
+
"agent-json": {
|
|
378
|
+
"dependsOn": [
|
|
379
|
+
"authoring-bundle"
|
|
380
|
+
],
|
|
381
|
+
"hidden": true,
|
|
382
|
+
"name": "agent-json",
|
|
383
|
+
"summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
|
|
384
|
+
"hasDynamicHelp": false,
|
|
385
|
+
"multiple": false,
|
|
386
|
+
"type": "option"
|
|
376
387
|
}
|
|
377
388
|
},
|
|
378
389
|
"hasDynamicHelp": true,
|
|
@@ -1260,6 +1271,17 @@
|
|
|
1260
1271
|
"summary": "Use AI to simulate action execution instead of calling real actions. Required with --authoring-bundle.",
|
|
1261
1272
|
"allowNo": false,
|
|
1262
1273
|
"type": "boolean"
|
|
1274
|
+
},
|
|
1275
|
+
"agent-json": {
|
|
1276
|
+
"dependsOn": [
|
|
1277
|
+
"authoring-bundle"
|
|
1278
|
+
],
|
|
1279
|
+
"hidden": true,
|
|
1280
|
+
"name": "agent-json",
|
|
1281
|
+
"summary": "Path to a pre-compiled AgentJSON file to use instead of compiling the Agent Script file. Intended for internal use and testing.",
|
|
1282
|
+
"hasDynamicHelp": false,
|
|
1283
|
+
"multiple": false,
|
|
1284
|
+
"type": "option"
|
|
1263
1285
|
}
|
|
1264
1286
|
},
|
|
1265
1287
|
"hasDynamicHelp": true,
|
|
@@ -2353,5 +2375,5 @@
|
|
|
2353
2375
|
]
|
|
2354
2376
|
}
|
|
2355
2377
|
},
|
|
2356
|
-
"version": "1.
|
|
2378
|
+
"version": "1.35.0"
|
|
2357
2379
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/plugin-agent",
|
|
3
3
|
"description": "Commands to interact with Salesforce agents",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.35.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/forcedotcom/cli/issues",
|
|
7
7
|
"enableO11y": true,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@inquirer/prompts": "^7.10.1",
|
|
13
13
|
"@oclif/core": "^4",
|
|
14
14
|
"@oclif/multi-stage-output": "^0.8.36",
|
|
15
|
-
"@salesforce/agents": "^1.
|
|
15
|
+
"@salesforce/agents": "^1.4.0",
|
|
16
16
|
"@salesforce/core": "^8.28.3",
|
|
17
17
|
"@salesforce/kit": "^3.2.6",
|
|
18
18
|
"@salesforce/sf-plugins-core": "^12.2.6",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"exports": "./lib/index.js",
|
|
241
241
|
"type": "module",
|
|
242
242
|
"sfdx": {
|
|
243
|
-
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
244
|
-
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.
|
|
243
|
+
"publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.35.0.crt",
|
|
244
|
+
"signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-agent/1.35.0.sig"
|
|
245
245
|
}
|
|
246
246
|
}
|