@salesforce/plugin-agent 1.11.1 → 1.12.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.
@@ -1,164 +0,0 @@
1
- /*
2
- * Copyright (c) 2024, salesforce.com, inc.
3
- * All rights reserved.
4
- * Licensed under the BSD 3-Clause license.
5
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
- */
7
- import { resolve } from 'node:path';
8
- import { readFileSync, writeFileSync } from 'node:fs';
9
- import YAML from 'yaml';
10
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
11
- import { Lifecycle, Messages } from '@salesforce/core';
12
- import { MultiStageOutput } from '@oclif/multi-stage-output';
13
- import { colorize } from '@oclif/core/ux';
14
- import { Agent, AgentCreateLifecycleStagesV2, generateAgentApiName, } from '@salesforce/agents';
15
- import { makeFlags, promptForFlag, validateAgentType } from '../../flags.js';
16
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
17
- const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create-v2');
18
- const MSO_STAGES = {
19
- parse: 'Parsing Agent spec',
20
- preview: 'Creating Agent for preview',
21
- create: 'Creating Agent in org',
22
- retrieve: 'Retrieving Agent metadata',
23
- };
24
- const FLAGGABLE_PROMPTS = {
25
- 'agent-name': {
26
- message: messages.getMessage('flags.agent-name.summary'),
27
- validate: (d) => d.length > 0 || 'Agent Name cannot be empty',
28
- required: true,
29
- },
30
- };
31
- export default class AgentCreateV2 extends SfCommand {
32
- static summary = messages.getMessage('summary');
33
- static description = messages.getMessage('description');
34
- static examples = messages.getMessages('examples');
35
- static requiresProject = true;
36
- static state = 'beta';
37
- static flags = {
38
- 'target-org': Flags.requiredOrg(),
39
- 'api-version': Flags.orgApiVersion(),
40
- ...makeFlags(FLAGGABLE_PROMPTS),
41
- spec: Flags.file({
42
- // char: 'f',
43
- summary: messages.getMessage('flags.spec.summary'),
44
- exists: true,
45
- required: true,
46
- }),
47
- preview: Flags.boolean({
48
- summary: messages.getMessage('flags.preview.summary'),
49
- }),
50
- 'agent-api-name': Flags.string({
51
- summary: messages.getMessage('flags.agent-api-name.summary'),
52
- }),
53
- // This would be used as more of an agent update than create.
54
- // Could possibly move to an `agent update` command.
55
- 'planner-id': Flags.string({
56
- summary: messages.getMessage('flags.planner-id.summary'),
57
- hidden: true,
58
- }),
59
- };
60
- // eslint-disable-next-line complexity
61
- async run() {
62
- const { flags } = await this.parse(AgentCreateV2);
63
- // throw error if --json is used and not all required flags are provided
64
- if (this.jsonEnabled() && !flags['agent-name']) {
65
- throw messages.createError('error.missingRequiredFlags', ['agent-name']);
66
- }
67
- // Read the agent spec and validate
68
- const inputSpec = YAML.parse(readFileSync(resolve(flags.spec), 'utf8'));
69
- validateSpec(inputSpec);
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);
73
- let title;
74
- const stages = [MSO_STAGES.parse];
75
- if (flags.preview) {
76
- title = `Previewing ${agentName} Creation`;
77
- stages.push(MSO_STAGES.preview);
78
- }
79
- else {
80
- title = `Creating ${agentName} Agent`;
81
- stages.push(MSO_STAGES.create);
82
- stages.push(MSO_STAGES.retrieve);
83
- }
84
- const mso = new MultiStageOutput({ jsonEnabled: this.jsonEnabled(), title, stages });
85
- mso.goto(MSO_STAGES.parse);
86
- // @ts-expect-error not using async method in callback
87
- Lifecycle.getInstance().on(AgentCreateLifecycleStagesV2.Previewing, () => mso.goto(MSO_STAGES.preview));
88
- // @ts-expect-error not using async method in callback
89
- Lifecycle.getInstance().on(AgentCreateLifecycleStagesV2.Creating, () => mso.goto(MSO_STAGES.create));
90
- // @ts-expect-error not using async method in callback
91
- Lifecycle.getInstance().on(AgentCreateLifecycleStagesV2.Retrieving, () => mso.goto(MSO_STAGES.retrieve));
92
- const connection = flags['target-org'].getConnection(flags['api-version']);
93
- const agent = new Agent(connection, this.project);
94
- const agentConfig = {
95
- agentType: inputSpec.agentType,
96
- generationInfo: {
97
- defaultInfo: {
98
- role: inputSpec.role,
99
- companyName: inputSpec.companyName,
100
- companyDescription: inputSpec.companyDescription,
101
- preDefinedTopics: inputSpec.topics,
102
- },
103
- },
104
- generationSettings: {},
105
- };
106
- if (inputSpec?.companyWebsite) {
107
- agentConfig.generationInfo.defaultInfo.companyWebsite = inputSpec?.companyWebsite;
108
- }
109
- if (!flags.preview) {
110
- agentConfig.saveAgent = true;
111
- agentConfig.agentSettings = { agentName, agentApiName };
112
- if (flags['planner-id']) {
113
- agentConfig.agentSettings.plannerId = flags['planner-id'];
114
- }
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;
124
- }
125
- }
126
- const response = await agent.createV2(agentConfig);
127
- const result = response;
128
- mso.stop();
129
- if (response.isSuccess) {
130
- if (!flags.preview) {
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.`);
134
- }
135
- else {
136
- const previewFileName = `${agentApiName}_Preview_${new Date().toISOString()}.json`;
137
- writeFileSync(previewFileName, JSON.stringify(response, null, 2));
138
- result.previewFilePath = resolve(previewFileName);
139
- this.log(`Successfully created agent for preview. See ${previewFileName}\n`);
140
- }
141
- }
142
- else {
143
- this.log(colorize('red', `Failed to create agent: ${response.errorMessage ?? ''}`));
144
- }
145
- return result;
146
- }
147
- }
148
- // The spec must define: agentType, role, companyName, companyDescription, and topics.
149
- // Agent type must be 'customer' or 'internal'.
150
- const validateSpec = (spec) => {
151
- const requiredSpecValues = [
152
- 'agentType',
153
- 'role',
154
- 'companyName',
155
- 'companyDescription',
156
- 'topics',
157
- ];
158
- const missingFlags = requiredSpecValues.filter((f) => !spec[f]);
159
- if (missingFlags.length) {
160
- throw messages.createError('error.missingRequiredSpecProperties', [missingFlags.join(', ')]);
161
- }
162
- validateAgentType(spec.agentType, true);
163
- };
164
- //# sourceMappingURL=create-v2.js.map
@@ -1 +0,0 @@
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,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAG9F,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,iBAAiB,CAAC,CAAC;AAOtF,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,oBAAoB;IAC3B,OAAO,EAAE,4BAA4B;IACrC,MAAM,EAAE,uBAAuB;IAC/B,QAAQ,EAAE,2BAA2B;CACtC,CAAC;AAEF,MAAM,iBAAiB,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- export type AgentCreateSpecResult = {
4
- isSuccess: boolean;
5
- errorMessage?: string;
6
- specPath?: string;
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
- };
66
- export default class AgentCreateSpecV2 extends SfCommand<AgentCreateSpecResult> {
67
- static readonly summary: string;
68
- static readonly description: string;
69
- static readonly examples: string[];
70
- static state: string;
71
- static readonly requiresProject = true;
72
- static readonly flags: {
73
- spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
74
- 'output-file': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
75
- 'full-interview': import("@oclif/core/interfaces").BooleanFlag<boolean>;
76
- 'prompt-template': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
77
- 'grounding-context': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
78
- 'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
79
- type: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
80
- role: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
81
- "company-name": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
82
- "company-description": import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
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>;
88
- 'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
89
- 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
90
- };
91
- run(): Promise<AgentCreateSpecResult>;
92
- }
@@ -1,268 +0,0 @@
1
- /*
2
- * Copyright (c) 2024, salesforce.com, inc.
3
- * All rights reserved.
4
- * Licensed under the BSD 3-Clause license.
5
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
- */
7
- import { join, resolve, dirname } from 'node:path';
8
- import { mkdirSync, readFileSync, writeFileSync, existsSync } from 'node:fs';
9
- import { SfCommand, Flags, prompts } from '@salesforce/sf-plugins-core';
10
- import { Messages } from '@salesforce/core';
11
- import YAML from 'yaml';
12
- import { Agent } from '@salesforce/agents';
13
- import { makeFlags, promptForFlag, validateAgentType, validateMaxTopics } from '../../../flags.js';
14
- Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
15
- const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.spec-v2');
16
- export const FLAGGABLE_PROMPTS = {
17
- type: {
18
- message: messages.getMessage('flags.type.summary'),
19
- validate: (d) => d.length > 0 || 'Type cannot be empty',
20
- char: 't',
21
- options: ['customer', 'internal'],
22
- required: true,
23
- },
24
- role: {
25
- message: messages.getMessage('flags.role.summary'),
26
- validate: (d) => d.length > 0 || 'Role cannot be empty',
27
- required: true,
28
- },
29
- 'company-name': {
30
- message: messages.getMessage('flags.company-name.summary'),
31
- validate: (d) => d.length > 0 || 'Company name cannot be empty',
32
- required: true,
33
- },
34
- 'company-description': {
35
- message: messages.getMessage('flags.company-description.summary'),
36
- validate: (d) => d.length > 0 || 'Company description cannot be empty',
37
- required: true,
38
- },
39
- 'company-website': {
40
- message: messages.getMessage('flags.company-website.summary'),
41
- validate: (d) => {
42
- // Allow empty string
43
- if (d.length === 0)
44
- return true;
45
- try {
46
- const regExp = new RegExp('^(http|https)://', 'i');
47
- const companySite = regExp.test(d) ? d : `https://${d}`;
48
- new URL(companySite);
49
- d = companySite;
50
- return true;
51
- }
52
- catch (e) {
53
- return 'Please enter a valid URL';
54
- }
55
- },
56
- },
57
- 'max-topics': {
58
- message: messages.getMessage('flags.max-topics.summary'),
59
- promptMessage: messages.getMessage('flags.max-topics.prompt'),
60
- validate: () => true,
61
- // min: 1,
62
- // max: 30,
63
- },
64
- 'agent-user': {
65
- message: messages.getMessage('flags.agent-user.summary'),
66
- promptMessage: messages.getMessage('flags.agent-user.prompt'),
67
- validate: () => true,
68
- },
69
- 'enrich-logs': {
70
- message: messages.getMessage('flags.enrich-logs.summary'),
71
- promptMessage: messages.getMessage('flags.enrich-logs.prompt'),
72
- validate: () => true,
73
- options: ['true', 'false'],
74
- default: 'false',
75
- },
76
- tone: {
77
- message: messages.getMessage('flags.tone.summary'),
78
- promptMessage: messages.getMessage('flags.tone.prompt'),
79
- validate: () => true,
80
- options: ['formal', 'casual', 'neutral'],
81
- default: 'casual',
82
- },
83
- // 'primary-language': {
84
- // message: messages.getMessage('flags.primary-language.summary'),
85
- // validate: (): boolean | string => true,
86
- // options: ['en_US'],
87
- // default: 'en_US',
88
- // },
89
- };
90
- export default class AgentCreateSpecV2 extends SfCommand {
91
- static summary = messages.getMessage('summary');
92
- static description = messages.getMessage('description');
93
- static examples = messages.getMessages('examples');
94
- static state = 'beta';
95
- static requiresProject = true;
96
- static flags = {
97
- 'target-org': Flags.requiredOrg(),
98
- 'api-version': Flags.orgApiVersion(),
99
- ...makeFlags(FLAGGABLE_PROMPTS),
100
- // a spec file can be used as input. Allows iterative spec development.
101
- spec: Flags.file({
102
- summary: messages.getMessage('flags.spec.summary'),
103
- exists: true,
104
- }),
105
- 'output-file': Flags.file({
106
- summary: messages.getMessage('flags.output-file.summary'),
107
- default: join('config', 'agentSpec.yaml'),
108
- }),
109
- 'full-interview': Flags.boolean({
110
- summary: messages.getMessage('flags.full-interview.summary'),
111
- }),
112
- 'prompt-template': Flags.string({
113
- summary: messages.getMessage('flags.prompt-template.summary'),
114
- }),
115
- 'grounding-context': Flags.string({
116
- summary: messages.getMessage('flags.grounding-context.summary'),
117
- dependsOn: ['prompt-template'],
118
- }),
119
- 'no-prompt': Flags.boolean({
120
- summary: messages.getMessage('flags.no-prompt.summary'),
121
- }),
122
- };
123
- // eslint-disable-next-line complexity
124
- async run() {
125
- const { flags } = await this.parse(AgentCreateSpecV2);
126
- let outputFile;
127
- try {
128
- outputFile = await resolveOutputFile(flags['output-file'], flags['no-prompt']);
129
- }
130
- catch (e) {
131
- this.log(messages.getMessage('commandCanceled'));
132
- // @ts-expect-error expected due to command cancelation.
133
- return;
134
- }
135
- // throw error if --json is used and not all required flags are provided
136
- if (this.jsonEnabled()) {
137
- const missingFlags = Object.entries(FLAGGABLE_PROMPTS)
138
- .filter(([key, prompt]) => 'required' in prompt && prompt.required && !(key in flags))
139
- .map(([key]) => key);
140
- if (missingFlags.length) {
141
- throw messages.createError('error.missingRequiredFlags', [missingFlags.join(', ')]);
142
- }
143
- }
144
- this.log();
145
- this.styledHeader('Agent Details');
146
- // If spec is provided, read it first
147
- let inputSpec = {};
148
- if (flags.spec) {
149
- inputSpec = YAML.parse(readFileSync(resolve(flags.spec), 'utf8'));
150
- }
151
- // Flags override inputSpec values. Prompt if neither is set.
152
- const type = flags.type ?? validateAgentType(inputSpec?.agentType) ?? (await promptForFlag(FLAGGABLE_PROMPTS.type));
153
- const companyName = flags['company-name'] ?? inputSpec?.companyName ?? (await promptForFlag(FLAGGABLE_PROMPTS['company-name']));
154
- const companyDescription = flags['company-description'] ??
155
- inputSpec?.companyDescription ??
156
- (await promptForFlag(FLAGGABLE_PROMPTS['company-description']));
157
- const role = flags.role ?? inputSpec?.role ?? (await promptForFlag(FLAGGABLE_PROMPTS.role));
158
- // full interview prompts
159
- const companyWebsite = flags['company-website'] ??
160
- inputSpec?.companyWebsite ??
161
- (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS['company-website']) : undefined);
162
- const maxNumOfTopics = flags['max-topics'] ??
163
- validateMaxTopics(inputSpec?.maxNumOfTopics) ??
164
- (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS['max-topics']) : 10);
165
- const agentUser = flags['agent-user'] ??
166
- inputSpec?.agentUser ??
167
- (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS['agent-user']) : undefined);
168
- let enrichLogs = flags['enrich-logs'] ??
169
- inputSpec?.enrichLogs ??
170
- (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS['enrich-logs']) : undefined);
171
- enrichLogs = Boolean(enrichLogs === 'true' || enrichLogs === true);
172
- const tone = flags.tone ??
173
- inputSpec?.tone ??
174
- (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS.tone) : undefined);
175
- // const primaryLanguage =
176
- // flags['primary-language'] ??
177
- // inputSpec?.primaryLanguage ??
178
- // (flags['full-interview'] ? await promptForFlag(FLAGGABLE_PROMPTS['primary-language']) : undefined);
179
- this.log();
180
- this.spinner.start('Creating agent spec');
181
- const connection = flags['target-org'].getConnection(flags['api-version']);
182
- const agent = new Agent(connection, this.project);
183
- const specConfig = {
184
- agentType: type,
185
- companyName,
186
- companyDescription,
187
- role,
188
- };
189
- if (companyWebsite) {
190
- specConfig.companyWebsite = companyWebsite;
191
- }
192
- const promptTemplateName = flags['prompt-template'] ?? inputSpec?.promptTemplateName;
193
- if (promptTemplateName) {
194
- specConfig.promptTemplateName = promptTemplateName;
195
- const groundingContext = flags['grounding-context'] ?? inputSpec?.groundingContext;
196
- if (groundingContext) {
197
- specConfig.groundingContext = groundingContext;
198
- }
199
- }
200
- if (maxNumOfTopics) {
201
- specConfig.maxNumOfTopics = Number(maxNumOfTopics);
202
- }
203
- // Should we log the specConfig being used? It's returned in the JSON and the generated spec.
204
- // this.log(`${ansis.green(figures.tick)} ${ansis.bold(message)} ${ansis.cyan(valueFromFlag)}`);
205
- const specResponse = await agent.createSpecV2(specConfig);
206
- // @ts-expect-error Need better typing
207
- const specFileContents = buildSpecFile(specResponse, { agentUser, enrichLogs, tone });
208
- const outputFilePath = writeSpecFile(outputFile, specFileContents);
209
- this.spinner.stop();
210
- this.log(`\nSaved agent spec: ${outputFilePath}`);
211
- return { ...{ isSuccess: true, specPath: outputFilePath }, ...specResponse, ...specFileContents };
212
- }
213
- }
214
- // Builds spec file contents from the spec response and any additional flags
215
- // in a specific order.
216
- const buildSpecFile = (specResponse, extraProps) => {
217
- const propertyOrder = [
218
- 'agentType',
219
- 'companyName',
220
- 'companyDescription',
221
- 'companyWebsite',
222
- 'role',
223
- 'maxNumOfTopics',
224
- 'agentUser',
225
- 'enrichLogs',
226
- 'tone',
227
- // 'primaryLanguage',
228
- 'promptTemplateName',
229
- 'groundingContext',
230
- 'topics',
231
- ];
232
- const specFileContents = {};
233
- propertyOrder.map((prop) => {
234
- // @ts-expect-error need better typing of the array.
235
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
236
- const val = specResponse[prop] ?? extraProps[prop];
237
- if (val != null || (typeof val === 'string' && val.length > 0)) {
238
- // @ts-expect-error need better typing of the array.
239
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
240
- specFileContents[prop] = val;
241
- }
242
- });
243
- return specFileContents;
244
- };
245
- const writeSpecFile = (outputFile, agentSpec) => {
246
- // create the directory if not already created
247
- const outputFilePath = resolve(outputFile);
248
- mkdirSync(dirname(outputFilePath), { recursive: true });
249
- // Write a yaml file with the returned job specs
250
- writeFileSync(outputFilePath, YAML.stringify(agentSpec));
251
- return outputFilePath;
252
- };
253
- const resolveOutputFile = async (outputFile, noPrompt = false) => {
254
- let resolvedOutputFile = resolve(outputFile);
255
- if (!noPrompt) {
256
- if (existsSync(resolvedOutputFile)) {
257
- const message = messages.getMessage('confirmSpecOverwrite', [resolvedOutputFile]);
258
- if (!(await prompts.confirm({ message }))) {
259
- throw Error('NoOverwrite');
260
- }
261
- }
262
- }
263
- if (!resolvedOutputFile.endsWith('.yaml')) {
264
- resolvedOutputFile = `${resolvedOutputFile}.yaml`;
265
- }
266
- return resolvedOutputFile;
267
- };
268
- //# sourceMappingURL=spec-v2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-v2.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/spec-v2.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAA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AE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAExD,gDAAgD;IAChD,aAAa,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IAEzD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,KAAK,EAAE,UAAkB,EAAE,QAAQ,GAAG,KAAK,EAAmB,EAAE;IACxF,IAAI,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,IAAI,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,kBAAkB,CAAC,CAAC,CAAC;YAClF,IAAI,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC;gBAC1C,MAAM,KAAK,CAAC,aAAa,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;IACH,CAAC;IACD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,kBAAkB,GAAG,GAAG,kBAAkB,OAAO,CAAC;IACpD,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC"}
@@ -1,51 +0,0 @@
1
- # summary
2
-
3
- Create an agent in your org using a local agent spec file.
4
-
5
- # description
6
-
7
- Before you run this command, you must first generate an agent spec file by running the "agent generate spec" CLI command, which outputs a YAML file with the agent properties and list of AI-generated topics. Topics define the range of jobs the agent can handle. Then specify the generated agent spec file to this command using the --spec flag, along with the name (label) of the new agent using the --agent-name flag.
8
-
9
- When this command finishes, your org contains the new agent, which you can then edit in the Agent Builder UI. The new agent's topics are the same as the ones listed in the agent spec file. The agent might also have some AI-generated actions. This command also retrieves all the metadata files associated with the new agent to your local Salesforce DX project.
10
-
11
- Use the --preview flag to review what the agent looks like without actually saving it in your org. Rather, the command creates a JSON file with all the agent details in the current directory.
12
-
13
- To open the new agent in your org's Agent Builder UI, run this command: "sf org open agent --name <api-name-of-your-agent>".
14
-
15
- # flags.spec.summary
16
-
17
- Path to an agent spec file.
18
-
19
- # flags.preview.summary
20
-
21
- Preview the agent without saving it in your org.
22
-
23
- # flags.agent-name.summary
24
-
25
- Name (label) of the new agent.
26
-
27
- # flags.agent-api-name.summary
28
-
29
- API name of the new agent; if not specified, the API name is derived from the agent name (label); the API name must not exist in the org.
30
-
31
- # flags.planner-id.summary
32
-
33
- An existing GenAiPlanner ID to associate with the agent.
34
-
35
- # error.missingRequiredFlags
36
-
37
- Missing required flags: %s
38
-
39
- # error.missingRequiredSpecProperties
40
-
41
- Missing required spec file properties: %s
42
-
43
- # examples
44
-
45
- - Create an agent called "ResortManager" in an org with alias "my-org" using the specified agent spec file:
46
-
47
- <%= config.bin %> <%= command.id %> --agent-name ResortManager --spec specs/resortManagerAgent.yaml --target-org my-org
48
-
49
- - Preview the creation of an agent called "ResortManager" and use your default org:
50
-
51
- <%= config.bin %> <%= command.id %> --agent-name ResortManager --spec specs/resortManagerAgent.yaml --preview