@salesforce/plugin-agent 1.3.4 → 1.5.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.
Files changed (48) hide show
  1. package/README.md +155 -20
  2. package/lib/agentTestCache.d.ts +17 -0
  3. package/lib/agentTestCache.js +53 -0
  4. package/lib/agentTestCache.js.map +1 -0
  5. package/lib/commands/agent/preview.d.ts +15 -0
  6. package/lib/commands/agent/preview.js +37 -0
  7. package/lib/commands/agent/preview.js.map +1 -0
  8. package/lib/commands/agent/test/cancel.d.ts +4 -3
  9. package/lib/commands/agent/test/cancel.js +15 -11
  10. package/lib/commands/agent/test/cancel.js.map +1 -1
  11. package/lib/commands/agent/test/results.d.ts +17 -0
  12. package/lib/commands/agent/test/results.js +44 -0
  13. package/lib/commands/agent/test/results.js.map +1 -0
  14. package/lib/commands/agent/test/resume.d.ts +21 -0
  15. package/lib/commands/agent/test/resume.js +72 -0
  16. package/lib/commands/agent/test/resume.js.map +1 -0
  17. package/lib/commands/agent/test/run.d.ts +6 -6
  18. package/lib/commands/agent/test/run.js +44 -23
  19. package/lib/commands/agent/test/run.js.map +1 -1
  20. package/lib/components/agent-preview-react.d.ts +9 -0
  21. package/lib/components/agent-preview-react.js +56 -0
  22. package/lib/components/agent-preview-react.js.map +1 -0
  23. package/lib/flags.d.ts +8 -0
  24. package/lib/flags.js +26 -0
  25. package/lib/flags.js.map +1 -0
  26. package/lib/handleTestResults.d.ts +8 -0
  27. package/lib/handleTestResults.js +44 -0
  28. package/lib/handleTestResults.js.map +1 -0
  29. package/lib/testStages.d.ts +27 -0
  30. package/lib/testStages.js +96 -0
  31. package/lib/testStages.js.map +1 -0
  32. package/messages/agent.preview.md +20 -0
  33. package/messages/agent.test.cancel.md +2 -2
  34. package/messages/agent.test.results.md +19 -0
  35. package/messages/agent.test.resume.md +29 -0
  36. package/messages/agent.test.run.md +5 -9
  37. package/messages/shared.md +11 -0
  38. package/npm-shrinkwrap.json +12262 -5563
  39. package/oclif.lock +835 -43
  40. package/oclif.manifest.json +322 -11
  41. package/package.json +26 -8
  42. package/schemas/agent-create.json +2 -4
  43. package/schemas/agent-generate-spec.json +2 -4
  44. package/schemas/agent-preview.json +9 -0
  45. package/schemas/agent-test-cancel.json +3 -6
  46. package/schemas/agent-test-results.json +145 -0
  47. package/schemas/agent-test-resume.json +19 -0
  48. package/schemas/agent-test-run.json +4 -13
@@ -1,19 +1,19 @@
1
1
  import { SfCommand } from '@salesforce/sf-plugins-core';
2
2
  export type AgentTestRunResult = {
3
- jobId: string;
4
- success: boolean;
5
- errorCode?: string;
6
- message?: string;
3
+ aiEvaluationId: string;
4
+ status: string;
7
5
  };
8
6
  export default class AgentTestRun extends SfCommand<AgentTestRunResult> {
9
7
  static readonly summary: string;
10
8
  static readonly description: string;
11
9
  static readonly examples: string[];
12
- static state: string;
10
+ static readonly state = "beta";
13
11
  static readonly flags: {
14
12
  'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
15
- id: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ 'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
16
15
  wait: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/kit").Duration, import("@oclif/core/interfaces").CustomOptions>;
16
+ 'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "human" | "junit", import("@oclif/core/interfaces").CustomOptions>;
17
17
  'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
18
  };
19
19
  run(): Promise<AgentTestRunResult>;
@@ -6,6 +6,12 @@
6
6
  */
7
7
  import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
8
8
  import { Messages } from '@salesforce/core';
9
+ import { AgentTester } from '@salesforce/agents';
10
+ import { colorize } from '@oclif/core/ux';
11
+ import { resultFormatFlag, testOutputDirFlag } from '../../../flags.js';
12
+ import { AgentTestCache } from '../../../agentTestCache.js';
13
+ import { TestStages } from '../../../testStages.js';
14
+ import { handleTestResults } from '../../../handleTestResults.js';
9
15
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
16
  const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.run');
11
17
  export default class AgentTestRun extends SfCommand {
@@ -15,13 +21,15 @@ export default class AgentTestRun extends SfCommand {
15
21
  static state = 'beta';
16
22
  static flags = {
17
23
  'target-org': Flags.requiredOrg(),
18
- // AiEvalDefinitionVersion.Id -- This should really be "test-name"
19
- id: Flags.string({
20
- char: 'i',
24
+ 'api-version': Flags.orgApiVersion(),
25
+ name: Flags.string({
26
+ char: 'n',
21
27
  required: true,
22
- summary: messages.getMessage('flags.id.summary'),
23
- description: messages.getMessage('flags.id.description'),
28
+ summary: messages.getMessage('flags.name.summary'),
29
+ description: messages.getMessage('flags.name.description'),
24
30
  }),
31
+ // we want to pass `undefined` to the API
32
+ // eslint-disable-next-line sf-plugin/flag-min-max-default
25
33
  wait: Flags.duration({
26
34
  char: 'w',
27
35
  unit: 'minutes',
@@ -29,27 +37,40 @@ export default class AgentTestRun extends SfCommand {
29
37
  summary: messages.getMessage('flags.wait.summary'),
30
38
  description: messages.getMessage('flags.wait.description'),
31
39
  }),
32
- 'output-dir': Flags.directory({
33
- char: 'd',
34
- summary: messages.getMessage('flags.output-dir.summary'),
35
- }),
36
- //
37
- // Future flags:
38
- // result-format [csv, json, table, junit, TAP]
39
- // suites [array of suite names]
40
- // verbose [boolean]
41
- // ??? api-version or build-version ???
40
+ 'result-format': resultFormatFlag(),
41
+ 'output-dir': testOutputDirFlag(),
42
42
  };
43
43
  async run() {
44
44
  const { flags } = await this.parse(AgentTestRun);
45
- this.log(`Starting tests for AiEvalDefinitionVersion: ${flags.id}`);
46
- // Call SF Eval Connect API passing AiEvalDefinitionVersion.Id
47
- // POST to /einstein/ai-evaluations/{aiEvalDefinitionVersionId}/start
48
- // Returns: AiEvaluation.Id
49
- return {
50
- success: true,
51
- jobId: '4KBSM000000003F4AQ', // AiEvaluation.Id; needed for getting status and stopping
52
- };
45
+ const mso = new TestStages({ title: `Agent Test Run: ${flags.name}`, jsonEnabled: this.jsonEnabled() });
46
+ mso.start();
47
+ const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
48
+ const response = await agentTester.start(flags.name);
49
+ mso.update({ id: response.aiEvaluationId });
50
+ const agentTestCache = await AgentTestCache.create();
51
+ await agentTestCache.createCacheEntry(response.aiEvaluationId, flags.name);
52
+ if (flags.wait?.minutes) {
53
+ const { completed, response: detailsResponse } = await mso.poll(agentTester, response.aiEvaluationId, flags.wait);
54
+ if (completed)
55
+ await agentTestCache.removeCacheEntry(response.aiEvaluationId);
56
+ mso.stop();
57
+ await handleTestResults({
58
+ id: response.aiEvaluationId,
59
+ format: flags['result-format'],
60
+ results: detailsResponse,
61
+ jsonEnabled: this.jsonEnabled(),
62
+ outputDir: flags['output-dir'],
63
+ });
64
+ return {
65
+ status: 'COMPLETED',
66
+ aiEvaluationId: response.aiEvaluationId,
67
+ };
68
+ }
69
+ else {
70
+ mso.stop();
71
+ this.log(`Run ${colorize('dim', `sf agent test resume --job-id ${response.aiEvaluationId}`)} to resuming watching this test.`);
72
+ }
73
+ return response;
53
74
  }
54
75
  }
55
76
  //# sourceMappingURL=run.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/run.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ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at
6
+ * - Add keystroke to scroll up
7
+ * - Add keystroke to scroll down
8
+ */
9
+ export declare function AgentPreviewReact(): React.ReactNode;
@@ -0,0 +1,56 @@
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 React from 'react';
8
+ import { Box, Text } from 'ink';
9
+ import figures from '@inquirer/figures';
10
+ import TextInput from 'ink-text-input';
11
+ import { sleep } from '@salesforce/kit';
12
+ /**
13
+ * Ideas:
14
+ * - Limit height based on terminal height
15
+ * - Add keystroke to clear chat
16
+ * - Add keystroke to scroll up
17
+ * - Add keystroke to scroll down
18
+ */
19
+ export function AgentPreviewReact() {
20
+ const [comments, setComments] = React.useState([]);
21
+ const [query, setQuery] = React.useState('');
22
+ return (React.createElement(Box, { flexDirection: "column" },
23
+ comments.length > 0 && (React.createElement(Box, { flexDirection: "column" },
24
+ comments.map(({ timestamp, role, content }, idx) => (React.createElement(Box, { key: role + '__' + timestamp.toISOString() + '__' + idx.toString(), alignItems: role === 'user' ? 'flex-end' : 'flex-start', flexDirection: "column" },
25
+ React.createElement(Box, { flexDirection: "row", columnGap: 1 },
26
+ React.createElement(Text, null, role === 'user' ? 'You' : role),
27
+ React.createElement(Text, { color: "gray" }, timestamp.toLocaleString())),
28
+ React.createElement(Box, { width: Math.min(process.stdout.columns - 4, content.length + 4), borderStyle: "round", paddingLeft: 1, paddingRight: 1 },
29
+ React.createElement(Text, null, content))))),
30
+ React.createElement(Box, { paddingLeft: 1, paddingRight: 1 },
31
+ React.createElement(Text, { dimColor: true }, '─'.repeat(process.stdout.columns - 2))))),
32
+ React.createElement(Box, null,
33
+ React.createElement(Text, null,
34
+ figures.pointer,
35
+ " "),
36
+ React.createElement(TextInput, { showCursor: true, value: query, placeholder: "Start typing\u2026", onChange: setQuery,
37
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
38
+ onSubmit: async (content) => {
39
+ if (!content)
40
+ return;
41
+ setQuery('');
42
+ setComments((prev) => [...prev, { role: 'user', content, timestamp: new Date() }]);
43
+ await sleep(1000);
44
+ setComments((prev) => {
45
+ const lastComment = prev[prev.length - 1];
46
+ // TODO - use agents library for generations
47
+ return (Math.random() * 2) % 2 > 1
48
+ ? [
49
+ ...prev,
50
+ { role: 'system', content: "I'm sorry, I can't help with this request", timestamp: new Date() },
51
+ ]
52
+ : [...prev, { ...lastComment, role: 'system', content: 'We have a scuba class at 9:30 AM' }];
53
+ });
54
+ } }))));
55
+ }
56
+ //# sourceMappingURL=agent-preview-react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-preview-react.js","sourceRoot":"","sources":["../../src/components/agent-preview-react.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAC5C,EAAE,CACH,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;QACxB,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,CACtB,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ;YACxB,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC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,CAAC,OAAO;wBAAE,OAAO;oBACrB,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAEb,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;oBACnF,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;oBAElB,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;wBACnB,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;wBAC1C,4CAA4C;wBAC5C,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;4BAChC,CAAC,CAAC;gCACE,GAAG,IAAI;gCACP,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,2CAA2C,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE;6BAChG;4BACH,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,kCAAkC,EAAE,CAAC,CAAC;oBACjG,CAAC,CAAC,CAAC;gBACL,CAAC,GACD,CACE,CACF,CACP,CAAC;AACJ,CAAC"}
package/lib/flags.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export declare const resultFormatFlag: import("@oclif/core/interfaces").FlagDefinition<"json" | "human" | "junit", import("@oclif/core/interfaces").CustomOptions, {
2
+ multiple: false;
3
+ requiredOrDefaulted: true;
4
+ }>;
5
+ export declare const testOutputDirFlag: import("@oclif/core/interfaces").FlagDefinition<string, import("@oclif/core/interfaces").CustomOptions, {
6
+ multiple: false;
7
+ requiredOrDefaulted: false;
8
+ }>;
package/lib/flags.js ADDED
@@ -0,0 +1,26 @@
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 { Flags } from '@salesforce/sf-plugins-core';
8
+ import { Messages } from '@salesforce/core';
9
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
10
+ const messages = Messages.loadMessages('@salesforce/plugin-agent', 'shared');
11
+ export const resultFormatFlag = Flags.option({
12
+ options: [
13
+ 'json',
14
+ 'human',
15
+ 'junit',
16
+ // 'tap',
17
+ ],
18
+ default: 'human',
19
+ summary: messages.getMessage('flags.result-format.summary'),
20
+ });
21
+ export const testOutputDirFlag = Flags.custom({
22
+ char: 'f',
23
+ description: messages.getMessage('flags.output-dir.description'),
24
+ summary: messages.getMessage('flags.output-dir.summary'),
25
+ });
26
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.js","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE;QACP,MAAM;QACN,OAAO;QACP,OAAO;QACP,SAAS;KACD;IACV,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,6BAA6B,CAAC;CAC5D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAS;IACpD,IAAI,EAAE,GAAG;IACT,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,8BAA8B,CAAC;IAChE,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,0BAA0B,CAAC;CACzD,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AgentTestDetailsResponse } from '@salesforce/agents';
2
+ export declare function handleTestResults({ id, format, results, jsonEnabled, outputDir, }: {
3
+ id: string;
4
+ format: 'human' | 'json' | 'junit';
5
+ results: AgentTestDetailsResponse | undefined;
6
+ jsonEnabled: boolean;
7
+ outputDir?: string;
8
+ }): Promise<void>;
@@ -0,0 +1,44 @@
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 } from 'node:path';
8
+ import { writeFile, mkdir } from 'node:fs/promises';
9
+ import { jsonFormat, humanFormat, junitFormat } from '@salesforce/agents';
10
+ import { Ux } from '@salesforce/sf-plugins-core/Ux';
11
+ async function writeFileToDir(outputDir, fileName, content) {
12
+ // if directory doesn't exist, create it
13
+ await mkdir(outputDir, { recursive: true });
14
+ await writeFile(join(outputDir, fileName), content);
15
+ }
16
+ export async function handleTestResults({ id, format, results, jsonEnabled, outputDir, }) {
17
+ if (!results) {
18
+ // do nothing since there are no results to handle
19
+ return;
20
+ }
21
+ const ux = new Ux({ jsonEnabled });
22
+ if (format === 'human') {
23
+ const formatted = await humanFormat(results);
24
+ ux.log(formatted);
25
+ if (outputDir) {
26
+ await writeFileToDir(outputDir, `test-result-${id}.txt`, formatted);
27
+ }
28
+ }
29
+ if (format === 'json') {
30
+ const formatted = await jsonFormat(results);
31
+ ux.log(formatted);
32
+ if (outputDir) {
33
+ await writeFileToDir(outputDir, `test-result-${id}.json`, formatted);
34
+ }
35
+ }
36
+ if (format === 'junit') {
37
+ const formatted = await junitFormat(results);
38
+ ux.log(formatted);
39
+ if (outputDir) {
40
+ await writeFileToDir(outputDir, `test-result-${id}.xml`, formatted);
41
+ }
42
+ }
43
+ }
44
+ //# sourceMappingURL=handleTestResults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleTestResults.js","sourceRoot":"","sources":["../src/handleTestResults.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAA4B,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACpG,OAAO,EAAE,EAAE,EAAE,MAAM,gCAAgC,CAAC;AAEpD,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,QAAgB,EAAE,OAAe;IAChF,wCAAwC;IACxC,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE5C,MAAM,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,EACtC,EAAE,EACF,MAAM,EACN,OAAO,EACP,WAAW,EACX,SAAS,GAOV;IACC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,kDAAkD;QAClD,OAAO;IACT,CAAC;IAED,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAEnC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC7C,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;QAC5C,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAED,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;QACvB,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,CAAC;QAC7C,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAClB,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,cAAc,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { AgentTestDetailsResponse, AgentTester } from '@salesforce/agents';
2
+ import { Duration } from '@salesforce/kit';
3
+ type Data = {
4
+ id: string;
5
+ status: string;
6
+ totalTestCases: number;
7
+ passingTestCases: number;
8
+ failingTestCases: number;
9
+ };
10
+ export declare class TestStages {
11
+ private mso;
12
+ private ux;
13
+ constructor({ title, jsonEnabled }: {
14
+ title: string;
15
+ jsonEnabled: boolean;
16
+ });
17
+ start(data?: Partial<Data>): void;
18
+ poll(agentTester: AgentTester, id: string, wait: Duration): Promise<{
19
+ completed: boolean;
20
+ response?: AgentTestDetailsResponse;
21
+ }>;
22
+ update(data: Partial<Data>): void;
23
+ stop(finalStatus?: 'async'): void;
24
+ error(): void;
25
+ done(data?: Partial<Data>): void;
26
+ }
27
+ export {};
@@ -0,0 +1,96 @@
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 { colorize } from '@oclif/core/ux';
8
+ import { MultiStageOutput } from '@oclif/multi-stage-output';
9
+ import { Lifecycle } from '@salesforce/core';
10
+ import { Ux } from '@salesforce/sf-plugins-core';
11
+ const isTimeoutError = (e) => e?.name === 'PollingClientTimeout';
12
+ export class TestStages {
13
+ mso;
14
+ ux;
15
+ constructor({ title, jsonEnabled }) {
16
+ this.ux = new Ux({ jsonEnabled });
17
+ this.mso = new MultiStageOutput({
18
+ title,
19
+ jsonEnabled,
20
+ stages: ['Starting Tests', 'Polling for Test Results'],
21
+ stageSpecificBlock: [
22
+ {
23
+ stage: 'Polling for Test Results',
24
+ type: 'dynamic-key-value',
25
+ label: 'Status',
26
+ get: (data) => data?.status,
27
+ },
28
+ {
29
+ stage: 'Polling for Test Results',
30
+ type: 'dynamic-key-value',
31
+ label: 'Completed Tests',
32
+ get: (data) => data?.totalTestCases && data?.passingTestCases && data?.failingTestCases
33
+ ? `${data?.passingTestCases + data?.failingTestCases}/${data?.totalTestCases}`
34
+ : undefined,
35
+ },
36
+ {
37
+ stage: 'Polling for Test Results',
38
+ type: 'dynamic-key-value',
39
+ label: 'Passing Tests',
40
+ get: (data) => data?.passingTestCases?.toString(),
41
+ },
42
+ {
43
+ stage: 'Polling for Test Results',
44
+ type: 'dynamic-key-value',
45
+ label: 'Failing Tests',
46
+ get: (data) => data?.failingTestCases?.toString(),
47
+ },
48
+ ],
49
+ postStagesBlock: [
50
+ {
51
+ type: 'dynamic-key-value',
52
+ label: 'Job ID',
53
+ get: (data) => data?.id,
54
+ },
55
+ ],
56
+ });
57
+ }
58
+ start(data) {
59
+ this.mso.skipTo('Starting Tests', data);
60
+ }
61
+ async poll(agentTester, id, wait) {
62
+ this.mso.skipTo('Polling for Test Results');
63
+ const lifecycle = Lifecycle.getInstance();
64
+ lifecycle.on('AGENT_TEST_POLLING_EVENT', async (event) => Promise.resolve(this.update(event)));
65
+ try {
66
+ const response = await agentTester.poll(id, { timeout: wait });
67
+ this.stop();
68
+ return { completed: true, response };
69
+ }
70
+ catch (e) {
71
+ if (isTimeoutError(e)) {
72
+ this.stop('async');
73
+ this.ux.log(`Client timed out after ${wait.minutes} minutes.`);
74
+ this.ux.log(`Run ${colorize('dim', `sf agent test resume --job-id ${id}`)} to resuming watching this test.`);
75
+ return { completed: true };
76
+ }
77
+ else {
78
+ this.error();
79
+ throw e;
80
+ }
81
+ }
82
+ }
83
+ update(data) {
84
+ this.mso.updateData(data);
85
+ }
86
+ stop(finalStatus) {
87
+ this.mso.stop(finalStatus);
88
+ }
89
+ error() {
90
+ this.mso.error();
91
+ }
92
+ done(data) {
93
+ this.mso.skipTo('Done', data);
94
+ }
95
+ }
96
+ //# sourceMappingURL=testStages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testStages.js","sourceRoot":"","sources":["../src/testStages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,MAAM,6BAA6B,CAAC;AAUjD,MAAM,cAAc,GAAG,CAAC,CAAU,EAAyC,EAAE,CAC1E,CAAsB,EAAE,IAAI,KAAK,sBAAsB,CAAC;AAE3D,MAAM,OAAO,UAAU;IACb,GAAG,CAAyB;IAC5B,EAAE,CAAK;IAEf,YAAmB,EAAE,KAAK,EAAE,WAAW,EAA2C;QAChF,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,IAAI,gBAAgB,CAAO;YACpC,KAAK;YACL,WAAW;YACX,MAAM,EAAE,CAAC,gBAAgB,EAAE,0BAA0B,CAAC;YACtD,kBAAkB,EAAE;gBAClB;oBACE,KAAK,EAAE,0BAA0B;oBACjC,IAAI,EAAE,mBAA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,CAAC;IAEM,IAAI,CAAC,IAAoB;QAC9B,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ # summary
2
+
3
+ Interact with an active agent, as a user would, to preview responses
4
+
5
+ # description
6
+
7
+ XXX
8
+
9
+ # flags.name.summary
10
+
11
+ The name of the agent you want to preview
12
+
13
+ # flags.name.description
14
+
15
+ the API name of the agent? (TBD based on agents library)
16
+
17
+ # examples
18
+
19
+ - <%= config.bin %> <%= command.id %> --agent HelpDeskAgent
20
+ - <%= config.bin %> <%= command.id %> --agent ConciergeAgent --target-org production
@@ -6,7 +6,7 @@ Cancel a running test for an Agent.
6
6
 
7
7
  Cancel a running test for an Agent, providing the AiEvaluation ID.
8
8
 
9
- # flags.id.summary
9
+ # flags.job-id.summary
10
10
 
11
11
  The AiEvaluation ID.
12
12
 
@@ -18,4 +18,4 @@ Use the job ID of the most recent test evaluation.
18
18
 
19
19
  - Cancel a test for an Agent:
20
20
 
21
- <%= config.bin %> <%= command.id %> --id AiEvalId
21
+ <%= config.bin %> <%= command.id %> --job-id AiEvalId
@@ -0,0 +1,19 @@
1
+ # summary
2
+
3
+ Get the results of a test evaluation.
4
+
5
+ # description
6
+
7
+ Provide the AiEvaluation ID to get the results of a test evaluation.
8
+
9
+ # flags.job-id.summary
10
+
11
+ The AiEvaluation ID.
12
+
13
+ # flags.use-most-recent.summary
14
+
15
+ Use the job ID of the most recent test evaluation.
16
+
17
+ # examples
18
+
19
+ - <%= config.bin %> <%= command.id %> --job-id AiEvalId
@@ -0,0 +1,29 @@
1
+ # summary
2
+
3
+ Resume a running test for an Agent.
4
+
5
+ # description
6
+
7
+ Resume a running test for an Agent, providing the AiEvaluation ID.
8
+
9
+ # flags.job-id.summary
10
+
11
+ The AiEvaluation ID.
12
+
13
+ # flags.use-most-recent.summary
14
+
15
+ Use the job ID of the most recent test evaluation.
16
+
17
+ # flags.wait.summary
18
+
19
+ Number of minutes to wait for the command to complete and display results to the terminal window.
20
+
21
+ # flags.wait.description
22
+
23
+ If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
24
+
25
+ # examples
26
+
27
+ - Resume a test for an Agent:
28
+
29
+ <%= config.bin %> <%= command.id %> --job-id AiEvalId
@@ -6,13 +6,13 @@ Start a test for an Agent.
6
6
 
7
7
  Start a test for an Agent, providing the AiEvalDefinitionVersion ID. Returns the job ID.
8
8
 
9
- # flags.id.summary
9
+ # flags.name.summary
10
10
 
11
- The AiEvalDefinitionVersion ID.
11
+ The name of the AiEvaluationDefinition to start.
12
12
 
13
- # flags.id.description
13
+ # flags.name.description
14
14
 
15
- The AiEvalDefinitionVersion ID.
15
+ The name of the AiEvaluationDefinition to start.
16
16
 
17
17
  # flags.wait.summary
18
18
 
@@ -22,12 +22,8 @@ Number of minutes to wait for the command to complete and display results to the
22
22
 
23
23
  If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
24
24
 
25
- # flags.output-dir.summary
26
-
27
- Directory in which to store test run files.
28
-
29
25
  # examples
30
26
 
31
27
  - Start a test for an Agent:
32
28
 
33
- <%= config.bin %> <%= command.id %> --id AiEvalDefVerId
29
+ <%= config.bin %> <%= command.id %> --name AiEvalDefVerId
@@ -0,0 +1,11 @@
1
+ # flags.result-format.summary
2
+
3
+ Format of the test run results.
4
+
5
+ # flags.output-dir.summary
6
+
7
+ Directory to write the test results to.
8
+
9
+ # flags.output-dir.description
10
+
11
+ If test run is complete, write the results to the specified directory. If the tests are still running, the test results will not be written.