@salesforce/plugin-agent 1.3.3 → 1.4.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 +104 -24
- package/lib/agentTestCache.d.ts +17 -0
- package/lib/agentTestCache.js +53 -0
- package/lib/agentTestCache.js.map +1 -0
- package/lib/commands/agent/generate/spec.js +2 -2
- package/lib/commands/agent/generate/spec.js.map +1 -1
- 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 +16 -0
- package/lib/commands/agent/test/results.js +38 -0
- package/lib/commands/agent/test/results.js.map +1 -0
- package/lib/commands/agent/test/resume.d.ts +20 -0
- package/lib/commands/agent/test/resume.js +66 -0
- package/lib/commands/agent/test/resume.js.map +1 -0
- package/lib/commands/agent/test/run.d.ts +6 -7
- package/lib/commands/agent/test/run.js +38 -23
- package/lib/commands/agent/test/run.js.map +1 -1
- package/lib/flags.d.ts +4 -0
- package/lib/flags.js +21 -0
- package/lib/flags.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.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 +3 -0
- package/npm-shrinkwrap.json +26 -8
- package/oclif.lock +18 -35
- package/oclif.manifest.json +228 -15
- package/package.json +17 -7
- package/schemas/agent-create.json +2 -4
- package/schemas/agent-generate-spec.json +2 -4
- 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
|
@@ -64,6 +64,8 @@ sf plugins
|
|
|
64
64
|
- [`sf agent create`](#sf-agent-create)
|
|
65
65
|
- [`sf agent generate spec`](#sf-agent-generate-spec)
|
|
66
66
|
- [`sf agent test cancel`](#sf-agent-test-cancel)
|
|
67
|
+
- [`sf agent test results`](#sf-agent-test-results)
|
|
68
|
+
- [`sf agent test resume`](#sf-agent-test-resume)
|
|
67
69
|
- [`sf agent test run`](#sf-agent-test-run)
|
|
68
70
|
|
|
69
71
|
## `sf agent create`
|
|
@@ -102,7 +104,7 @@ FLAG DESCRIPTIONS
|
|
|
102
104
|
spec` command.
|
|
103
105
|
```
|
|
104
106
|
|
|
105
|
-
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
107
|
+
_See code: [src/commands/agent/create.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/create.ts)_
|
|
106
108
|
|
|
107
109
|
## `sf agent generate spec`
|
|
108
110
|
|
|
@@ -110,9 +112,9 @@ Create an Agent spec.
|
|
|
110
112
|
|
|
111
113
|
```
|
|
112
114
|
USAGE
|
|
113
|
-
$ sf agent generate spec -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t
|
|
114
|
-
|
|
115
|
-
[
|
|
115
|
+
$ sf agent generate spec -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-t customer|internal]
|
|
116
|
+
[--role <value>] [--company-name <value>] [--company-description <value>] [--company-website <value>] [-d <value>]
|
|
117
|
+
[-f <value>]
|
|
116
118
|
|
|
117
119
|
FLAGS
|
|
118
120
|
-d, --output-dir=<value> [default: config] The location within the project where the agent spec will be
|
|
@@ -121,7 +123,7 @@ FLAGS
|
|
|
121
123
|
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
122
124
|
configuration variable is already set.
|
|
123
125
|
-t, --type=<option> The type of agent to create.
|
|
124
|
-
<options:
|
|
126
|
+
<options: customer|internal>
|
|
125
127
|
--api-version=<value> Override the api version used for api requests made by this command
|
|
126
128
|
--company-description=<value> The description of the company, containing details to be used when generating agent
|
|
127
129
|
job descriptions.
|
|
@@ -145,7 +147,7 @@ EXAMPLES
|
|
|
145
147
|
--company-description "A meaningful description"
|
|
146
148
|
```
|
|
147
149
|
|
|
148
|
-
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
150
|
+
_See code: [src/commands/agent/generate/spec.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/generate/spec.ts)_
|
|
149
151
|
|
|
150
152
|
## `sf agent test cancel`
|
|
151
153
|
|
|
@@ -153,13 +155,14 @@ Cancel a running test for an Agent.
|
|
|
153
155
|
|
|
154
156
|
```
|
|
155
157
|
USAGE
|
|
156
|
-
$ sf agent test cancel -o <value> -
|
|
158
|
+
$ sf agent test cancel -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r]
|
|
157
159
|
|
|
158
160
|
FLAGS
|
|
159
|
-
-i, --job-id=<value>
|
|
160
|
-
-o, --target-org=<value>
|
|
161
|
-
|
|
162
|
-
-r, --use-most-recent
|
|
161
|
+
-i, --job-id=<value> The AiEvaluation ID.
|
|
162
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
163
|
+
configuration variable is already set.
|
|
164
|
+
-r, --use-most-recent Use the job ID of the most recent test evaluation.
|
|
165
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
163
166
|
|
|
164
167
|
GLOBAL FLAGS
|
|
165
168
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -173,10 +176,84 @@ DESCRIPTION
|
|
|
173
176
|
EXAMPLES
|
|
174
177
|
Cancel a test for an Agent:
|
|
175
178
|
|
|
176
|
-
$ sf agent test cancel --id AiEvalId
|
|
179
|
+
$ sf agent test cancel --job-id AiEvalId
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
_See code: [src/commands/agent/test/cancel.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/test/cancel.ts)_
|
|
183
|
+
|
|
184
|
+
## `sf agent test results`
|
|
185
|
+
|
|
186
|
+
Get the results of a test evaluation.
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
USAGE
|
|
190
|
+
$ sf agent test results -o <value> -i <value> [--json] [--flags-dir <value>] [--api-version <value>] [--result-format
|
|
191
|
+
json|human]
|
|
192
|
+
|
|
193
|
+
FLAGS
|
|
194
|
+
-i, --job-id=<value> (required) The AiEvaluation ID.
|
|
195
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
196
|
+
configuration variable is already set.
|
|
197
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
198
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
199
|
+
<options: json|human>
|
|
200
|
+
|
|
201
|
+
GLOBAL FLAGS
|
|
202
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
203
|
+
--json Format output as json.
|
|
204
|
+
|
|
205
|
+
DESCRIPTION
|
|
206
|
+
Get the results of a test evaluation.
|
|
207
|
+
|
|
208
|
+
Provide the AiEvaluation ID to get the results of a test evaluation.
|
|
209
|
+
|
|
210
|
+
EXAMPLES
|
|
211
|
+
$ sf agent test results --job-id AiEvalId
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
_See code: [src/commands/agent/test/results.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/test/results.ts)_
|
|
215
|
+
|
|
216
|
+
## `sf agent test resume`
|
|
217
|
+
|
|
218
|
+
Resume a running test for an Agent.
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
USAGE
|
|
222
|
+
$ sf agent test resume -o <value> [--json] [--flags-dir <value>] [--api-version <value>] [-i <value>] [-r] [-w
|
|
223
|
+
<value>] [--result-format json|human]
|
|
224
|
+
|
|
225
|
+
FLAGS
|
|
226
|
+
-i, --job-id=<value> The AiEvaluation ID.
|
|
227
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
228
|
+
configuration variable is already set.
|
|
229
|
+
-r, --use-most-recent Use the job ID of the most recent test evaluation.
|
|
230
|
+
-w, --wait=<value> [default: 5 minutes] Number of minutes to wait for the command to complete and display
|
|
231
|
+
results to the terminal window.
|
|
232
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
233
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
234
|
+
<options: json|human>
|
|
235
|
+
|
|
236
|
+
GLOBAL FLAGS
|
|
237
|
+
--flags-dir=<value> Import flag values from a directory.
|
|
238
|
+
--json Format output as json.
|
|
239
|
+
|
|
240
|
+
DESCRIPTION
|
|
241
|
+
Resume a running test for an Agent.
|
|
242
|
+
|
|
243
|
+
Resume a running test for an Agent, providing the AiEvaluation ID.
|
|
244
|
+
|
|
245
|
+
EXAMPLES
|
|
246
|
+
Resume a test for an Agent:
|
|
247
|
+
|
|
248
|
+
$ sf agent test resume --job-id AiEvalId
|
|
249
|
+
|
|
250
|
+
FLAG DESCRIPTIONS
|
|
251
|
+
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the terminal window.
|
|
252
|
+
|
|
253
|
+
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
|
|
177
254
|
```
|
|
178
255
|
|
|
179
|
-
_See code: [src/commands/agent/test/
|
|
256
|
+
_See code: [src/commands/agent/test/resume.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/test/resume.ts)_
|
|
180
257
|
|
|
181
258
|
## `sf agent test run`
|
|
182
259
|
|
|
@@ -184,15 +261,18 @@ Start a test for an Agent.
|
|
|
184
261
|
|
|
185
262
|
```
|
|
186
263
|
USAGE
|
|
187
|
-
$ sf agent test run -o <value> -
|
|
264
|
+
$ sf agent test run -o <value> -n <value> [--json] [--flags-dir <value>] [--api-version <value>] [-w <value>]
|
|
265
|
+
[--result-format json|human]
|
|
188
266
|
|
|
189
267
|
FLAGS
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
268
|
+
-n, --name=<value> (required) The name of the AiEvaluationDefinition to start.
|
|
269
|
+
-o, --target-org=<value> (required) Username or alias of the target org. Not required if the `target-org`
|
|
270
|
+
configuration variable is already set.
|
|
271
|
+
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the
|
|
272
|
+
terminal window.
|
|
273
|
+
--api-version=<value> Override the api version used for api requests made by this command
|
|
274
|
+
--result-format=<option> [default: human] Format of the test run results.
|
|
275
|
+
<options: json|human>
|
|
196
276
|
|
|
197
277
|
GLOBAL FLAGS
|
|
198
278
|
--flags-dir=<value> Import flag values from a directory.
|
|
@@ -206,18 +286,18 @@ DESCRIPTION
|
|
|
206
286
|
EXAMPLES
|
|
207
287
|
Start a test for an Agent:
|
|
208
288
|
|
|
209
|
-
$ sf agent test run --
|
|
289
|
+
$ sf agent test run --name AiEvalDefVerId
|
|
210
290
|
|
|
211
291
|
FLAG DESCRIPTIONS
|
|
212
|
-
-
|
|
292
|
+
-n, --name=<value> The name of the AiEvaluationDefinition to start.
|
|
213
293
|
|
|
214
|
-
The
|
|
294
|
+
The name of the AiEvaluationDefinition to start.
|
|
215
295
|
|
|
216
296
|
-w, --wait=<value> Number of minutes to wait for the command to complete and display results to the terminal window.
|
|
217
297
|
|
|
218
298
|
If the command continues to run after the wait period, the CLI returns control of the terminal window to you.
|
|
219
299
|
```
|
|
220
300
|
|
|
221
|
-
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.
|
|
301
|
+
_See code: [src/commands/agent/test/run.ts](https://github.com/salesforcecli/plugin-agent/blob/1.4.0/src/commands/agent/test/run.ts)_
|
|
222
302
|
|
|
223
303
|
<!-- 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"}
|
|
@@ -20,7 +20,7 @@ const FLAGGABLE_PROMPTS = {
|
|
|
20
20
|
message: messages.getMessage('flags.type.summary'),
|
|
21
21
|
validate: (d) => d.length > 0 || 'Type cannot be empty',
|
|
22
22
|
char: 't',
|
|
23
|
-
options: ['
|
|
23
|
+
options: ['customer', 'internal'],
|
|
24
24
|
required: true,
|
|
25
25
|
},
|
|
26
26
|
role: {
|
|
@@ -129,7 +129,7 @@ export default class AgentCreateSpec extends SfCommand {
|
|
|
129
129
|
});
|
|
130
130
|
// Write a file with the returned job specs
|
|
131
131
|
const filePath = join(flags['output-dir'], flags['file-name']);
|
|
132
|
-
writeFileSync(filePath, JSON.stringify(agentSpec, null, 4));
|
|
132
|
+
writeFileSync(filePath, JSON.stringify({ type, role, companyName, companyDescription, companyWebsite, JobSpec: agentSpec }, null, 4));
|
|
133
133
|
this.spinner.stop();
|
|
134
134
|
this.log(`\nSaved agent spec: ${filePath}`);
|
|
135
135
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../../src/commands/agent/generate/spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAa,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAW,MAAM,oBAAoB,CAAC;AAEpD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;AAuB1F,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,oBAAoB,CAAC;Q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ACtF,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAEnD,IAAI,aAAa,EAAE,CAAC;YAClB,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YAE7F,OAAO,aAAa,CAAC;QACvB,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,MAAM,CAAC;gBACZ,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;gBAC5D,OAAO;gBACP,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;iBACxC;aACF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,aAAa,CAAC;YACnB,OAAO;YACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;aACxC;SACF,CAAC,CAAC;IACL,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,EA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AiB,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAEvG,IAAI,CAAC,GAAG,CAAC,yCAAyC,cAAc,EAAE,CAAC,CAAC;QAEpE,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,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,16 @@
|
|
|
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", import("@oclif/core/interfaces").CustomOptions>;
|
|
14
|
+
};
|
|
15
|
+
run(): Promise<AgentTestResultsResult>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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, humanFormat } from '@salesforce/agents';
|
|
10
|
+
import { resultFormatFlag } from '../../../flags.js';
|
|
11
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
12
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.results');
|
|
13
|
+
export default class AgentTestResults extends SfCommand {
|
|
14
|
+
static summary = messages.getMessage('summary');
|
|
15
|
+
static description = messages.getMessage('description');
|
|
16
|
+
static examples = messages.getMessages('examples');
|
|
17
|
+
static state = 'beta';
|
|
18
|
+
static flags = {
|
|
19
|
+
'target-org': Flags.requiredOrg(),
|
|
20
|
+
'api-version': Flags.orgApiVersion(),
|
|
21
|
+
'job-id': Flags.string({
|
|
22
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
23
|
+
char: 'i',
|
|
24
|
+
required: true,
|
|
25
|
+
}),
|
|
26
|
+
'result-format': resultFormatFlag(),
|
|
27
|
+
};
|
|
28
|
+
async run() {
|
|
29
|
+
const { flags } = await this.parse(AgentTestResults);
|
|
30
|
+
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
31
|
+
const response = await agentTester.details(flags['job-id']);
|
|
32
|
+
if (flags['result-format'] === 'human') {
|
|
33
|
+
this.log(await humanFormat(flags['job-id'], response));
|
|
34
|
+
}
|
|
35
|
+
return response;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=results.js.map
|
|
@@ -0,0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,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,IAAI,KAAK,CAAC,eAAe,CAAC,KAAK,OAAO,EAAE,CAAC;YACvC,IAAI,CAAC,GAAG,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
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", import("@oclif/core/interfaces").CustomOptions>;
|
|
18
|
+
};
|
|
19
|
+
run(): Promise<AgentTestResumeResult>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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, humanFormat } from '@salesforce/agents';
|
|
10
|
+
import { AgentTestCache } from '../../../agentTestCache.js';
|
|
11
|
+
import { TestStages } from '../../../testStages.js';
|
|
12
|
+
import { resultFormatFlag } from '../../../flags.js';
|
|
13
|
+
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
|
|
14
|
+
const messages = Messages.loadMessages('@salesforce/plugin-agent', 'agent.test.resume');
|
|
15
|
+
export default class AgentTestResume extends SfCommand {
|
|
16
|
+
static summary = messages.getMessage('summary');
|
|
17
|
+
static description = messages.getMessage('description');
|
|
18
|
+
static examples = messages.getMessages('examples');
|
|
19
|
+
static state = 'beta';
|
|
20
|
+
static flags = {
|
|
21
|
+
'target-org': Flags.requiredOrg(),
|
|
22
|
+
'api-version': Flags.orgApiVersion(),
|
|
23
|
+
'job-id': Flags.string({
|
|
24
|
+
char: 'i',
|
|
25
|
+
summary: messages.getMessage('flags.job-id.summary'),
|
|
26
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
27
|
+
}),
|
|
28
|
+
'use-most-recent': Flags.boolean({
|
|
29
|
+
char: 'r',
|
|
30
|
+
summary: messages.getMessage('flags.use-most-recent.summary'),
|
|
31
|
+
exactlyOne: ['use-most-recent', 'job-id'],
|
|
32
|
+
}),
|
|
33
|
+
wait: Flags.duration({
|
|
34
|
+
char: 'w',
|
|
35
|
+
unit: 'minutes',
|
|
36
|
+
min: 1,
|
|
37
|
+
defaultValue: 5,
|
|
38
|
+
summary: messages.getMessage('flags.wait.summary'),
|
|
39
|
+
description: messages.getMessage('flags.wait.description'),
|
|
40
|
+
}),
|
|
41
|
+
'result-format': resultFormatFlag(),
|
|
42
|
+
};
|
|
43
|
+
async run() {
|
|
44
|
+
const { flags } = await this.parse(AgentTestResume);
|
|
45
|
+
const agentTestCache = await AgentTestCache.create();
|
|
46
|
+
const { name, aiEvaluationId } = agentTestCache.useIdOrMostRecent(flags['job-id'], flags['use-most-recent']);
|
|
47
|
+
const mso = new TestStages({
|
|
48
|
+
title: `Agent Test Run: ${name ?? aiEvaluationId}`,
|
|
49
|
+
jsonEnabled: this.jsonEnabled(),
|
|
50
|
+
});
|
|
51
|
+
mso.start({ id: aiEvaluationId });
|
|
52
|
+
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
53
|
+
const { completed, response } = await mso.poll(agentTester, aiEvaluationId, flags.wait);
|
|
54
|
+
if (completed)
|
|
55
|
+
await agentTestCache.removeCacheEntry(aiEvaluationId);
|
|
56
|
+
mso.stop();
|
|
57
|
+
if (response && flags['result-format'] === 'human') {
|
|
58
|
+
this.log(await humanFormat(name ?? aiEvaluationId, response));
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
status: 'COMPLETED',
|
|
62
|
+
aiEvaluationId,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=resume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/resume.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,WAAW,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C,GAAG,CAAC,MAAM,WAAW,CAAC,IAAI,IAAI,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChE,CAAC;QAED,OAAO;YACL,MAAM,EAAE,WAAW;YACnB,cAAc;SACf,CAAC;IACJ,CAAC"}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
2
|
export type AgentTestRunResult = {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
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
|
-
|
|
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>;
|
|
17
|
-
'
|
|
16
|
+
'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "human", import("@oclif/core/interfaces").CustomOptions>;
|
|
18
17
|
};
|
|
19
18
|
run(): Promise<AgentTestRunResult>;
|
|
20
19
|
}
|