@salesforce/plugin-agent 1.15.1-dev.2 → 1.15.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 CHANGED
@@ -132,7 +132,7 @@ EXAMPLES
132
132
  $ sf agent create --agent-name "Resort Manager" --spec specs/resortManagerAgent.yaml --preview
133
133
  ```
134
134
 
135
- _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/create.ts)_
135
+ _See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/create.ts)_
136
136
 
137
137
  ## `sf agent generate agent-spec`
138
138
 
@@ -236,7 +236,7 @@ EXAMPLES
236
236
  $ sf agent generate agent-spec --tone formal --agent-user resortmanager@myorg.com
237
237
  ```
238
238
 
239
- _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/generate/agent-spec.ts)_
239
+ _See code: [src/commands/agent/generate/agent-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/generate/agent-spec.ts)_
240
240
 
241
241
  ## `sf agent generate template`
242
242
 
@@ -270,7 +270,7 @@ EXAMPLES
270
270
  force-app/main/default/bots/My_Awesome_Agent/My_Awesome_Agent.bot-meta.xml --agent-version 1
271
271
  ```
272
272
 
273
- _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/generate/template.ts)_
273
+ _See code: [src/commands/agent/generate/template.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/generate/template.ts)_
274
274
 
275
275
  ## `sf agent generate test-spec`
276
276
 
@@ -278,12 +278,7 @@ Interactively generate a specification file for a AI evaluation test.
278
278
 
279
279
  ```
280
280
  USAGE
281
- $ sf agent generate test-spec [--flags-dir <value>] [-d <value>] [--force-overwrite] [-f <value>]
282
-
283
- FLAGS
284
- -d, --from-definition=<value> The API name of the AIEvaluationDefinition that you want to convert to a spec file.
285
- -f, --output-file=<value> The name of the generated spec file. Defaults to "specs/<AGENT_API_NAME>-testSpec.yaml"
286
- --force-overwrite Don't prompt for confirmation when overwriting an existing test spec file.
281
+ $ sf agent generate test-spec [--flags-dir <value>]
287
282
 
288
283
  GLOBAL FLAGS
289
284
  --flags-dir=<value> Import flag values from a directory.
@@ -298,7 +293,7 @@ EXAMPLES
298
293
  $ sf agent generate test-spec
299
294
  ```
300
295
 
301
- _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/generate/test-spec.ts)_
296
+ _See code: [src/commands/agent/generate/test-spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/generate/test-spec.ts)_
302
297
 
303
298
  ## `sf agent preview`
304
299
 
@@ -333,43 +328,43 @@ FLAG DESCRIPTIONS
333
328
  the API name of the agent? (TBD based on agents library)
334
329
  ```
335
330
 
336
- _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/preview.ts)_
331
+ _See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/preview.ts)_
337
332
 
338
333
  ## `sf agent test create`
339
334
 
340
- Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.
335
+ Summary of a command.
341
336
 
342
337
  ```
343
338
  USAGE
344
- $ sf agent test create -o <value> [--json] [--flags-dir <value>] [--test-api-name <value>] [--spec <value>]
345
- [--api-version <value>] [--preview] [--force-overwrite]
339
+ $ sf agent test create -s <value> -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [--preview] [-p]
346
340
 
347
341
  FLAGS
348
- -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
349
- configuration variable is already set.
350
- --api-version=<value> Override the api version used for api requests made by this command
351
- --force-overwrite Don't prompt for confirmation when overwriting an existing test.
352
- --preview Preview the test metadata without deploying to your org.
353
- --spec=<value> The path to the spec file.
354
- --test-api-name=<value> The API name of the AiEvaluationDefinition.
342
+ -o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
343
+ configuration variable is already set.
344
+ -p, --no-prompt Don't prompt for confirmation when overwriting an existing test.
345
+ -s, --spec=<value> (required) Description of a flag.
346
+ --api-version=<value> Override the api version used for api requests made by this command
347
+ --preview Preview the test metadata without deploying to your org.
355
348
 
356
349
  GLOBAL FLAGS
357
350
  --flags-dir=<value> Import flag values from a directory.
358
351
  --json Format output as json.
359
352
 
360
353
  DESCRIPTION
361
- Convert a test spec file into an AiEvaluationDefinition and deploy it to your org.
362
-
363
- This command will convert a test spec file into an AiEvaluationDefinition and deploy it to your org. The spec file
364
- must be in yaml format.
354
+ Summary of a command.
365
355
 
366
- Use the --preview flag to see the metadata that will be deployed without actually deploying it.
356
+ More information about a command. Don't repeat the summary.
367
357
 
368
358
  EXAMPLES
369
359
  $ sf agent test create
360
+
361
+ FLAG DESCRIPTIONS
362
+ -s, --spec=<value> Description of a flag.
363
+
364
+ More information about a flag. Don't repeat the summary.
370
365
  ```
371
366
 
372
- _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/test/create.ts)_
367
+ _See code: [src/commands/agent/test/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/test/create.ts)_
373
368
 
374
369
  ## `sf agent test list`
375
370
 
@@ -398,7 +393,7 @@ EXAMPLES
398
393
  $ sf agent test list
399
394
  ```
400
395
 
401
- _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/test/list.ts)_
396
+ _See code: [src/commands/agent/test/list.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/test/list.ts)_
402
397
 
403
398
  ## `sf agent test results`
404
399
 
@@ -454,7 +449,7 @@ FLAG DESCRIPTIONS
454
449
  test results aren't written.
455
450
  ```
456
451
 
457
- _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/test/results.ts)_
452
+ _See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/test/results.ts)_
458
453
 
459
454
  ## `sf agent test resume`
460
455
 
@@ -517,7 +512,7 @@ FLAG DESCRIPTIONS
517
512
  test results aren't written.
518
513
  ```
519
514
 
520
- _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/test/resume.ts)_
515
+ _See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/test/resume.ts)_
521
516
 
522
517
  ## `sf agent test run`
523
518
 
@@ -580,6 +575,6 @@ FLAG DESCRIPTIONS
580
575
  test results aren't written.
581
576
  ```
582
577
 
583
- _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1-dev.2/src/commands/agent/test/run.ts)_
578
+ _See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.15.1/src/commands/agent/test/run.ts)_
584
579
 
585
580
  <!-- commandsstop -->
@@ -13,7 +13,7 @@ import { MultiStageOutput } from '@oclif/multi-stage-output';
13
13
  import { input as inquirerInput } from '@inquirer/prompts';
14
14
  import { colorize } from '@oclif/core/ux';
15
15
  import { Agent, AgentCreateLifecycleStagesV2, generateAgentApiName, } from '@salesforce/agents';
16
- import { makeFlags, promptForFlag, getAgentUserId, validateAgentType, validateTone, promptForYamlFile, } from '../../flags.js';
16
+ import { makeFlags, promptForFlag, getAgentUserId, validateAgentType, validateTone, } from '../../flags.js';
17
17
  import { theme } from '../../inquirer-theme.js';
18
18
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
19
19
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.create');
@@ -90,7 +90,7 @@ export default class AgentCreate extends SfCommand {
90
90
  }
91
91
  }
92
92
  // If we don't have an agent spec yet, prompt.
93
- const specPath = flags.spec ?? (await promptForYamlFile(FLAGGABLE_PROMPTS['spec']));
93
+ const specPath = flags.spec ?? (await promptForFlag(FLAGGABLE_PROMPTS['spec']));
94
94
  // Read the agent spec and validate
95
95
  const inputSpec = YAML.parse(readFileSync(resolve(specPath), 'utf8'));
96
96
  validateSpec(inputSpec);
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/agent/create.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,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,KAAK,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EACL,KAAK,EAGL,4BAA4B,EAE5B,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,SAAS,EACT,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAGhD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE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  const builder = new XMLBuilder({ format: true, ignoreAttributes: false, indentBy: ' ' });
42
- const botName = basename(agentFile).replace('.bot-meta.xml', '');
42
+ const botName = basename(agentFile, '.bot-meta.xml');
43
43
  // Since we are cloning the GenAiPlanner, we need to use a different name than the Agent (Bot) we started with
44
44
  // We will use this name for the BotTemplate also to make it clear they are related
45
45
  const finalFilename = `${botName}_v${botVersion}_Template`;
@@ -90,8 +90,8 @@ const convertBotToBotTemplate = (bot, botVersionJson, newMlDomainName, botFilePa
90
90
  delete bot.Bot.botUser;
91
91
  delete bot.Bot.logPrivateConversationData;
92
92
  delete bot.Bot.sessionTimeout;
93
- // botDialogGroups is not required
94
93
  const botTemplate = {
94
+ '?xml': { '@_version': '1.0', '@_encoding': 'UTF-8' },
95
95
  BotTemplate: {
96
96
  masterLabel,
97
97
  conversationLanguages: 'en_US',
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAgCxD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,yBAAyB,CAAC,CAAC;AAM9F,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAAsC;IAChF,MAAM,CAAU,OAAO,GAAG,QA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O,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC"}
@@ -5,10 +5,5 @@ export default class AgentGenerateTestSpec extends SfCommand<void> {
5
5
  static readonly examples: string[];
6
6
  static readonly enableJsonFlag = false;
7
7
  static readonly state = "beta";
8
- static readonly flags: {
9
- 'from-definition': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
- 'force-overwrite': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
- 'output-file': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
- };
13
8
  run(): Promise<void>;
14
9
  }
@@ -1,72 +1,45 @@
1
1
  /*
2
- * Copyright (c) 2025, salesforce.com, inc.
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
3
  * All rights reserved.
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import { readFile } from 'node:fs/promises';
8
7
  import { join } from 'node:path';
9
- import { existsSync } from 'node:fs';
10
- import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
11
- import { Messages, SfError, SfProject } from '@salesforce/core';
12
- import { writeTestSpec, generateTestSpecFromAiEvalDefinition } from '@salesforce/agents';
8
+ import { readFile } from 'node:fs/promises';
9
+ import { SfCommand } from '@salesforce/sf-plugins-core';
10
+ import { Messages, SfError } from '@salesforce/core';
11
+ import { generateTestSpec } from '@salesforce/agents';
13
12
  import { select, input, confirm, checkbox } from '@inquirer/prompts';
14
13
  import { XMLParser } from 'fast-xml-parser';
15
- import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
16
14
  import { theme } from '../../../inquirer-theme.js';
17
- import yesNoOrCancel from '../../../yes-no-cancel.js';
15
+ import { readDir } from '../../../read-dir.js';
18
16
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
19
17
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.generate.test-spec');
20
18
  function castArray(value) {
21
19
  return Array.isArray(value) ? value : [value];
22
20
  }
23
- /**
24
- * Prompts the user for test case information through interactive prompts.
25
- *
26
- * @param genAiPlugins - Record mapping topic names to GenAiPlugin XML file paths (used to find the related actions)
27
- * @param genAiFunctions - Array of GenAiFunction names from the GenAiPlanner
28
- * @returns Promise resolving to a TestCase object containing:
29
- * - utterance: The user input string
30
- * - expectedTopic: The expected topic for classification
31
- * - expectedActions: Array of expected action names
32
- * - expectedOutcome: Expected outcome string
33
- *
34
- * @remarks
35
- * This function guides users through creating a test case by:
36
- * 1. Prompting for an utterance
37
- * 2. Selecting an expected topic (from GenAiPlugins specified in the Bot's GenAiPlanner)
38
- * 3. Choosing expected actions (from GenAiFunctions in the GenAiPlanner or GenAiPlugin)
39
- * 4. Defining an expected outcome
40
- */
41
- async function promptForTestCase(genAiPlugins, genAiFunctions) {
21
+ async function promptForTestCase(genAiPlugins) {
42
22
  const utterance = await input({
43
23
  message: 'Utterance',
44
24
  validate: (d) => d.length > 0 || 'utterance cannot be empty',
45
25
  theme,
46
26
  });
47
- const expectedTopic = await select({
48
- message: 'Expected topic',
49
- choices: Object.keys(genAiPlugins),
50
- theme,
51
- });
52
- // GenAiFunctions (aka actions) can be defined in the GenAiPlugin or GenAiPlanner
53
- // the actions from the planner are passed in as an argument to this function
54
- // the actions from the plugin are read from the GenAiPlugin file
55
- let actions = [];
56
- if (genAiPlugins[expectedTopic]) {
57
- const genAiPluginXml = await readFile(genAiPlugins[expectedTopic], 'utf-8');
58
- const parser = new XMLParser();
59
- const parsed = parser.parse(genAiPluginXml);
60
- actions = castArray(parsed.GenAiPlugin.genAiFunctions ?? []).map((f) => f.functionName);
61
- }
62
- const expectedActions = await checkbox({
27
+ const customKey = '<OTHER>';
28
+ const topics = Object.keys(genAiPlugins);
29
+ const askForOtherActions = async () => (await input({
63
30
  message: 'Expected action(s)',
64
- choices: [...actions, ...genAiFunctions],
31
+ validate: (d) => {
32
+ if (!d.length) {
33
+ return 'expected value cannot be empty';
34
+ }
35
+ return true;
36
+ },
65
37
  theme,
66
- required: true,
67
- });
68
- const expectedOutcome = await input({
69
- message: 'Expected outcome',
38
+ }))
39
+ .split(',')
40
+ .map((a) => a.trim());
41
+ const askForBotRating = async () => input({
42
+ message: 'Expected response',
70
43
  validate: (d) => {
71
44
  if (!d.length) {
72
45
  return 'expected value cannot be empty';
@@ -75,152 +48,62 @@ async function promptForTestCase(genAiPlugins, genAiFunctions) {
75
48
  },
76
49
  theme,
77
50
  });
51
+ const expectedTopic = await select({
52
+ message: 'Expected topic',
53
+ choices: [...topics, customKey],
54
+ theme,
55
+ });
56
+ if (expectedTopic === customKey) {
57
+ return {
58
+ utterance,
59
+ expectedTopic: await input({
60
+ message: 'Expected topic',
61
+ validate: (d) => {
62
+ if (!d.length) {
63
+ return 'expected value cannot be empty';
64
+ }
65
+ return true;
66
+ },
67
+ theme,
68
+ }),
69
+ // If the user selects OTHER for the topic, then we don't have a genAiPlugin to get actions from so we ask for them for custom input
70
+ expectedActions: await askForOtherActions(),
71
+ expectedOutcome: await askForBotRating(),
72
+ };
73
+ }
74
+ const genAiPluginXml = await readFile(genAiPlugins[expectedTopic], 'utf-8');
75
+ const parser = new XMLParser();
76
+ const parsed = parser.parse(genAiPluginXml);
77
+ const actions = castArray(parsed.GenAiPlugin.genAiFunctions).map((f) => f.functionName);
78
+ let expectedActions = await checkbox({
79
+ message: 'Expected action(s)',
80
+ choices: [...actions, customKey],
81
+ theme,
82
+ required: true,
83
+ });
84
+ if (expectedActions.includes(customKey)) {
85
+ const additional = await askForOtherActions();
86
+ expectedActions = [...expectedActions.filter((a) => a !== customKey), ...additional];
87
+ }
88
+ const expectedOutcome = await askForBotRating();
78
89
  return {
79
90
  utterance,
80
- expectedTopic,
81
91
  expectedActions,
82
92
  expectedOutcome,
93
+ expectedTopic,
83
94
  };
84
95
  }
85
- function getMetadataFilePaths(cs, type) {
86
- return [...cs.filter((component) => component.type.name === type && component.fullName !== '*')].reduce((acc, component) => ({
87
- ...acc,
88
- [component.fullName]: cs.getComponentFilenamesByNameAndType({
89
- fullName: component.fullName,
90
- type,
91
- })[0],
92
- }), {});
93
- }
94
- /**
95
- * Retrieves GenAIPlugins and GenAiFunctions from a Bot's GenAiPlanner
96
- *
97
- * We have to get the bot version and planner for the selected bot so that we can get
98
- * the actions (GenAiFunctions) and topics (GenAiPlugins) that can be selected for the
99
- * test cases.
100
- *
101
- * The BotVersion tells us which GenAiPlanner to use, and the GenAiPlanner
102
- * tells us which GenAiPlugins and GenAiFunctions are available. More GenAiFunctions
103
- * might be available in the GenAiPlugin, so we read those later when the user
104
- * has selected a GenAiPlugin/topic - inside of `promptForTestCase`.
105
- *
106
- * @param subjectName - The name of the Bot to analyze
107
- * @param cs - ComponentSet containing Bot, GenAiPlanner, and GenAiPlugin components
108
- *
109
- * @returns Object containing:
110
- * - genAiPlugins: Record of plugin names to their file paths
111
- * - genAiFunctions: Array of function names
112
- */
113
- async function getPluginsAndFunctions(subjectName, cs) {
114
- const botVersions = getMetadataFilePaths(cs, 'Bot');
115
- const genAiPlanners = getMetadataFilePaths(cs, 'GenAiPlanner');
116
- const parser = new XMLParser();
117
- const botVersionXml = await readFile(botVersions[subjectName], 'utf-8');
118
- const parsedBotVersion = parser.parse(botVersionXml);
119
- const plannerXml = await readFile(genAiPlanners[parsedBotVersion.BotVersion.conversationDefinitionPlanners.genAiPlannerName ?? subjectName], 'utf-8');
120
- const parsedPlanner = parser.parse(plannerXml);
121
- const genAiFunctions = castArray(parsedPlanner.GenAiPlanner.genAiFunctions).map(({ genAiFunctionName }) => genAiFunctionName);
122
- const genAiPlugins = castArray(parsedPlanner.GenAiPlanner.genAiPlugins).reduce((acc, { genAiPluginName }) => ({
123
- ...acc,
124
- [genAiPluginName]: cs.getComponentFilenamesByNameAndType({
125
- fullName: genAiPluginName,
126
- type: 'GenAiPlugin',
127
- })[0],
128
- }), {});
129
- return { genAiPlugins, genAiFunctions };
130
- }
131
- function ensureYamlExtension(filePath) {
132
- if (!filePath)
133
- return undefined;
134
- if (filePath.endsWith('.yaml') || filePath.endsWith('.yml'))
135
- return filePath;
136
- return `${filePath}.yaml`;
137
- }
138
- async function promptUntilUniqueFile(subjectName, filePath) {
139
- const outputFile = filePath ??
140
- (await input({
141
- message: 'Enter a path for the test spec file',
142
- validate(d) {
143
- if (!d.length) {
144
- return 'Path cannot be empty';
145
- }
146
- return true;
147
- },
148
- theme,
149
- }));
150
- if (!existsSync(outputFile)) {
151
- return outputFile;
152
- }
153
- const confirmation = await yesNoOrCancel({
154
- message: `File ${outputFile} already exists. Overwrite?`,
155
- default: false,
156
- });
157
- if (confirmation === 'cancel') {
158
- return;
159
- }
160
- if (!confirmation) {
161
- return promptUntilUniqueFile(subjectName);
162
- }
163
- return outputFile;
164
- }
165
- /**
166
- * If the user provides the --force-overwrite flag, then we'll use the default file path (either the one provided by --output-file or the default path).
167
- * If the user doesn't provide it, we'll prompt the user for a file path until they provide a unique one or cancel.
168
- */
169
- async function determineFilePath(subjectName, outputFile, forceOverwrite) {
170
- const defaultFile = ensureYamlExtension(outputFile ?? join('specs', `${subjectName}-testSpec.yaml`));
171
- return ensureYamlExtension(forceOverwrite ? defaultFile : await promptUntilUniqueFile(subjectName, defaultFile));
172
- }
173
96
  export default class AgentGenerateTestSpec extends SfCommand {
174
97
  static summary = messages.getMessage('summary');
175
98
  static description = messages.getMessage('description');
176
99
  static examples = messages.getMessages('examples');
177
100
  static enableJsonFlag = false;
178
101
  static state = 'beta';
179
- static flags = {
180
- 'from-definition': Flags.string({
181
- char: 'd',
182
- summary: messages.getMessage('flags.from-definition.summary'),
183
- }),
184
- 'force-overwrite': Flags.boolean({
185
- summary: messages.getMessage('flags.force-overwrite.summary'),
186
- }),
187
- 'output-file': Flags.string({
188
- char: 'f',
189
- summary: messages.getMessage('flags.output-file.summary'),
190
- }),
191
- };
192
102
  async run() {
193
- const { flags } = await this.parse(AgentGenerateTestSpec);
194
- const directoryPaths = (await SfProject.resolve().then((project) => project.getPackageDirectories())).map((dir) => dir.fullPath);
195
- const cs = await ComponentSetBuilder.build({
196
- metadata: {
197
- metadataEntries: ['GenAiPlanner', 'GenAiPlugin', 'Bot', 'AiEvaluationDefinition'],
198
- directoryPaths,
199
- },
200
- });
201
- if (flags['from-definition']) {
202
- const aiEvalDefs = getMetadataFilePaths(cs, 'AiEvaluationDefinition');
203
- if (!aiEvalDefs[flags['from-definition']]) {
204
- throw new SfError(`AiEvaluationDefinition ${flags['from-definition']} not found`, 'AiEvalDefinitionNotFoundError');
205
- }
206
- const spec = await generateTestSpecFromAiEvalDefinition(aiEvalDefs[flags['from-definition']]);
207
- const outputFile = await determineFilePath(spec.subjectName, flags['output-file'], flags['force-overwrite']);
208
- if (!outputFile) {
209
- this.log(messages.getMessage('info.cancel'));
210
- return;
211
- }
212
- await writeTestSpec(spec, outputFile);
213
- this.log(`Created ${outputFile}`);
214
- return;
215
- }
216
- const bots = [
217
- ...cs
218
- .filter((component) => component.type.name === 'Bot')
219
- .map((c) => c.fullName)
220
- .filter((n) => n !== '*'),
221
- ];
103
+ const botsDir = join('force-app', 'main', 'default', 'bots');
104
+ const bots = await readDir(botsDir);
222
105
  if (bots.length === 0) {
223
- throw new SfError(`No agents found in ${directoryPaths.join(', ')}`, 'NoAgentsFoundError');
106
+ throw new SfError(`No agents found in ${botsDir}`, 'NoAgentsFoundError');
224
107
  }
225
108
  const subjectType = await select({
226
109
  message: 'What are you testing',
@@ -232,12 +115,6 @@ export default class AgentGenerateTestSpec extends SfCommand {
232
115
  choices: bots,
233
116
  theme,
234
117
  });
235
- const outputFile = await determineFilePath(subjectName, flags['output-file'], flags['force-overwrite']);
236
- if (!outputFile) {
237
- this.log(messages.getMessage('info.cancel'));
238
- return;
239
- }
240
- const { genAiPlugins, genAiFunctions } = await getPluginsAndFunctions(subjectName, cs);
241
118
  const name = await input({
242
119
  message: 'Enter a name for the test definition',
243
120
  validate(d) {
@@ -246,6 +123,12 @@ export default class AgentGenerateTestSpec extends SfCommand {
246
123
  return 'Name cannot be empty';
247
124
  }
248
125
  return true;
126
+ // TODO: add back validation once we refine the regex
127
+ // check against FORTY_CHAR_API_NAME_REGEX
128
+ // if (!FORTY_CHAR_API_NAME_REGEX.test(d)) {
129
+ // return 'The non-namespaced portion an API name must begin with a letter, contain only letters, numbers, and underscores, not contain consecutive underscores, and not end with an underscore.';
130
+ // }
131
+ // return true;
249
132
  },
250
133
  theme,
251
134
  });
@@ -253,26 +136,31 @@ export default class AgentGenerateTestSpec extends SfCommand {
253
136
  message: 'Enter a description for test definition (optional)',
254
137
  theme,
255
138
  });
139
+ const genAiPluginDir = join('force-app', 'main', 'default', 'genAiPlugins');
140
+ const genAiPlugins = Object.fromEntries((await readDir(genAiPluginDir)).map((genAiPlugin) => [
141
+ genAiPlugin.replace('.genAiPlugin-meta.xml', ''),
142
+ join(genAiPluginDir, genAiPlugin),
143
+ ]));
256
144
  const testCases = [];
257
145
  do {
258
146
  this.log();
259
147
  this.styledHeader(`Adding test case #${testCases.length + 1}`);
260
148
  // eslint-disable-next-line no-await-in-loop
261
- testCases.push(await promptForTestCase(genAiPlugins, genAiFunctions));
149
+ testCases.push(await promptForTestCase(genAiPlugins));
262
150
  } while ( // eslint-disable-next-line no-await-in-loop
263
151
  await confirm({
264
152
  message: 'Would you like to add another test case',
265
153
  default: true,
266
154
  }));
267
155
  this.log();
268
- await writeTestSpec({
156
+ await generateTestSpec({
269
157
  name,
270
158
  description,
271
159
  subjectType,
272
160
  subjectName,
273
161
  testCases,
274
- }, outputFile);
275
- this.log(`Created ${outputFile}`);
162
+ }, `${name}-test-spec.yaml`);
163
+ this.log(`Created ${name}-test-spec.yaml`);
276
164
  }
277
165
  }
278
166
  //# sourceMappingURL=test-spec.js.map