@salesforce/plugin-agent 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -31
- package/lib/commands/agent/create-v2.d.ts +3 -7
- package/lib/commands/agent/create-v2.js +31 -75
- package/lib/commands/agent/create-v2.js.map +1 -1
- package/lib/commands/agent/generate/spec-v2.d.ts +64 -1
- package/lib/commands/agent/generate/spec-v2.js +170 -19
- package/lib/commands/agent/generate/spec-v2.js.map +1 -1
- package/lib/flags.d.ts +1 -28
- package/lib/flags.js +3 -41
- package/lib/flags.js.map +1 -1
- package/messages/agent.create-v2.md +5 -17
- package/messages/agent.generate.spec-v2.md +68 -0
- package/messages/shared.md +0 -20
- package/npm-shrinkwrap.json +109 -98
- package/oclif.lock +25 -5
- package/oclif.manifest.json +51 -51
- package/package.json +4 -4
- package/schemas/agent-create__v2.json +129 -5
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ EXAMPLES
|
|
|
114
114
|
$ sf agent create --name CustomerSupportAgent --spec ./config/agentSpec.json --target-org my-org
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
117
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/create.ts)_
|
|
118
118
|
|
|
119
119
|
## `sf agent create-v2`
|
|
120
120
|
|
|
@@ -123,25 +123,17 @@ Create an agent in your org using a local agent spec file.
|
|
|
123
123
|
```
|
|
124
124
|
USAGE
|
|
125
125
|
$ sf agent create-v2 -o <value> --spec <value> [--json] [--flags-dir <value>] [--api-version <value>] [--agent-name
|
|
126
|
-
<value>] [--
|
|
127
|
-
<value>]
|
|
126
|
+
<value>] [--preview] [--agent-api-name <value>]
|
|
128
127
|
|
|
129
128
|
FLAGS
|
|
130
|
-
-o, --target-org=<value>
|
|
131
|
-
|
|
132
|
-
--agent-name=<value>
|
|
133
|
-
|
|
134
|
-
--
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
--
|
|
138
|
-
--preview Preview the agent without saving it in your org.
|
|
139
|
-
--spec=<value> (required) Path to an agent spec file.
|
|
140
|
-
--tone=<option> Conversational style of the agent, such as how it expresses your brand personality in its
|
|
141
|
-
messages through word choice, punctuation, and sentence structure.
|
|
142
|
-
<options: formal|casual|neutral>
|
|
143
|
-
--user-id=<value> ID of a user in your org that is assigned to your agent; determines what your agent can
|
|
144
|
-
access and do.
|
|
129
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
130
|
+
configuration variable is already set.
|
|
131
|
+
--agent-api-name=<value> API name of the new agent; if not specified, the API name is derived from the agent name
|
|
132
|
+
(label); the API name must not exist in the org.
|
|
133
|
+
--agent-name=<value> Name (label) of the new agent.
|
|
134
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
135
|
+
--preview Preview the agent without saving it in your org.
|
|
136
|
+
--spec=<value> (required) Path to an agent spec file.
|
|
145
137
|
|
|
146
138
|
GLOBAL FLAGS
|
|
147
139
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -176,7 +168,7 @@ EXAMPLES
|
|
|
176
168
|
$ sf agent create-v2 --agent-name ResortManager --spec specs/resortManagerAgent.yaml --preview
|
|
177
169
|
```
|
|
178
170
|
|
|
179
|
-
_See code: [src/commands/agent/create-v2.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
171
|
+
_See code: [src/commands/agent/create-v2.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/create-v2.ts)_
|
|
180
172
|
|
|
181
173
|
## `sf agent generate spec`
|
|
182
174
|
|
|
@@ -237,7 +229,7 @@ EXAMPLES
|
|
|
237
229
|
$ sf agent generate spec --output-dir specs --target-org my-org
|
|
238
230
|
```
|
|
239
231
|
|
|
240
|
-
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
232
|
+
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/generate/spec.ts)_
|
|
241
233
|
|
|
242
234
|
## `sf agent generate spec-v2`
|
|
243
235
|
|
|
@@ -246,27 +238,38 @@ Generate an agent spec, which is a YAML file that captures what an agent can do.
|
|
|
246
238
|
```
|
|
247
239
|
USAGE
|
|
248
240
|
$ sf agent generate spec-v2 -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t customer|internal]
|
|
249
|
-
[--role <value>] [--company-name <value>] [--company-description <value>] [--company-website <value>] [--
|
|
250
|
-
<value>] [--
|
|
241
|
+
[--role <value>] [--company-name <value>] [--company-description <value>] [--company-website <value>] [--max-topics
|
|
242
|
+
<value>] [--agent-user <value>] [--enrich-logs true|false] [--tone formal|casual|neutral] [--spec <value>]
|
|
243
|
+
[--output-file <value>] [--full-interview] [--grounding-context <value> --prompt-template <value>] [--no-prompt]
|
|
251
244
|
|
|
252
245
|
FLAGS
|
|
253
246
|
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
254
247
|
configuration variable is already set.
|
|
255
248
|
-t, --type=<option> Type of agent to create.
|
|
256
249
|
<options: customer|internal>
|
|
250
|
+
--agent-user=<value> Username of a user in your org to assign to your agent; determines what your agent
|
|
251
|
+
can access and do.
|
|
257
252
|
--api-version=<value> Override the api version used for api requests made by this command
|
|
258
253
|
--company-description=<value> Description of your company.
|
|
259
254
|
--company-name=<value> Name of your company.
|
|
260
255
|
--company-website=<value> Website URL of your company.
|
|
256
|
+
--enrich-logs=<option> Adds agent conversation data to event logs so you can view all agent session
|
|
257
|
+
activity in one place.
|
|
258
|
+
<options: true|false>
|
|
259
|
+
--full-interview Prompt for both required and optional flags.
|
|
261
260
|
--grounding-context=<value> Context information and personalization that's added to your prompts when using a
|
|
262
261
|
custom prompt template.
|
|
263
262
|
--max-topics=<value> Maximum number of topics to generate in the agent spec; default is 10.
|
|
263
|
+
--no-prompt Don't prompt the user to confirm spec file overwrite.
|
|
264
264
|
--output-file=<value> [default: config/agentSpec.yaml] Path for the generated YAML agent spec file; can
|
|
265
265
|
be an absolute or relative path.
|
|
266
266
|
--prompt-template=<value> API name of a customized prompt template to use instead of the default prompt
|
|
267
267
|
template.
|
|
268
268
|
--role=<value> Role of the agent.
|
|
269
269
|
--spec=<value> Agent spec file, in YAML format, to use as input to the command.
|
|
270
|
+
--tone=<option> Conversational style of the agent, such as how it expresses your brand personality
|
|
271
|
+
in its messages through word choice, punctuation, and sentence structure.
|
|
272
|
+
<options: formal|casual|neutral>
|
|
270
273
|
|
|
271
274
|
GLOBAL FLAGS
|
|
272
275
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -319,7 +322,7 @@ EXAMPLES
|
|
|
319
322
|
smoothly" --target-org my-org
|
|
320
323
|
```
|
|
321
324
|
|
|
322
|
-
_See code: [src/commands/agent/generate/spec-v2.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
325
|
+
_See code: [src/commands/agent/generate/spec-v2.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/generate/spec-v2.ts)_
|
|
323
326
|
|
|
324
327
|
## `sf agent generate test-spec`
|
|
325
328
|
|
|
@@ -342,7 +345,7 @@ EXAMPLES
|
|
|
342
345
|
$ sf agent generate test-spec
|
|
343
346
|
```
|
|
344
347
|
|
|
345
|
-
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
348
|
+
_See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/generate/test-spec.ts)_
|
|
346
349
|
|
|
347
350
|
## `sf agent preview`
|
|
348
351
|
|
|
@@ -377,7 +380,7 @@ FLAG DESCRIPTIONS
|
|
|
377
380
|
the API name of the agent? (TBD based on agents library)
|
|
378
381
|
```
|
|
379
382
|
|
|
380
|
-
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
383
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/preview.ts)_
|
|
381
384
|
|
|
382
385
|
## `sf agent test cancel`
|
|
383
386
|
|
|
@@ -414,7 +417,7 @@ EXAMPLES
|
|
|
414
417
|
$ sf agent test cancel --job-id 4KBfake0000003F4AQ --target-org my-org
|
|
415
418
|
```
|
|
416
419
|
|
|
417
|
-
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
420
|
+
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/cancel.ts)_
|
|
418
421
|
|
|
419
422
|
## `sf agent test create`
|
|
420
423
|
|
|
@@ -450,7 +453,7 @@ FLAG DESCRIPTIONS
|
|
|
450
453
|
More information about a flag. Don't repeat the summary.
|
|
451
454
|
```
|
|
452
455
|
|
|
453
|
-
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
456
|
+
_See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/create.ts)_
|
|
454
457
|
|
|
455
458
|
## `sf agent test list`
|
|
456
459
|
|
|
@@ -479,7 +482,7 @@ EXAMPLES
|
|
|
479
482
|
$ sf agent test list
|
|
480
483
|
```
|
|
481
484
|
|
|
482
|
-
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
485
|
+
_See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/list.ts)_
|
|
483
486
|
|
|
484
487
|
## `sf agent test results`
|
|
485
488
|
|
|
@@ -535,7 +538,7 @@ FLAG DESCRIPTIONS
|
|
|
535
538
|
test results aren't written.
|
|
536
539
|
```
|
|
537
540
|
|
|
538
|
-
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
541
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/results.ts)_
|
|
539
542
|
|
|
540
543
|
## `sf agent test resume`
|
|
541
544
|
|
|
@@ -598,7 +601,7 @@ FLAG DESCRIPTIONS
|
|
|
598
601
|
test results aren't written.
|
|
599
602
|
```
|
|
600
603
|
|
|
601
|
-
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
604
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/resume.ts)_
|
|
602
605
|
|
|
603
606
|
## `sf agent test run`
|
|
604
607
|
|
|
@@ -661,6 +664,6 @@ FLAG DESCRIPTIONS
|
|
|
661
664
|
test results aren't written.
|
|
662
665
|
```
|
|
663
666
|
|
|
664
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.
|
|
667
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.11.1/src/commands/agent/test/run.ts)_
|
|
665
668
|
|
|
666
669
|
<!-- commandsstop -->
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { AgentCreateResponseV2 } from '@salesforce/agents';
|
|
3
|
+
export type AgentCreateResult = AgentCreateResponseV2 & {
|
|
4
|
+
previewFilePath?: string;
|
|
5
5
|
};
|
|
6
6
|
export default class AgentCreateV2 extends SfCommand<AgentCreateResult> {
|
|
7
7
|
static readonly summary: string;
|
|
@@ -13,12 +13,8 @@ export default class AgentCreateV2 extends SfCommand<AgentCreateResult> {
|
|
|
13
13
|
spec: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
14
|
preview: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
15
15
|
'agent-api-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
-
'primary-language': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
16
|
'planner-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
18
17
|
"agent-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
-
"user-id": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
20
|
-
"enrich-logs": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
|
-
tone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
18
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
19
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
20
|
};
|
|
@@ -11,7 +11,7 @@ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
|
11
11
|
import { Lifecycle, Messages } from '@salesforce/core';
|
|
12
12
|
import { MultiStageOutput } from '@oclif/multi-stage-output';
|
|
13
13
|
import { colorize } from '@oclif/core/ux';
|
|
14
|
-
import { Agent, AgentCreateLifecycleStagesV2 } from '@salesforce/agents';
|
|
14
|
+
import { Agent, AgentCreateLifecycleStagesV2, generateAgentApiName, } from '@salesforce/agents';
|
|
15
15
|
import { makeFlags, promptForFlag, validateAgentType } from '../../flags.js';
|
|
16
16
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
17
17
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create-v2');
|
|
@@ -27,32 +27,6 @@ const FLAGGABLE_PROMPTS = {
|
|
|
27
27
|
validate: (d) => d.length > 0 || 'Agent Name cannot be empty',
|
|
28
28
|
required: true,
|
|
29
29
|
},
|
|
30
|
-
'user-id': {
|
|
31
|
-
message: messages.getMessage('flags.user-id.summary'),
|
|
32
|
-
validate: (d) => {
|
|
33
|
-
// Allow empty string
|
|
34
|
-
if (d.length === 0)
|
|
35
|
-
return true;
|
|
36
|
-
if (d.length === 15 || d.length === 18) {
|
|
37
|
-
if (d.startsWith('005')) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return 'Please enter a valid User ID (005 prefix)';
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
'enrich-logs': {
|
|
45
|
-
message: messages.getMessage('flags.enrich-logs.summary'),
|
|
46
|
-
validate: () => true,
|
|
47
|
-
options: ['true', 'false'],
|
|
48
|
-
default: 'false',
|
|
49
|
-
},
|
|
50
|
-
tone: {
|
|
51
|
-
message: messages.getMessage('flags.tone.summary'),
|
|
52
|
-
validate: () => true,
|
|
53
|
-
options: ['formal', 'casual', 'neutral'],
|
|
54
|
-
default: 'casual',
|
|
55
|
-
},
|
|
56
30
|
};
|
|
57
31
|
export default class AgentCreateV2 extends SfCommand {
|
|
58
32
|
static summary = messages.getMessage('summary');
|
|
@@ -73,50 +47,33 @@ export default class AgentCreateV2 extends SfCommand {
|
|
|
73
47
|
preview: Flags.boolean({
|
|
74
48
|
summary: messages.getMessage('flags.preview.summary'),
|
|
75
49
|
}),
|
|
76
|
-
// Currently hidden; Do we even want to expose this?
|
|
77
50
|
'agent-api-name': Flags.string({
|
|
78
51
|
summary: messages.getMessage('flags.agent-api-name.summary'),
|
|
79
|
-
hidden: true,
|
|
80
|
-
}),
|
|
81
|
-
// Currently hidden because only 'en_US' is supported
|
|
82
|
-
'primary-language': Flags.string({
|
|
83
|
-
summary: messages.getMessage('flags.primary-language.summary'),
|
|
84
|
-
options: ['en_US'],
|
|
85
|
-
default: 'en_US',
|
|
86
|
-
hidden: true,
|
|
87
52
|
}),
|
|
88
|
-
//
|
|
53
|
+
// This would be used as more of an agent update than create.
|
|
54
|
+
// Could possibly move to an `agent update` command.
|
|
89
55
|
'planner-id': Flags.string({
|
|
90
56
|
summary: messages.getMessage('flags.planner-id.summary'),
|
|
57
|
+
hidden: true,
|
|
91
58
|
}),
|
|
92
59
|
};
|
|
93
60
|
// eslint-disable-next-line complexity
|
|
94
61
|
async run() {
|
|
95
62
|
const { flags } = await this.parse(AgentCreateV2);
|
|
96
63
|
// throw error if --json is used and not all required flags are provided
|
|
97
|
-
if (this.jsonEnabled()) {
|
|
98
|
-
|
|
99
|
-
throw messages.createError('error.missingRequiredFlags', ['agent-name']);
|
|
100
|
-
}
|
|
64
|
+
if (this.jsonEnabled() && !flags['agent-name']) {
|
|
65
|
+
throw messages.createError('error.missingRequiredFlags', ['agent-name']);
|
|
101
66
|
}
|
|
102
67
|
// Read the agent spec and validate
|
|
103
68
|
const inputSpec = YAML.parse(readFileSync(resolve(flags.spec), 'utf8'));
|
|
104
69
|
validateSpec(inputSpec);
|
|
105
|
-
// If we
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
let enrichLogs = flags['enrich-logs'];
|
|
109
|
-
let tone = flags.tone;
|
|
110
|
-
if (!this.jsonEnabled() && !flags.preview) {
|
|
111
|
-
agentName ??= await promptForFlag(FLAGGABLE_PROMPTS['agent-name']);
|
|
112
|
-
userId ??= await promptForFlag(FLAGGABLE_PROMPTS['user-id']);
|
|
113
|
-
enrichLogs ??= await promptForFlag(FLAGGABLE_PROMPTS['enrich-logs']);
|
|
114
|
-
tone ??= await promptForFlag(FLAGGABLE_PROMPTS.tone);
|
|
115
|
-
}
|
|
70
|
+
// If we don't have an agent name yet, prompt.
|
|
71
|
+
const agentName = flags['agent-name'] ?? (await promptForFlag(FLAGGABLE_PROMPTS['agent-name']));
|
|
72
|
+
const agentApiName = flags['agent-api-name'] ?? generateAgentApiName(agentName);
|
|
116
73
|
let title;
|
|
117
74
|
const stages = [MSO_STAGES.parse];
|
|
118
75
|
if (flags.preview) {
|
|
119
|
-
title =
|
|
76
|
+
title = `Previewing ${agentName} Creation`;
|
|
120
77
|
stages.push(MSO_STAGES.preview);
|
|
121
78
|
}
|
|
122
79
|
else {
|
|
@@ -124,11 +81,7 @@ export default class AgentCreateV2 extends SfCommand {
|
|
|
124
81
|
stages.push(MSO_STAGES.create);
|
|
125
82
|
stages.push(MSO_STAGES.retrieve);
|
|
126
83
|
}
|
|
127
|
-
const mso = new MultiStageOutput({
|
|
128
|
-
jsonEnabled: this.jsonEnabled(),
|
|
129
|
-
title,
|
|
130
|
-
stages,
|
|
131
|
-
});
|
|
84
|
+
const mso = new MultiStageOutput({ jsonEnabled: this.jsonEnabled(), title, stages });
|
|
132
85
|
mso.goto(MSO_STAGES.parse);
|
|
133
86
|
// @ts-expect-error not using async method in callback
|
|
134
87
|
Lifecycle.getInstance().on(AgentCreateLifecycleStagesV2.Previewing, () => mso.goto(MSO_STAGES.preview));
|
|
@@ -155,38 +108,41 @@ export default class AgentCreateV2 extends SfCommand {
|
|
|
155
108
|
}
|
|
156
109
|
if (!flags.preview) {
|
|
157
110
|
agentConfig.saveAgent = true;
|
|
158
|
-
agentConfig.agentSettings = {
|
|
159
|
-
agentName: agentName,
|
|
160
|
-
};
|
|
161
|
-
if (flags['agent-api-name']) {
|
|
162
|
-
agentConfig.agentSettings.agentApiName = flags['agent-api-name'];
|
|
163
|
-
}
|
|
111
|
+
agentConfig.agentSettings = { agentName, agentApiName };
|
|
164
112
|
if (flags['planner-id']) {
|
|
165
113
|
agentConfig.agentSettings.plannerId = flags['planner-id'];
|
|
166
114
|
}
|
|
167
|
-
if (
|
|
168
|
-
|
|
115
|
+
if (inputSpec?.agentUser) {
|
|
116
|
+
// TODO: query for the user ID from the username
|
|
117
|
+
agentConfig.agentSettings.userId = inputSpec.agentUser;
|
|
118
|
+
}
|
|
119
|
+
if (inputSpec?.enrichLogs) {
|
|
120
|
+
agentConfig.agentSettings.enrichLogs = inputSpec.enrichLogs;
|
|
121
|
+
}
|
|
122
|
+
if (inputSpec?.tone) {
|
|
123
|
+
agentConfig.agentSettings.tone = inputSpec.tone;
|
|
169
124
|
}
|
|
170
|
-
agentConfig.agentSettings.enrichLogs = Boolean(enrichLogs);
|
|
171
|
-
agentConfig.agentSettings.tone = tone;
|
|
172
125
|
}
|
|
173
126
|
const response = await agent.createV2(agentConfig);
|
|
127
|
+
const result = response;
|
|
174
128
|
mso.stop();
|
|
175
129
|
if (response.isSuccess) {
|
|
176
130
|
if (!flags.preview) {
|
|
177
|
-
|
|
178
|
-
this.log(`
|
|
131
|
+
const orgUsername = flags['target-org'].getUsername();
|
|
132
|
+
this.log(`Successfully created ${agentName} in ${orgUsername}.\n`);
|
|
133
|
+
this.log(`Use ${colorize('dim', `sf org open agent --name ${agentApiName} -o ${orgUsername}`)} to view the agent in the browser.`);
|
|
179
134
|
}
|
|
180
135
|
else {
|
|
181
|
-
const previewFileName =
|
|
136
|
+
const previewFileName = `${agentApiName}_Preview_${new Date().toISOString()}.json`;
|
|
182
137
|
writeFileSync(previewFileName, JSON.stringify(response, null, 2));
|
|
183
|
-
|
|
138
|
+
result.previewFilePath = resolve(previewFileName);
|
|
139
|
+
this.log(`Successfully created agent for preview. See ${previewFileName}\n`);
|
|
184
140
|
}
|
|
185
141
|
}
|
|
186
142
|
else {
|
|
187
|
-
this.log(colorize('red', `
|
|
143
|
+
this.log(colorize('red', `Failed to create agent: ${response.errorMessage ?? ''}`));
|
|
188
144
|
}
|
|
189
|
-
return
|
|
145
|
+
return result;
|
|
190
146
|
}
|
|
191
147
|
}
|
|
192
148
|
// The spec must define: agentType, role, companyName, companyDescription, and topics.
|
|
@@ -201,7 +157,7 @@ const validateSpec = (spec) => {
|
|
|
201
157
|
];
|
|
202
158
|
const missingFlags = requiredSpecValues.filter((f) => !spec[f]);
|
|
203
159
|
if (missingFlags.length) {
|
|
204
|
-
throw messages.createError('error.
|
|
160
|
+
throw messages.createError('error.missingRequiredSpecProperties', [missingFlags.join(', ')]);
|
|
205
161
|
}
|
|
206
162
|
validateAgentType(spec.agentType, true);
|
|
207
163
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-v2.js","sourceRoot":"","sources":["../../../src/commands/agent/create-v2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"create-v2.js","sourceRoot":"","sources":["../../../src/commands/agent/create-v2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,KAAK,EAGL,4BAA4B,EAE5B,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAmB,SAAS,E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AAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,MAAM,QAAQ,CAAC,WAAW,CAAC,qCAAqC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAED,iBAAiB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC,CAAC"}
|
|
@@ -5,6 +5,64 @@ export type AgentCreateSpecResult = {
|
|
|
5
5
|
errorMessage?: string;
|
|
6
6
|
specPath?: string;
|
|
7
7
|
} & AgentJobSpecV2;
|
|
8
|
+
export type AgentSpecFileContents = AgentJobSpecV2 & {
|
|
9
|
+
agentUser?: string;
|
|
10
|
+
enrichLogs?: boolean;
|
|
11
|
+
tone?: 'casual' | 'formal' | 'neutral';
|
|
12
|
+
primaryLanguage?: 'en_US';
|
|
13
|
+
};
|
|
14
|
+
export declare const FLAGGABLE_PROMPTS: {
|
|
15
|
+
type: {
|
|
16
|
+
message: string;
|
|
17
|
+
validate: (d: string) => boolean | string;
|
|
18
|
+
char: "t";
|
|
19
|
+
options: string[];
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
role: {
|
|
23
|
+
message: string;
|
|
24
|
+
validate: (d: string) => boolean | string;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
'company-name': {
|
|
28
|
+
message: string;
|
|
29
|
+
validate: (d: string) => boolean | string;
|
|
30
|
+
required: true;
|
|
31
|
+
};
|
|
32
|
+
'company-description': {
|
|
33
|
+
message: string;
|
|
34
|
+
validate: (d: string) => boolean | string;
|
|
35
|
+
required: true;
|
|
36
|
+
};
|
|
37
|
+
'company-website': {
|
|
38
|
+
message: string;
|
|
39
|
+
validate: (d: string) => boolean | string;
|
|
40
|
+
};
|
|
41
|
+
'max-topics': {
|
|
42
|
+
message: string;
|
|
43
|
+
promptMessage: string;
|
|
44
|
+
validate: () => boolean | string;
|
|
45
|
+
};
|
|
46
|
+
'agent-user': {
|
|
47
|
+
message: string;
|
|
48
|
+
promptMessage: string;
|
|
49
|
+
validate: () => boolean | string;
|
|
50
|
+
};
|
|
51
|
+
'enrich-logs': {
|
|
52
|
+
message: string;
|
|
53
|
+
promptMessage: string;
|
|
54
|
+
validate: () => boolean | string;
|
|
55
|
+
options: string[];
|
|
56
|
+
default: string;
|
|
57
|
+
};
|
|
58
|
+
tone: {
|
|
59
|
+
message: string;
|
|
60
|
+
promptMessage: string;
|
|
61
|
+
validate: () => boolean | string;
|
|
62
|
+
options: string[];
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
8
66
|
export default class AgentCreateSpecV2 extends SfCommand<AgentCreateSpecResult> {
|
|
9
67
|
static readonly summary: string;
|
|
10
68
|
static readonly description: string;
|
|
@@ -14,14 +72,19 @@ export default class AgentCreateSpecV2 extends SfCommand<AgentCreateSpecResult>
|
|
|
14
72
|
static readonly flags: {
|
|
15
73
|
spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
74
|
'output-file': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
'
|
|
75
|
+
'full-interview': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
76
|
'prompt-template': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
77
|
'grounding-context': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
78
|
+
'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
20
79
|
type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
21
80
|
role: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
22
81
|
"company-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
23
82
|
"company-description": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
24
83
|
"company-website": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
84
|
+
"max-topics": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
85
|
+
"agent-user": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
86
|
+
"enrich-logs": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
87
|
+
tone: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
88
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
26
89
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
27
90
|
};
|