@salesforce/agents 0.5.10-dev.0 → 0.5.11
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/lib/agentTester.d.ts +9 -9
- package/lib/agentTester.js +9 -9
- package/lib/index.d.ts +1 -1
- package/package.json +3 -3
package/lib/agentTester.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export type TestCaseResult = {
|
|
|
40
40
|
errorMessage?: string;
|
|
41
41
|
}>;
|
|
42
42
|
};
|
|
43
|
-
export type
|
|
43
|
+
export type AgentTestDetailsResponse = {
|
|
44
44
|
status: TestStatus;
|
|
45
45
|
startTime: string;
|
|
46
46
|
endTime?: string;
|
|
@@ -77,18 +77,18 @@ export declare class AgentTester {
|
|
|
77
77
|
*
|
|
78
78
|
* @param {string} jobId
|
|
79
79
|
* @param {Duration} timeout
|
|
80
|
-
* @returns {Promise<
|
|
80
|
+
* @returns {Promise<AgentTestDetailsResponse>}
|
|
81
81
|
*/
|
|
82
82
|
poll(jobId: string, { timeout, }?: {
|
|
83
83
|
timeout?: Duration;
|
|
84
|
-
}): Promise<
|
|
84
|
+
}): Promise<AgentTestDetailsResponse>;
|
|
85
85
|
/**
|
|
86
86
|
* Request test run details
|
|
87
87
|
*
|
|
88
88
|
* @param {string} jobId
|
|
89
|
-
* @returns {Promise<
|
|
89
|
+
* @returns {Promise<AgentTestDetailsResponse>}
|
|
90
90
|
*/
|
|
91
|
-
|
|
91
|
+
details(jobId: string): Promise<AgentTestDetailsResponse>;
|
|
92
92
|
/**
|
|
93
93
|
* Cancel an in-progress test run
|
|
94
94
|
*
|
|
@@ -99,7 +99,7 @@ export declare class AgentTester {
|
|
|
99
99
|
success: boolean;
|
|
100
100
|
}>;
|
|
101
101
|
}
|
|
102
|
-
export declare function humanFormat(details:
|
|
103
|
-
export declare function jsonFormat(details:
|
|
104
|
-
export declare function junitFormat(details:
|
|
105
|
-
export declare function tapFormat(details:
|
|
102
|
+
export declare function humanFormat(details: AgentTestDetailsResponse): Promise<string>;
|
|
103
|
+
export declare function jsonFormat(details: AgentTestDetailsResponse): Promise<string>;
|
|
104
|
+
export declare function junitFormat(details: AgentTestDetailsResponse): Promise<string>;
|
|
105
|
+
export declare function tapFormat(details: AgentTestDetailsResponse): Promise<string>;
|
package/lib/agentTester.js
CHANGED
|
@@ -54,7 +54,7 @@ class AgentTester {
|
|
|
54
54
|
*
|
|
55
55
|
* @param {string} jobId
|
|
56
56
|
* @param {Duration} timeout
|
|
57
|
-
* @returns {Promise<
|
|
57
|
+
* @returns {Promise<AgentTestDetailsResponse>}
|
|
58
58
|
*/
|
|
59
59
|
async poll(jobId, { timeout = kit_1.Duration.minutes(5), } = {
|
|
60
60
|
timeout: kit_1.Duration.minutes(5),
|
|
@@ -65,10 +65,10 @@ class AgentTester {
|
|
|
65
65
|
poll: async () => {
|
|
66
66
|
// NOTE: we don't actually need to call the status API here since all the same information is present on the
|
|
67
67
|
// details API. We could just call the details API and check the status there.
|
|
68
|
-
const [
|
|
69
|
-
const totalTestCases =
|
|
70
|
-
const failingTestCases =
|
|
71
|
-
const passingTestCases =
|
|
68
|
+
const [detailsResponse, statusResponse] = await Promise.all([this.details(jobId), this.status(jobId)]);
|
|
69
|
+
const totalTestCases = detailsResponse.testSet.testCases.length;
|
|
70
|
+
const failingTestCases = detailsResponse.testSet.testCases.filter((tc) => tc.status === 'ERROR').length;
|
|
71
|
+
const passingTestCases = detailsResponse.testSet.testCases.filter((tc) => tc.status === 'COMPLETED' && tc.expectationResults.every((r) => r.result === 'Passed')).length;
|
|
72
72
|
if (statusResponse.status.toLowerCase() === 'completed') {
|
|
73
73
|
await lifecycle.emit('AGENT_TEST_POLLING_EVENT', {
|
|
74
74
|
jobId,
|
|
@@ -77,7 +77,7 @@ class AgentTester {
|
|
|
77
77
|
failingTestCases,
|
|
78
78
|
passingTestCases,
|
|
79
79
|
});
|
|
80
|
-
return { payload:
|
|
80
|
+
return { payload: detailsResponse, completed: true };
|
|
81
81
|
}
|
|
82
82
|
await lifecycle.emit('AGENT_TEST_POLLING_EVENT', {
|
|
83
83
|
jobId,
|
|
@@ -97,10 +97,10 @@ class AgentTester {
|
|
|
97
97
|
* Request test run details
|
|
98
98
|
*
|
|
99
99
|
* @param {string} jobId
|
|
100
|
-
* @returns {Promise<
|
|
100
|
+
* @returns {Promise<AgentTestDetailsResponse>}
|
|
101
101
|
*/
|
|
102
|
-
async
|
|
103
|
-
const url = `/einstein/ai-evaluations/runs/${jobId}/
|
|
102
|
+
async details(jobId) {
|
|
103
|
+
const url = `/einstein/ai-evaluations/runs/${jobId}/details`;
|
|
104
104
|
return this.maybeMock.request('GET', url);
|
|
105
105
|
}
|
|
106
106
|
/**
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { type AgentCreateConfig, type AgentCreateResponse, type AgentJobSpec, type AgentJobSpecCreateConfig, type AgentJobSpecCreateResponse, SfAgent, } from './types';
|
|
2
2
|
export { Agent, AgentCreateLifecycleStages } from './agent';
|
|
3
|
-
export { AgentTester, humanFormat, jsonFormat, junitFormat, tapFormat, type
|
|
3
|
+
export { AgentTester, humanFormat, jsonFormat, junitFormat, tapFormat, type AgentTestDetailsResponse, type AgentTestStartResponse, type AgentTestStatusResponse, type TestCaseResult, type TestStatus, } from './agentTester';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/agents",
|
|
3
3
|
"description": "Client side APIs for working with Salesforce agents",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.11",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Salesforce",
|
|
7
7
|
"main": "lib/index",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"@salesforce/core": "^8.8.0",
|
|
15
15
|
"@salesforce/kit": "^3.2.3",
|
|
16
16
|
"@salesforce/sf-plugins-core": "^12.1.2",
|
|
17
|
-
"@salesforce/source-deploy-retrieve": "^12.
|
|
18
|
-
"ansis": "^3.
|
|
17
|
+
"@salesforce/source-deploy-retrieve": "^12.12.3",
|
|
18
|
+
"ansis": "^3.8.1",
|
|
19
19
|
"fast-xml-parser": "^4",
|
|
20
20
|
"nock": "^13.5.6"
|
|
21
21
|
},
|