@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.
- package/README.md +155 -20
- package/lib/agentTestCache.d.ts +17 -0
- package/lib/agentTestCache.js +53 -0
- package/lib/agentTestCache.js.map +1 -0
- package/lib/commands/agent/preview.d.ts +15 -0
- package/lib/commands/agent/preview.js +37 -0
- package/lib/commands/agent/preview.js.map +1 -0
- package/lib/commands/agent/test/cancel.d.ts +4 -3
- package/lib/commands/agent/test/cancel.js +15 -11
- package/lib/commands/agent/test/cancel.js.map +1 -1
- package/lib/commands/agent/test/results.d.ts +17 -0
- package/lib/commands/agent/test/results.js +44 -0
- package/lib/commands/agent/test/results.js.map +1 -0
- package/lib/commands/agent/test/resume.d.ts +21 -0
- package/lib/commands/agent/test/resume.js +72 -0
- package/lib/commands/agent/test/resume.js.map +1 -0
- package/lib/commands/agent/test/run.d.ts +6 -6
- package/lib/commands/agent/test/run.js +44 -23
- package/lib/commands/agent/test/run.js.map +1 -1
- package/lib/components/agent-preview-react.d.ts +9 -0
- package/lib/components/agent-preview-react.js +56 -0
- package/lib/components/agent-preview-react.js.map +1 -0
- package/lib/flags.d.ts +8 -0
- package/lib/flags.js +26 -0
- package/lib/flags.js.map +1 -0
- package/lib/handleTestResults.d.ts +8 -0
- package/lib/handleTestResults.js +44 -0
- package/lib/handleTestResults.js.map +1 -0
- package/lib/testStages.d.ts +27 -0
- package/lib/testStages.js +96 -0
- package/lib/testStages.js.map +1 -0
- package/messages/agent.preview.md +20 -0
- package/messages/agent.test.cancel.md +2 -2
- package/messages/agent.test.results.md +19 -0
- package/messages/agent.test.resume.md +29 -0
- package/messages/agent.test.run.md +5 -9
- package/messages/shared.md +11 -0
- package/npm-shrinkwrap.json +12262 -5563
- package/oclif.lock +835 -43
- package/oclif.manifest.json +322 -11
- package/package.json +26 -8
- package/schemas/agent-create.json +2 -4
- package/schemas/agent-generate-spec.json +2 -4
- package/schemas/agent-preview.json +9 -0
- package/schemas/agent-test-cancel.json +3 -6
- package/schemas/agent-test-results.json +145 -0
- package/schemas/agent-test-resume.json +19 -0
- package/schemas/agent-test-run.json +4 -13
package/README.md
CHANGED
|
@@ -63,7 +63,10 @@ sf plugins
|
|
|
63
63
|
|
|
64
64
|
- [`sf agent create`](#sf-agent-create)
|
|
65
65
|
- [`sf agent generate spec`](#sf-agent-generate-spec)
|
|
66
|
+
- [`sf agent preview`](#sf-agent-preview)
|
|
66
67
|
- [`sf agent test cancel`](#sf-agent-test-cancel)
|
|
68
|
+
- [`sf agent test results`](#sf-agent-test-results)
|
|
69
|
+
- [`sf agent test resume`](#sf-agent-test-resume)
|
|
67
70
|
- [`sf agent test run`](#sf-agent-test-run)
|
|
68
71
|
|
|
69
72
|
## `sf agent create`
|
|
@@ -102,7 +105,7 @@ FLAG DESCRIPTIONS
|
|
|
102
105
|
spec` command.
|
|
103
106
|
```
|
|
104
107
|
|
|
105
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
108
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/create.ts)_
|
|
106
109
|
|
|
107
110
|
## `sf agent generate spec`
|
|
108
111
|
|
|
@@ -145,7 +148,42 @@ EXAMPLES
|
|
|
145
148
|
--company-description "A meaningful description"
|
|
146
149
|
```
|
|
147
150
|
|
|
148
|
-
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
151
|
+
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/generate/spec.ts)_
|
|
152
|
+
|
|
153
|
+
## `sf agent preview`
|
|
154
|
+
|
|
155
|
+
Interact with an active agent, as a user would, to preview responses
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
USAGE
|
|
159
|
+
$ sf agent preview -o <value> -n <value> [--flags-dir <value>] [--api-version <value>]
|
|
160
|
+
|
|
161
|
+
FLAGS
|
|
162
|
+
-n, --name=<value> (required) The name of the agent you want to preview
|
|
163
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
164
|
+
configuration variable is already set.
|
|
165
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
166
|
+
|
|
167
|
+
GLOBAL FLAGS
|
|
168
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
169
|
+
|
|
170
|
+
DESCRIPTION
|
|
171
|
+
Interact with an active agent, as a user would, to preview responses
|
|
172
|
+
|
|
173
|
+
XXX
|
|
174
|
+
|
|
175
|
+
EXAMPLES
|
|
176
|
+
$ sf agent preview --agent HelpDeskAgent
|
|
177
|
+
|
|
178
|
+
$ sf agent preview --agent ConciergeAgent --target-org production
|
|
179
|
+
|
|
180
|
+
FLAG DESCRIPTIONS
|
|
181
|
+
-n, --name=<value> The name of the agent you want to preview
|
|
182
|
+
|
|
183
|
+
the API name of the agent? (TBD based on agents library)
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
_See code: [src/commands/agent/preview.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/preview.ts)_
|
|
149
187
|
|
|
150
188
|
## `sf agent test cancel`
|
|
151
189
|
|
|
@@ -153,13 +191,14 @@ Cancel a running test for an Agent.
|
|
|
153
191
|
|
|
154
192
|
```
|
|
155
193
|
USAGE
|
|
156
|
-
$ sf agent test cancel -o <value> -
|
|
194
|
+
$ sf agent test cancel -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r]
|
|
157
195
|
|
|
158
196
|
FLAGS
|
|
159
|
-
-i, --job-id=<value>
|
|
160
|
-
-o, --target-org=<value>
|
|
161
|
-
|
|
162
|
-
-r, --use-most-recent
|
|
197
|
+
-i, --job-id=<value> The AiEvaluation ID.
|
|
198
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
199
|
+
configuration variable is already set.
|
|
200
|
+
-r, --use-most-recent Use the job ID of the most recent test evaluation.
|
|
201
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
163
202
|
|
|
164
203
|
GLOBAL FLAGS
|
|
165
204
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -173,10 +212,97 @@ DESCRIPTION
|
|
|
173
212
|
EXAMPLES
|
|
174
213
|
Cancel a test for an Agent:
|
|
175
214
|
|
|
176
|
-
$ sf agent test cancel --id AiEvalId
|
|
215
|
+
$ sf agent test cancel --job-id AiEvalId
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/test/cancel.ts)_
|
|
219
|
+
|
|
220
|
+
## `sf agent test results`
|
|
221
|
+
|
|
222
|
+
Get the results of a test evaluation.
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
USAGE
|
|
226
|
+
$ sf agent test results -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>] [--result-format
|
|
227
|
+
json|human|junit] [-f <value>]
|
|
228
|
+
|
|
229
|
+
FLAGS
|
|
230
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
231
|
+
-i, --job-id=<value> (required) The AiEvaluation ID.
|
|
232
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
233
|
+
configuration variable is already set.
|
|
234
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
235
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
236
|
+
<options: json|human|junit>
|
|
237
|
+
|
|
238
|
+
GLOBAL FLAGS
|
|
239
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
240
|
+
--json Format output as json.
|
|
241
|
+
|
|
242
|
+
DESCRIPTION
|
|
243
|
+
Get the results of a test evaluation.
|
|
244
|
+
|
|
245
|
+
Provide the AiEvaluation ID to get the results of a test evaluation.
|
|
246
|
+
|
|
247
|
+
EXAMPLES
|
|
248
|
+
$ sf agent test results --job-id AiEvalId
|
|
249
|
+
|
|
250
|
+
FLAG DESCRIPTIONS
|
|
251
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
252
|
+
|
|
253
|
+
If test run is complete, write the results to the specified directory. If the tests are still running, the test
|
|
254
|
+
results will not be written.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/test/results.ts)_
|
|
258
|
+
|
|
259
|
+
## `sf agent test resume`
|
|
260
|
+
|
|
261
|
+
Resume a running test for an Agent.
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
USAGE
|
|
265
|
+
$ sf agent test resume -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r] [-w
|
|
266
|
+
<value>] [--result-format json|human|junit] [-f <value>]
|
|
267
|
+
|
|
268
|
+
FLAGS
|
|
269
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
270
|
+
-i, --job-id=<value> The AiEvaluation ID.
|
|
271
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
272
|
+
configuration variable is already set.
|
|
273
|
+
-r, --use-most-recent Use the job ID of the most recent test evaluation.
|
|
274
|
+
-w, --wait=<value> [default: 5 minutes] Number of minutes to wait for the command to complete and display
|
|
275
|
+
results to the terminal window.
|
|
276
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
277
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
278
|
+
<options: json|human|junit>
|
|
279
|
+
|
|
280
|
+
GLOBAL FLAGS
|
|
281
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
282
|
+
--json Format output as json.
|
|
283
|
+
|
|
284
|
+
DESCRIPTION
|
|
285
|
+
Resume a running test for an Agent.
|
|
286
|
+
|
|
287
|
+
Resume a running test for an Agent, providing the AiEvaluation ID.
|
|
288
|
+
|
|
289
|
+
EXAMPLES
|
|
290
|
+
Resume a test for an Agent:
|
|
291
|
+
|
|
292
|
+
$ sf agent test resume --job-id AiEvalId
|
|
293
|
+
|
|
294
|
+
FLAG DESCRIPTIONS
|
|
295
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
296
|
+
|
|
297
|
+
If test run is complete, write the results to the specified directory. If the tests are still running, the test
|
|
298
|
+
results will not be written.
|
|
299
|
+
|
|
300
|
+
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the terminal window.
|
|
301
|
+
|
|
302
|
+
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
|
|
177
303
|
```
|
|
178
304
|
|
|
179
|
-
_See code: [src/commands/agent/test/
|
|
305
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/test/resume.ts)_
|
|
180
306
|
|
|
181
307
|
## `sf agent test run`
|
|
182
308
|
|
|
@@ -184,15 +310,19 @@ Start a test for an Agent.
|
|
|
184
310
|
|
|
185
311
|
```
|
|
186
312
|
USAGE
|
|
187
|
-
$ sf agent test run -o <value> -
|
|
313
|
+
$ sf agent test run -o <value> -n <value> [--json] [--flags-dir <value>] [--api-version <value>] [-w <value>]
|
|
314
|
+
[--result-format json|human|junit] [-f <value>]
|
|
188
315
|
|
|
189
316
|
FLAGS
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
-o, --target-org=<value>
|
|
193
|
-
|
|
194
|
-
-w, --wait=<value>
|
|
195
|
-
|
|
317
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
318
|
+
-n, --name=<value> (required) The name of the AiEvaluationDefinition to start.
|
|
319
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
320
|
+
configuration variable is already set.
|
|
321
|
+
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the
|
|
322
|
+
terminal window.
|
|
323
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
324
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
325
|
+
<options: json|human|junit>
|
|
196
326
|
|
|
197
327
|
GLOBAL FLAGS
|
|
198
328
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -206,18 +336,23 @@ DESCRIPTION
|
|
|
206
336
|
EXAMPLES
|
|
207
337
|
Start a test for an Agent:
|
|
208
338
|
|
|
209
|
-
$ sf agent test run --
|
|
339
|
+
$ sf agent test run --name AiEvalDefVerId
|
|
210
340
|
|
|
211
341
|
FLAG DESCRIPTIONS
|
|
212
|
-
-
|
|
342
|
+
-f, --output-dir=<value> Directory to write the test results to.
|
|
343
|
+
|
|
344
|
+
If test run is complete, write the results to the specified directory. If the tests are still running, the test
|
|
345
|
+
results will not be written.
|
|
346
|
+
|
|
347
|
+
-n, --name=<value> The name of the AiEvaluationDefinition to start.
|
|
213
348
|
|
|
214
|
-
The
|
|
349
|
+
The name of the AiEvaluationDefinition to start.
|
|
215
350
|
|
|
216
351
|
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the terminal window.
|
|
217
352
|
|
|
218
353
|
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
|
|
219
354
|
```
|
|
220
355
|
|
|
221
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
356
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.5.0/src/commands/agent/test/run.ts)_
|
|
222
357
|
|
|
223
358
|
<!-- commandsstop -->
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TTLConfig } from '@salesforce/core';
|
|
2
|
+
type CacheContents = {
|
|
3
|
+
aiEvaluationId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class AgentTestCache extends TTLConfig<TTLConfig.Options, CacheContents> {
|
|
7
|
+
static getFileName(): string;
|
|
8
|
+
static getDefaultOptions(): TTLConfig.Options;
|
|
9
|
+
createCacheEntry(aiEvaluationId: string, name: string): Promise<void>;
|
|
10
|
+
removeCacheEntry(aiEvaluationId: string): Promise<void>;
|
|
11
|
+
resolveFromCache(): CacheContents;
|
|
12
|
+
useIdOrMostRecent(aiEvaluationId: string | undefined, useMostRecent: boolean): {
|
|
13
|
+
aiEvaluationId: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
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 { Global, SfError, TTLConfig } from '@salesforce/core';
|
|
8
|
+
import { Duration } from '@salesforce/kit';
|
|
9
|
+
export class AgentTestCache extends TTLConfig {
|
|
10
|
+
static getFileName() {
|
|
11
|
+
return 'agent-test-cache.json';
|
|
12
|
+
}
|
|
13
|
+
static getDefaultOptions() {
|
|
14
|
+
return {
|
|
15
|
+
isGlobal: true,
|
|
16
|
+
isState: true,
|
|
17
|
+
filename: AgentTestCache.getFileName(),
|
|
18
|
+
stateFolder: Global.SF_STATE_FOLDER,
|
|
19
|
+
ttl: Duration.days(7),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async createCacheEntry(aiEvaluationId, name) {
|
|
23
|
+
if (!aiEvaluationId)
|
|
24
|
+
throw new SfError('aiEvaluationId is required to create a cache entry');
|
|
25
|
+
this.set(aiEvaluationId, { aiEvaluationId, name });
|
|
26
|
+
await this.write();
|
|
27
|
+
}
|
|
28
|
+
async removeCacheEntry(aiEvaluationId) {
|
|
29
|
+
if (!aiEvaluationId)
|
|
30
|
+
throw new SfError('aiEvaluationId is required to remove a cache entry');
|
|
31
|
+
this.unset(aiEvaluationId);
|
|
32
|
+
await this.write();
|
|
33
|
+
}
|
|
34
|
+
resolveFromCache() {
|
|
35
|
+
const key = this.getLatestKey();
|
|
36
|
+
if (!key)
|
|
37
|
+
throw new SfError('Could not find an aiEvaluationId to resume');
|
|
38
|
+
return this.get(key);
|
|
39
|
+
}
|
|
40
|
+
useIdOrMostRecent(aiEvaluationId, useMostRecent) {
|
|
41
|
+
if (aiEvaluationId && useMostRecent) {
|
|
42
|
+
throw new SfError('Cannot specify both an aiEvaluationId and use most recent flag');
|
|
43
|
+
}
|
|
44
|
+
if (!aiEvaluationId && !useMostRecent) {
|
|
45
|
+
throw new SfError('Must specify either an aiEvaluationId or use most recent flag');
|
|
46
|
+
}
|
|
47
|
+
if (aiEvaluationId) {
|
|
48
|
+
return { aiEvaluationId };
|
|
49
|
+
}
|
|
50
|
+
return this.resolveFromCache();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=agentTestCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentTestCache.js","sourceRoot":"","sources":["../src/agentTestCache.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAO3C,MAAM,OAAO,cAAe,SAAQ,SAA2C;IACtE,MAAM,CAAC,WAAW;QACvB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,iBAAiB;QAC7B,OAAO;YACL,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,cAAc,CAAC,WAAW,EAAE;YACtC,WAAW,EAAE,MAAM,CAAC,eAAe;YACnC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;SACtB,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,cAAsB,EAAE,IAAY;QAChE,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,OAAO,CAAC,oDAAoD,CAAC,CAAC;QAE7F,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,cAAsB;QAClD,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,OAAO,CAAC,oDAAoD,CAAC,CAAC;QAE7F,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;QAC3B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAEM,gBAAgB;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,IAAI,CAAC,GAAG;YAAE,MAAM,IAAI,OAAO,CAAC,4CAA4C,CAAC,CAAC;QAE1E,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAEM,iBAAiB,CACtB,cAAkC,EAClC,aAAsB;QAEtB,IAAI,cAAc,IAAI,aAAa,EAAE,CAAC;YACpC,MAAM,IAAI,OAAO,CAAC,gEAAgE,CAAC,CAAC;QACtF,CAAC;QAED,IAAI,CAAC,cAAc,IAAI,CAAC,aAAa,EAAE,CAAC;YACtC,MAAM,IAAI,OAAO,CAAC,+DAA+D,CAAC,CAAC;QACrF,CAAC;QAED,IAAI,cAAc,EAAE,CAAC;YACnB,OAAO,EAAE,cAAc,EAAE,CAAC;QAC5B,CAAC;QAED,OAAO,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type AgentPreviewResult = void;
|
|
3
|
+
export default class AgentPreview extends SfCommand<AgentPreviewResult> {
|
|
4
|
+
static readonly summary: string;
|
|
5
|
+
static readonly description: string;
|
|
6
|
+
static readonly examples: string[];
|
|
7
|
+
static readonly enableJsonFlag = false;
|
|
8
|
+
static readonly requiresProject = true;
|
|
9
|
+
static readonly flags: {
|
|
10
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
name: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
run(): Promise<AgentPreviewResult>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
8
|
+
import { Messages } from '@salesforce/core';
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { render } from 'ink';
|
|
11
|
+
import { AgentPreviewReact } from '../../components/agent-preview-react.js';
|
|
12
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.preview');
|
|
14
|
+
export default class AgentPreview extends SfCommand {
|
|
15
|
+
static summary = messages.getMessage('summary');
|
|
16
|
+
static description = messages.getMessage('description');
|
|
17
|
+
static examples = messages.getMessages('examples');
|
|
18
|
+
static enableJsonFlag = false;
|
|
19
|
+
static requiresProject = true;
|
|
20
|
+
static flags = {
|
|
21
|
+
'target-org': Flags.requiredOrg(),
|
|
22
|
+
'api-version': Flags.orgApiVersion(),
|
|
23
|
+
name: Flags.string({
|
|
24
|
+
summary: messages.getMessage('flags.name.summary'),
|
|
25
|
+
description: messages.getMessage('flags.name.description'),
|
|
26
|
+
char: 'n',
|
|
27
|
+
required: true,
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(AgentPreview);
|
|
32
|
+
this.log(`previewing ${flags.name}`);
|
|
33
|
+
const instance = render(React.createElement(AgentPreviewReact, null));
|
|
34
|
+
await instance.waitUntilExit();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../../src/commands/agent/preview.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,eAAe,CAAC,CAAC;AAIpF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,SAA6B;IAC9D,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,cAAc,GAAG,KAAK,CAAC;IACvC,MAAM,CAAU,eAAe,GAAG,IAAI,CAAC;IAEvC,MAAM,CAAU,KAAK,GAAG;QAC7B,YAAY,EAAE,KAAK,CAAC,WAAW,EAAE;QACjC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE;QACpC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;YAClD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,wBAAwB,CAAC;YAC1D,IAAI,EAAE,GAAG;YACT,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QACjD,IAAI,CAAC,GAAG,CAAC,cAAc,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QAErC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,CAAC;QACtE,MAAM,QAAQ,CAAC,aAAa,EAAE,CAAC;IACjC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
export type AgentTestCancelResult = {
|
|
3
|
-
|
|
3
|
+
aiEvaluationId: string;
|
|
4
4
|
success: boolean;
|
|
5
5
|
errorCode?: string;
|
|
6
6
|
message?: string;
|
|
@@ -9,10 +9,11 @@ export default class AgentTestCancel extends SfCommand<AgentTestCancelResult> {
|
|
|
9
9
|
static readonly summary: string;
|
|
10
10
|
static readonly description: string;
|
|
11
11
|
static readonly examples: string[];
|
|
12
|
-
static state
|
|
12
|
+
static readonly state = "beta";
|
|
13
13
|
static readonly flags: {
|
|
14
14
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
-
'
|
|
15
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
|
+
'job-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
17
|
'use-most-recent': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
17
18
|
};
|
|
18
19
|
run(): Promise<AgentTestCancelResult>;
|
|
@@ -6,6 +6,8 @@
|
|
|
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 { AgentTestCache } from '../../../agentTestCache.js';
|
|
9
11
|
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
10
12
|
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.cancel');
|
|
11
13
|
export default class AgentTestCancel extends SfCommand {
|
|
@@ -15,29 +17,31 @@ export default class AgentTestCancel extends SfCommand {
|
|
|
15
17
|
static state = 'beta';
|
|
16
18
|
static flags = {
|
|
17
19
|
'target-org': Flags.requiredOrg(),
|
|
20
|
+
'api-version': Flags.orgApiVersion(),
|
|
18
21
|
'job-id': Flags.string({
|
|
19
22
|
char: 'i',
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
24
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
22
25
|
}),
|
|
23
26
|
'use-most-recent': Flags.boolean({
|
|
24
27
|
char: 'r',
|
|
25
28
|
summary: messages.getMessage('flags.use-most-recent.summary'),
|
|
26
29
|
exactlyOne: ['use-most-recent', 'job-id'],
|
|
27
30
|
}),
|
|
28
|
-
//
|
|
29
|
-
// Future flags:
|
|
30
|
-
// ??? api-version ???
|
|
31
31
|
};
|
|
32
32
|
async run() {
|
|
33
33
|
const { flags } = await this.parse(AgentTestCancel);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const agentTestCache = await AgentTestCache.create();
|
|
35
|
+
const { aiEvaluationId } = agentTestCache.useIdOrMostRecent(flags['job-id'], flags['use-most-recent']);
|
|
36
|
+
this.log(`Canceling tests for AiEvaluation Job: ${aiEvaluationId}`);
|
|
37
|
+
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
38
|
+
const result = await agentTester.cancel(aiEvaluationId);
|
|
39
|
+
if (result.success) {
|
|
40
|
+
await agentTestCache.removeCacheEntry(aiEvaluationId);
|
|
41
|
+
}
|
|
38
42
|
return {
|
|
39
|
-
success:
|
|
40
|
-
|
|
43
|
+
success: result.success,
|
|
44
|
+
aiEvaluationId,
|
|
41
45
|
};
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/cancel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/cancel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC;AASxF,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,SAAgC;IACpE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAA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AAC,CAAC;QAExD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,MAAM,cAAc,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QACxD,CAAC;QAED,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,cAAc;SACf,CAAC;IACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
import { AgentTestDetailsResponse } from '@salesforce/agents';
|
|
3
|
+
export type AgentTestResultsResult = AgentTestDetailsResponse;
|
|
4
|
+
export default class AgentTestResults extends SfCommand<AgentTestResultsResult> {
|
|
5
|
+
static readonly summary: string;
|
|
6
|
+
static readonly description: string;
|
|
7
|
+
static readonly examples: string[];
|
|
8
|
+
static readonly state = "beta";
|
|
9
|
+
static readonly flags: {
|
|
10
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
'job-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "human" | "junit", import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
run(): Promise<AgentTestResultsResult>;
|
|
17
|
+
}
|
|
@@ -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 { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
8
|
+
import { Messages } from '@salesforce/core';
|
|
9
|
+
import { AgentTester } from '@salesforce/agents';
|
|
10
|
+
import { resultFormatFlag, testOutputDirFlag } from '../../../flags.js';
|
|
11
|
+
import { handleTestResults } from '../../../handleTestResults.js';
|
|
12
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
13
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.results');
|
|
14
|
+
export default class AgentTestResults extends SfCommand {
|
|
15
|
+
static summary = messages.getMessage('summary');
|
|
16
|
+
static description = messages.getMessage('description');
|
|
17
|
+
static examples = messages.getMessages('examples');
|
|
18
|
+
static state = 'beta';
|
|
19
|
+
static flags = {
|
|
20
|
+
'target-org': Flags.requiredOrg(),
|
|
21
|
+
'api-version': Flags.orgApiVersion(),
|
|
22
|
+
'job-id': Flags.string({
|
|
23
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
24
|
+
char: 'i',
|
|
25
|
+
required: true,
|
|
26
|
+
}),
|
|
27
|
+
'result-format': resultFormatFlag(),
|
|
28
|
+
'output-dir': testOutputDirFlag(),
|
|
29
|
+
};
|
|
30
|
+
async run() {
|
|
31
|
+
const { flags } = await this.parse(AgentTestResults);
|
|
32
|
+
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
33
|
+
const response = await agentTester.details(flags['job-id']);
|
|
34
|
+
await handleTestResults({
|
|
35
|
+
id: flags['job-id'],
|
|
36
|
+
format: flags['result-format'],
|
|
37
|
+
results: response,
|
|
38
|
+
jsonEnabled: this.jsonEnabled(),
|
|
39
|
+
outputDir: flags['output-dir'],
|
|
40
|
+
});
|
|
41
|
+
return response;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/results.ts"],"names":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,CAAC,gBAAgB,CAAC,CAAC;QAErD,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC5D,MAAM,iBAAiB,CAAC;YACtB,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC;YACnB,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC;YAC9B,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;YAC/B,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;SAC/B,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
+
export type AgentTestResumeResult = {
|
|
3
|
+
aiEvaluationId: string;
|
|
4
|
+
status: string;
|
|
5
|
+
};
|
|
6
|
+
export default class AgentTestResume extends SfCommand<AgentTestResumeResult> {
|
|
7
|
+
static readonly summary: string;
|
|
8
|
+
static readonly description: string;
|
|
9
|
+
static readonly examples: string[];
|
|
10
|
+
static readonly state = "beta";
|
|
11
|
+
static readonly flags: {
|
|
12
|
+
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
'job-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
|
+
'use-most-recent': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
16
|
+
wait: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/kit").Duration, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
+
'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "human" | "junit", import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
'output-dir': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
19
|
+
};
|
|
20
|
+
run(): Promise<AgentTestResumeResult>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023, 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 { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
8
|
+
import { Messages } from '@salesforce/core';
|
|
9
|
+
import { AgentTester } from '@salesforce/agents';
|
|
10
|
+
import { AgentTestCache } from '../../../agentTestCache.js';
|
|
11
|
+
import { TestStages } from '../../../testStages.js';
|
|
12
|
+
import { resultFormatFlag, testOutputDirFlag } from '../../../flags.js';
|
|
13
|
+
import { handleTestResults } from '../../../handleTestResults.js';
|
|
14
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
15
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.resume');
|
|
16
|
+
export default class AgentTestResume extends SfCommand {
|
|
17
|
+
static summary = messages.getMessage('summary');
|
|
18
|
+
static description = messages.getMessage('description');
|
|
19
|
+
static examples = messages.getMessages('examples');
|
|
20
|
+
static state = 'beta';
|
|
21
|
+
static flags = {
|
|
22
|
+
'target-org': Flags.requiredOrg(),
|
|
23
|
+
'api-version': Flags.orgApiVersion(),
|
|
24
|
+
'job-id': Flags.string({
|
|
25
|
+
char: 'i',
|
|
26
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
27
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
28
|
+
}),
|
|
29
|
+
'use-most-recent': Flags.boolean({
|
|
30
|
+
char: 'r',
|
|
31
|
+
summary: messages.getMessage('flags.use-most-recent.summary'),
|
|
32
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
33
|
+
}),
|
|
34
|
+
wait: Flags.duration({
|
|
35
|
+
char: 'w',
|
|
36
|
+
unit: 'minutes',
|
|
37
|
+
min: 1,
|
|
38
|
+
defaultValue: 5,
|
|
39
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
40
|
+
description: messages.getMessage('flags.wait.description'),
|
|
41
|
+
}),
|
|
42
|
+
'result-format': resultFormatFlag(),
|
|
43
|
+
'output-dir': testOutputDirFlag(),
|
|
44
|
+
};
|
|
45
|
+
async run() {
|
|
46
|
+
const { flags } = await this.parse(AgentTestResume);
|
|
47
|
+
const agentTestCache = await AgentTestCache.create();
|
|
48
|
+
const { name, aiEvaluationId } = agentTestCache.useIdOrMostRecent(flags['job-id'], flags['use-most-recent']);
|
|
49
|
+
const mso = new TestStages({
|
|
50
|
+
title: `Agent Test Run: ${name ?? aiEvaluationId}`,
|
|
51
|
+
jsonEnabled: this.jsonEnabled(),
|
|
52
|
+
});
|
|
53
|
+
mso.start({ id: aiEvaluationId });
|
|
54
|
+
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
55
|
+
const { completed, response } = await mso.poll(agentTester, aiEvaluationId, flags.wait);
|
|
56
|
+
if (completed)
|
|
57
|
+
await agentTestCache.removeCacheEntry(aiEvaluationId);
|
|
58
|
+
mso.stop();
|
|
59
|
+
await handleTestResults({
|
|
60
|
+
id: aiEvaluationId,
|
|
61
|
+
format: flags['result-format'],
|
|
62
|
+
results: response,
|
|
63
|
+
jsonEnabled: this.jsonEnabled(),
|
|
64
|
+
outputDir: flags['output-dir'],
|
|
65
|
+
});
|
|
66
|
+
return {
|
|
67
|
+
status: 'COMPLETED',
|
|
68
|
+
aiEvaluationId,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
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