@salesforce/plugin-agent 1.32.14 → 1.32.16
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 +47 -39
- package/lib/commands/agent/activate.d.ts +2 -0
- package/lib/commands/agent/activate.js +33 -4
- package/lib/commands/agent/activate.js.map +1 -1
- package/lib/commands/agent/deactivate.d.ts +2 -0
- package/lib/commands/agent/deactivate.js +33 -4
- package/lib/commands/agent/deactivate.js.map +1 -1
- package/lib/commands/agent/preview/end.d.ts +2 -0
- package/lib/commands/agent/preview/end.js +49 -12
- package/lib/commands/agent/preview/end.js.map +1 -1
- package/lib/commands/agent/preview/send.d.ts +2 -0
- package/lib/commands/agent/preview/send.js +47 -9
- package/lib/commands/agent/preview/send.js.map +1 -1
- package/lib/commands/agent/preview/sessions.d.ts +1 -0
- package/lib/commands/agent/preview/sessions.js +4 -1
- package/lib/commands/agent/preview/sessions.js.map +1 -1
- package/lib/commands/agent/preview/start.d.ts +3 -0
- package/lib/commands/agent/preview/start.js +72 -10
- package/lib/commands/agent/preview/start.js.map +1 -1
- package/lib/commands/agent/test/create.d.ts +2 -0
- package/lib/commands/agent/test/create.js +34 -6
- package/lib/commands/agent/test/create.js.map +1 -1
- package/lib/commands/agent/test/list.d.ts +2 -0
- package/lib/commands/agent/test/list.js +15 -3
- package/lib/commands/agent/test/list.js.map +1 -1
- package/lib/commands/agent/test/results.d.ts +2 -0
- package/lib/commands/agent/test/results.js +23 -3
- package/lib/commands/agent/test/results.js.map +1 -1
- package/lib/commands/agent/test/resume.d.ts +6 -0
- package/lib/commands/agent/test/resume.js +55 -7
- package/lib/commands/agent/test/resume.js.map +1 -1
- package/lib/commands/agent/test/run-eval.d.ts +2 -0
- package/lib/commands/agent/test/run-eval.js +38 -7
- package/lib/commands/agent/test/run-eval.js.map +1 -1
- package/lib/commands/agent/test/run.d.ts +2 -0
- package/lib/commands/agent/test/run.js +32 -8
- package/lib/commands/agent/test/run.js.map +1 -1
- package/lib/commands/agent/validate/authoring-bundle.d.ts +2 -0
- package/lib/commands/agent/validate/authoring-bundle.js +9 -2
- package/lib/commands/agent/validate/authoring-bundle.js.map +1 -1
- package/lib/previewSessionStore.js +0 -6
- package/lib/previewSessionStore.js.map +1 -1
- package/messages/agent.activate.md +8 -0
- package/messages/agent.deactivate.md +8 -0
- package/messages/agent.preview.end.md +18 -6
- package/messages/agent.preview.send.md +16 -4
- package/messages/agent.preview.start.md +31 -10
- package/oclif.manifest.json +372 -7
- package/package.json +3 -3
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
17
|
-
import { Messages } from '@salesforce/core';
|
|
16
|
+
import { SfCommand, Flags, toHelpSection } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { EnvironmentVariable, Messages, SfError } from '@salesforce/core';
|
|
18
18
|
import { AgentTester } from '@salesforce/agents';
|
|
19
19
|
import { AgentTestCache } from '../../../agentTestCache.js';
|
|
20
20
|
import { TestStages } from '../../../testStages.js';
|
|
@@ -26,6 +26,13 @@ export default class AgentTestResume extends SfCommand {
|
|
|
26
26
|
static summary = messages.getMessage('summary');
|
|
27
27
|
static description = messages.getMessage('description');
|
|
28
28
|
static examples = messages.getMessages('examples');
|
|
29
|
+
static envVariablesSection = toHelpSection('ENVIRONMENT VARIABLES', EnvironmentVariable.SF_TARGET_ORG);
|
|
30
|
+
static errorCodes = toHelpSection('ERROR CODES', {
|
|
31
|
+
'Succeeded (0)': 'Test completed successfully (with test results in the output).',
|
|
32
|
+
'Failed (1)': 'Tests encountered execution errors (test cases with ERROR status).',
|
|
33
|
+
'NotFound (2)': 'Job ID not found or invalid.',
|
|
34
|
+
'OperationFailed (4)': 'Failed to poll test due to API or network errors.',
|
|
35
|
+
});
|
|
29
36
|
static flags = {
|
|
30
37
|
'target-org': Flags.requiredOrg(),
|
|
31
38
|
'api-version': Flags.orgApiVersion(),
|
|
@@ -50,20 +57,51 @@ export default class AgentTestResume extends SfCommand {
|
|
|
50
57
|
'output-dir': testOutputDirFlag(),
|
|
51
58
|
verbose: verboseFlag,
|
|
52
59
|
};
|
|
60
|
+
mso;
|
|
53
61
|
async run() {
|
|
54
62
|
const { flags } = await this.parse(AgentTestResume);
|
|
55
63
|
const agentTestCache = await AgentTestCache.create();
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
let name;
|
|
65
|
+
let runId;
|
|
66
|
+
let outputDir;
|
|
67
|
+
let resultFormat;
|
|
68
|
+
try {
|
|
69
|
+
const cacheEntry = agentTestCache.useIdOrMostRecent(flags['job-id'], flags['use-most-recent']);
|
|
70
|
+
name = cacheEntry.name;
|
|
71
|
+
runId = cacheEntry.runId;
|
|
72
|
+
outputDir = cacheEntry.outputDir;
|
|
73
|
+
resultFormat = cacheEntry.resultFormat;
|
|
74
|
+
}
|
|
75
|
+
catch (e) {
|
|
76
|
+
const wrapped = SfError.wrap(e);
|
|
77
|
+
// Check for job not found
|
|
78
|
+
if (wrapped.message.toLowerCase().includes('not found') ||
|
|
79
|
+
wrapped.message.toLowerCase().includes('no test') ||
|
|
80
|
+
wrapped.message.toLowerCase().includes('invalid')) {
|
|
81
|
+
throw new SfError(`Job ID '${flags['job-id'] ?? 'most recent'}' not found.`, 'JobNotFound', [], 2, wrapped);
|
|
82
|
+
}
|
|
83
|
+
throw wrapped;
|
|
84
|
+
}
|
|
85
|
+
this.mso = new TestStages({
|
|
58
86
|
title: `Agent Test Run: ${name ?? runId}`,
|
|
59
87
|
jsonEnabled: this.jsonEnabled(),
|
|
60
88
|
});
|
|
61
|
-
mso.start({ id: runId });
|
|
89
|
+
this.mso.start({ id: runId });
|
|
62
90
|
const agentTester = new AgentTester(flags['target-org'].getConnection(flags['api-version']));
|
|
63
|
-
|
|
91
|
+
let completed;
|
|
92
|
+
let response;
|
|
93
|
+
try {
|
|
94
|
+
const pollResult = await this.mso.poll(agentTester, runId, flags.wait);
|
|
95
|
+
completed = pollResult.completed;
|
|
96
|
+
response = pollResult.response;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const wrapped = SfError.wrap(error);
|
|
100
|
+
throw new SfError(`Failed to poll test results: ${wrapped.message}`, 'TestPollFailed', [wrapped.message], 4, wrapped);
|
|
101
|
+
}
|
|
64
102
|
if (completed)
|
|
65
103
|
await agentTestCache.removeCacheEntry(runId);
|
|
66
|
-
mso.stop();
|
|
104
|
+
this.mso.stop();
|
|
67
105
|
await handleTestResults({
|
|
68
106
|
id: runId,
|
|
69
107
|
format: resultFormat ?? flags['result-format'],
|
|
@@ -72,7 +110,17 @@ export default class AgentTestResume extends SfCommand {
|
|
|
72
110
|
outputDir: outputDir ?? flags['output-dir'],
|
|
73
111
|
verbose: flags.verbose,
|
|
74
112
|
});
|
|
113
|
+
// Set exit code to 1 only for execution errors (tests couldn't run properly)
|
|
114
|
+
// Test assertion failures are business logic and should not affect exit code
|
|
115
|
+
if (response?.testCases.some((tc) => tc.status === 'ERROR')) {
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
}
|
|
118
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
75
119
|
return { ...response, runId, status: 'COMPLETED' };
|
|
76
120
|
}
|
|
121
|
+
catch(error) {
|
|
122
|
+
this.mso?.error();
|
|
123
|
+
return super.catch(error);
|
|
124
|
+
}
|
|
77
125
|
}
|
|
78
126
|
//# sourceMappingURL=resume.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/resume.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"resume.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/resume.ts"],"names":[],"mappings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gentTestRunEval extends SfCommand<RunEvalResult> {
|
|
|
20
20
|
static readonly examples: string[];
|
|
21
21
|
static state: string;
|
|
22
22
|
static readonly hidden = true;
|
|
23
|
+
static readonly envVariablesSection: import("@oclif/core").HelpSection;
|
|
24
|
+
static readonly errorCodes: import("@oclif/core").HelpSection;
|
|
23
25
|
static readonly flags: {
|
|
24
26
|
'target-org': import("@oclif/core/interfaces").OptionFlag<Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
25
27
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { readFile } from 'node:fs/promises';
|
|
17
|
-
import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
|
|
18
|
-
import { Messages } from '@salesforce/core';
|
|
17
|
+
import { Flags, SfCommand, toHelpSection } from '@salesforce/sf-plugins-core';
|
|
18
|
+
import { EnvironmentVariable, Messages, SfError } from '@salesforce/core';
|
|
19
19
|
import { normalizePayload, splitIntoBatches } from '../../../evalNormalizer.js';
|
|
20
20
|
import { formatResults } from '../../../evalFormatter.js';
|
|
21
21
|
import { resultFormatFlag } from '../../../flags.js';
|
|
@@ -110,6 +110,13 @@ export default class AgentTestRunEval extends SfCommand {
|
|
|
110
110
|
static examples = messages.getMessages('examples');
|
|
111
111
|
static state = 'beta';
|
|
112
112
|
static hidden = true;
|
|
113
|
+
static envVariablesSection = toHelpSection('ENVIRONMENT VARIABLES', EnvironmentVariable.SF_TARGET_ORG);
|
|
114
|
+
static errorCodes = toHelpSection('ERROR CODES', {
|
|
115
|
+
'Succeeded (0)': 'Tests completed successfully. Test results (passed/failed) are in the JSON output.',
|
|
116
|
+
'Failed (1)': "Tests encountered execution errors (tests couldn't run properly).",
|
|
117
|
+
'NotFound (2)': 'Agent not found, spec file not found, or invalid agent name.',
|
|
118
|
+
'OperationFailed (4)': 'Failed to execute tests due to API or network errors.',
|
|
119
|
+
});
|
|
113
120
|
static flags = {
|
|
114
121
|
'target-org': Flags.requiredOrg(),
|
|
115
122
|
'api-version': Flags.orgApiVersion(),
|
|
@@ -154,7 +161,13 @@ export default class AgentTestRunEval extends SfCommand {
|
|
|
154
161
|
}
|
|
155
162
|
catch {
|
|
156
163
|
// Not valid content, must be a file path - read it
|
|
157
|
-
|
|
164
|
+
try {
|
|
165
|
+
rawContent = await readFile(flags.spec, 'utf-8');
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
const wrapped = SfError.wrap(e);
|
|
169
|
+
throw new SfError(`Spec file not found: ${flags.spec}`, 'SpecFileNotFound', [], 2, wrapped);
|
|
170
|
+
}
|
|
158
171
|
}
|
|
159
172
|
// 2. Detect format and parse
|
|
160
173
|
let payload;
|
|
@@ -183,7 +196,17 @@ export default class AgentTestRunEval extends SfCommand {
|
|
|
183
196
|
}
|
|
184
197
|
// 3. If --api-name (or auto-inferred from YAML), resolve IDs and inject
|
|
185
198
|
if (agentApiName) {
|
|
186
|
-
|
|
199
|
+
let agentId;
|
|
200
|
+
let versionId;
|
|
201
|
+
try {
|
|
202
|
+
const resolved = await resolveAgent(org, agentApiName);
|
|
203
|
+
agentId = resolved.agentId;
|
|
204
|
+
versionId = resolved.versionId;
|
|
205
|
+
}
|
|
206
|
+
catch (e) {
|
|
207
|
+
const wrapped = SfError.wrap(e);
|
|
208
|
+
throw new SfError(`Agent '${agentApiName}' not found.`, 'AgentNotFound', [], 2, wrapped);
|
|
209
|
+
}
|
|
187
210
|
for (const test of payload.tests) {
|
|
188
211
|
for (const step of test.steps) {
|
|
189
212
|
if (step.type === 'agent.create_session') {
|
|
@@ -204,7 +227,14 @@ export default class AgentTestRunEval extends SfCommand {
|
|
|
204
227
|
// 6. Split into batches
|
|
205
228
|
const batches = splitIntoBatches(payload.tests, batchSize);
|
|
206
229
|
// 7. Execute batches
|
|
207
|
-
|
|
230
|
+
let allResults;
|
|
231
|
+
try {
|
|
232
|
+
allResults = await executeBatches(org, batches, (msg) => this.log(msg));
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
const wrapped = SfError.wrap(e);
|
|
236
|
+
throw new SfError(`Failed to execute tests: ${wrapped.message}`, 'TestExecutionFailed', [wrapped.message], 4, wrapped);
|
|
237
|
+
}
|
|
208
238
|
const mergedResponse = { results: allResults };
|
|
209
239
|
// 9. Format output
|
|
210
240
|
const resultFormat = (flags['result-format'] ?? 'human');
|
|
@@ -212,8 +242,9 @@ export default class AgentTestRunEval extends SfCommand {
|
|
|
212
242
|
this.log(formatted);
|
|
213
243
|
// 10. Build structured result for --json
|
|
214
244
|
const { summary, testSummaries } = buildResultSummary(mergedResponse);
|
|
215
|
-
// Set exit code to 1
|
|
216
|
-
|
|
245
|
+
// Set exit code to 1 only for execution errors (tests couldn't run)
|
|
246
|
+
// Test failures (assertions failed) are business logic and should not affect exit code
|
|
247
|
+
if (summary.errors > 0) {
|
|
217
248
|
process.exitCode = 1;
|
|
218
249
|
}
|
|
219
250
|
return { tests: testSummaries, summary };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-eval.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/run-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"run-eval.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/run-eval.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAO,OAAO,EAAE,MAA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AAG,CAAC,SAAS,CAAC,CAAC;QAEpB,yCAAyC;QACzC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;QAEtE,oEAAoE;QACpE,uFAAuF;QACvF,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;IAC3C,CAAC"}
|
|
@@ -6,6 +6,8 @@ export default class AgentTestRun extends SfCommand<AgentTestRunResult> {
|
|
|
6
6
|
static readonly summary: string;
|
|
7
7
|
static readonly description: string;
|
|
8
8
|
static readonly examples: string[];
|
|
9
|
+
static readonly envVariablesSection: import("@oclif/core").HelpSection;
|
|
10
|
+
static readonly errorCodes: import("@oclif/core").HelpSection;
|
|
9
11
|
static readonly flags: {
|
|
10
12
|
wait: import("@oclif/core/interfaces").OptionFlag<import("@salesforce/kit").Duration, import("@oclif/core/interfaces").CustomOptions>;
|
|
11
13
|
'result-format': import("@oclif/core/interfaces").OptionFlag<"json" | "human" | "junit" | "tap", import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
17
|
-
import { Messages, SfError } from '@salesforce/core';
|
|
16
|
+
import { SfCommand, Flags, toHelpSection } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { EnvironmentVariable, Messages, SfError } from '@salesforce/core';
|
|
18
18
|
import { AgentTester } from '@salesforce/agents';
|
|
19
19
|
import { colorize } from '@oclif/core/ux';
|
|
20
20
|
import { makeFlags, promptForAiEvaluationDefinitionApiName, resultFormatFlag, testOutputDirFlag, verboseFlag, } from '../../../flags.js';
|
|
@@ -48,6 +48,13 @@ export default class AgentTestRun extends SfCommand {
|
|
|
48
48
|
static summary = messages.getMessage('summary');
|
|
49
49
|
static description = messages.getMessage('description');
|
|
50
50
|
static examples = messages.getMessages('examples');
|
|
51
|
+
static envVariablesSection = toHelpSection('ENVIRONMENT VARIABLES', EnvironmentVariable.SF_TARGET_ORG);
|
|
52
|
+
static errorCodes = toHelpSection('ERROR CODES', {
|
|
53
|
+
'Succeeded (0)': 'Test started successfully (without --wait), or test completed successfully (with --wait).',
|
|
54
|
+
'Failed (1)': 'Tests encountered execution errors (test cases with ERROR status when using --wait).',
|
|
55
|
+
'NotFound (2)': 'Test definition not found or invalid test name.',
|
|
56
|
+
'OperationFailed (4)': 'Failed to start or poll test due to API or network errors.',
|
|
57
|
+
});
|
|
51
58
|
static flags = {
|
|
52
59
|
'target-org': Flags.requiredOrg(),
|
|
53
60
|
'api-version': Flags.orgApiVersion(),
|
|
@@ -81,18 +88,29 @@ export default class AgentTestRun extends SfCommand {
|
|
|
81
88
|
}
|
|
82
89
|
catch (e) {
|
|
83
90
|
const wrapped = SfError.wrap(e);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
];
|
|
91
|
+
// Check for test definition not found
|
|
92
|
+
if (wrapped.message.includes('Invalid AiEvalDefinitionVersion identifier') ||
|
|
93
|
+
wrapped.message.toLowerCase().includes('not found')) {
|
|
94
|
+
throw new SfError(`Test definition '${apiName}' not found.`, 'TestNotFound', [`Try running "sf agent test list -o ${flags['target-org'].getUsername() ?? ''}" to see available options`], 2, wrapped);
|
|
88
95
|
}
|
|
89
|
-
|
|
96
|
+
// API/network failures
|
|
97
|
+
throw new SfError(`Failed to start test: ${wrapped.message}`, 'TestStartFailed', [wrapped.message], 4, wrapped);
|
|
90
98
|
}
|
|
91
99
|
this.mso.update({ id: response.runId });
|
|
92
100
|
const agentTestCache = await AgentTestCache.create();
|
|
93
101
|
await agentTestCache.createCacheEntry(response.runId, apiName, flags['output-dir'], flags['result-format']);
|
|
94
102
|
if (flags.wait?.minutes) {
|
|
95
|
-
|
|
103
|
+
let completed;
|
|
104
|
+
let detailsResponse;
|
|
105
|
+
try {
|
|
106
|
+
const pollResult = await this.mso.poll(agentTester, response.runId, flags.wait);
|
|
107
|
+
completed = pollResult.completed;
|
|
108
|
+
detailsResponse = pollResult.response;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
const wrapped = SfError.wrap(error);
|
|
112
|
+
throw new SfError(`Failed to poll test results: ${wrapped.message}`, 'TestPollFailed', [wrapped.message], 4, wrapped);
|
|
113
|
+
}
|
|
96
114
|
if (completed)
|
|
97
115
|
await agentTestCache.removeCacheEntry(response.runId);
|
|
98
116
|
this.mso.stop();
|
|
@@ -104,6 +122,12 @@ export default class AgentTestRun extends SfCommand {
|
|
|
104
122
|
outputDir: flags['output-dir'],
|
|
105
123
|
verbose: flags.verbose,
|
|
106
124
|
});
|
|
125
|
+
// Set exit code to 1 only for execution errors (tests couldn't run properly)
|
|
126
|
+
// Test assertion failures are business logic and should not affect exit code
|
|
127
|
+
if (detailsResponse?.testCases.some((tc) => tc.status === 'ERROR')) {
|
|
128
|
+
process.exitCode = 1;
|
|
129
|
+
}
|
|
130
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
107
131
|
return { ...detailsResponse, status: 'COMPLETED', runId: response.runId };
|
|
108
132
|
}
|
|
109
133
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/commands/agent/test/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,6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AAK;gBAClB,MAAM,EAAE,KAAK,CAAC,eAAe,CAAC;gBAC9B,OAAO,EAAE,eAAe;gBACxB,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;gBAC/B,SAAS,EAAE,KAAK,CAAC,YAAY,CAAC;gBAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;YAEH,6EAA6E;YAC7E,6EAA6E;YAC7E,IAAI,eAAe,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,KAAK,OAAO,CAAC,EAAE,CAAC;gBACnE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;YACvB,CAAC;YAED,4EAA4E;YAC5E,OAAO,EAAE,GAAG,eAAgB,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC7E,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAChB,IAAI,CAAC,GAAG,CACN,OAAO,QAAQ,CAAC,KAAK,EAAE,iCAAiC,QAAQ,CAAC,KAAK,EAAE,CAAC,kCAAkC,CAC5G,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IAClD,CAAC;IAES,KAAK,CAAC,KAAiC;QAC/C,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC"}
|
|
@@ -8,6 +8,8 @@ export default class AgentValidateAuthoringBundle extends SfCommand<AgentValidat
|
|
|
8
8
|
static readonly description: string;
|
|
9
9
|
static readonly examples: string[];
|
|
10
10
|
static readonly requiresProject = true;
|
|
11
|
+
static readonly envVariablesSection: import("@oclif/core").HelpSection;
|
|
12
|
+
static readonly errorCodes: import("@oclif/core").HelpSection;
|
|
11
13
|
static readonly flags: {
|
|
12
14
|
'target-org': import("@oclif/core/interfaces").OptionFlag<import("@salesforce/core").Org, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
15
|
'api-version': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
|
|
17
|
-
import { Messages } from '@salesforce/core';
|
|
16
|
+
import { SfCommand, Flags, toHelpSection } from '@salesforce/sf-plugins-core';
|
|
17
|
+
import { EnvironmentVariable, Messages } from '@salesforce/core';
|
|
18
18
|
import { MultiStageOutput } from '@oclif/multi-stage-output';
|
|
19
19
|
import { Agent } from '@salesforce/agents';
|
|
20
20
|
import { colorize } from '@oclif/core/ux';
|
|
@@ -27,6 +27,13 @@ export default class AgentValidateAuthoringBundle extends SfCommand {
|
|
|
27
27
|
static description = messages.getMessage('description');
|
|
28
28
|
static examples = messages.getMessages('examples');
|
|
29
29
|
static requiresProject = true;
|
|
30
|
+
static envVariablesSection = toHelpSection('ENVIRONMENT VARIABLES', EnvironmentVariable.SF_TARGET_ORG);
|
|
31
|
+
static errorCodes = toHelpSection('ERROR CODES', {
|
|
32
|
+
'Succeeded (0)': 'Agent Script file compiled successfully without errors.',
|
|
33
|
+
'Failed (1)': 'Compilation errors found in the Agent Script file.',
|
|
34
|
+
'NotFound (2)': 'Validation/compilation API returned HTTP 404. The API endpoint may not be available in your org or region.',
|
|
35
|
+
'ServerError (3)': 'Validation/compilation API returned HTTP 500. A server error occurred during compilation.',
|
|
36
|
+
});
|
|
30
37
|
static flags = {
|
|
31
38
|
'target-org': Flags.requiredOrg(),
|
|
32
39
|
'api-version': Flags.orgApiVersion(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authoring-bundle.js","sourceRoot":"","sources":["../../../../src/commands/agent/validate/authoring-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"authoring-bundle.js","sourceRoot":"","sources":["../../../../src/commands/agent/validate/authoring-bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAmB,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,0BAA0B,EAAE,iCAAiC,CAAC,CAAC;AAOtG,MAAM,CAAC,OAAO,OAAO,4BAA6B,SAAQ,SAA6C;IAC9F,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,eAAe,GAAG,IAAI,CAAC;IAEvC,MAAM,CAAU,mBAAmB,GAAG,aAAa,CACxD,uBAAuB,EACvB,mBAAmB,CAAC,aAAa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,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAChC,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;YACxC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACtB,OAAO;gBACL,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,0FAA0F;QAC1F,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7E,GAAG,CAAC,KAAK,EAAE,CAAC;QAEZ,IAAI,CAAC,GAAG,CACN,QAAQ,CAAC,UAAU,CAAC,yBAAyB,EAAE;YAC7C,MAAM,CAAC,MAAM;iBACV,GAAG,CACF,CAAC,IAAI,EAAE,EAAE,CACP,KAAK,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,WAAW,QAAQ,IAAI,CAAC,SAAS,SAAS,IAAI,CAAC,QAAQ,GAAG,CAC3G;iBACA,IAAI,CAAC,IAAI,CAAC;SACd,CAAC,CACH,CAAC;QACF,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC"}
|
|
@@ -23,10 +23,8 @@ const SESSION_META_FILE = 'session-meta.json';
|
|
|
23
23
|
* Pass displayName (authoring bundle name or production agent API name) so "agent preview sessions" can show it.
|
|
24
24
|
*/
|
|
25
25
|
export async function createCache(agent, options) {
|
|
26
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
27
26
|
const historyDir = await agent.getHistoryDir();
|
|
28
27
|
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
29
|
-
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
30
28
|
const meta = { displayName: options?.displayName };
|
|
31
29
|
await writeFile(metaPath, JSON.stringify(meta), 'utf-8');
|
|
32
30
|
}
|
|
@@ -36,10 +34,8 @@ export async function createCache(agent, options) {
|
|
|
36
34
|
* Throws SfError if the session marker is not found.
|
|
37
35
|
*/
|
|
38
36
|
export async function validatePreviewSession(agent) {
|
|
39
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
40
37
|
const historyDir = await agent.getHistoryDir();
|
|
41
38
|
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
42
|
-
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
43
39
|
try {
|
|
44
40
|
await readFile(metaPath, 'utf-8');
|
|
45
41
|
}
|
|
@@ -52,10 +48,8 @@ export async function validatePreviewSession(agent) {
|
|
|
52
48
|
* Call after ending the session. Caller must set sessionId on the agent before calling.
|
|
53
49
|
*/
|
|
54
50
|
export async function removeCache(agent) {
|
|
55
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
56
51
|
const historyDir = await agent.getHistoryDir();
|
|
57
52
|
const metaPath = join(historyDir, SESSION_META_FILE);
|
|
58
|
-
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument */
|
|
59
53
|
try {
|
|
60
54
|
await unlink(metaPath);
|
|
61
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"previewSessionStore.js","sourceRoot":"","sources":["../src/previewSessionStore.ts"],"names":[],"mappings":"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,KAAK,CAAC,GAAG,CAAgB,CAAC;wBAC5C,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;oBACjC,CAAC;oBAAC,MAAM,CAAC;wBACP,SAAS;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,gCAAgC;YAClC,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;QAC9C,CAAC,CAAC,CACL,CAAC;QACF,MAAM,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,8BAA8B;IAChC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -31,3 +31,11 @@ Version number of the agent to activate; if not specified, the command provides
|
|
|
31
31
|
# error.missingRequiredFlags
|
|
32
32
|
|
|
33
33
|
Missing required flags: %s.
|
|
34
|
+
|
|
35
|
+
# error.agentNotFound
|
|
36
|
+
|
|
37
|
+
Agent '%s' not found in the org. Check that the API name is correct and that the agent exists.
|
|
38
|
+
|
|
39
|
+
# error.activationFailed
|
|
40
|
+
|
|
41
|
+
Failed to activate agent: %s
|
|
@@ -25,3 +25,11 @@ API name of the agent to deactivate; if not specified, the command provides a li
|
|
|
25
25
|
# error.missingRequiredFlags
|
|
26
26
|
|
|
27
27
|
Missing required flags: %s.
|
|
28
|
+
|
|
29
|
+
# error.agentNotFound
|
|
30
|
+
|
|
31
|
+
Agent '%s' not found in the org. Check that the API name is correct and that the agent exists.
|
|
32
|
+
|
|
33
|
+
# error.deactivationFailed
|
|
34
|
+
|
|
35
|
+
Failed to deactivate agent: %s
|
|
@@ -4,9 +4,9 @@ End an existing programmatic agent preview session and get trace location.
|
|
|
4
4
|
|
|
5
5
|
# description
|
|
6
6
|
|
|
7
|
-
You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.
|
|
7
|
+
You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to end it. This command also displays the local directory where the session trace files are stored.
|
|
8
8
|
|
|
9
|
-
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to end the session.
|
|
9
|
+
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to end the session. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.
|
|
10
10
|
|
|
11
11
|
# flags.session-id.summary
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Session ID outputted by "agent preview start". Not required when the agent has e
|
|
|
14
14
|
|
|
15
15
|
# flags.api-name.summary
|
|
16
16
|
|
|
17
|
-
API name of the activated published agent you want to preview.
|
|
17
|
+
API name of the activated published agent you want to preview.
|
|
18
18
|
|
|
19
19
|
# flags.authoring-bundle.summary
|
|
20
20
|
|
|
@@ -28,6 +28,18 @@ No agent preview session found. Run "sf agent preview start" to start a new agen
|
|
|
28
28
|
|
|
29
29
|
Multiple preview sessions found for this agent. Use the --session-id flag to identify a specific session. Sessions: %s
|
|
30
30
|
|
|
31
|
+
# error.agentNotFound
|
|
32
|
+
|
|
33
|
+
Agent '%s' not found. Check that the API name is correct and that the agent exists in your org or project.
|
|
34
|
+
|
|
35
|
+
# error.sessionInvalid
|
|
36
|
+
|
|
37
|
+
Preview session '%s' is invalid or has expired.
|
|
38
|
+
|
|
39
|
+
# error.endFailed
|
|
40
|
+
|
|
41
|
+
Failed to end preview session: %s
|
|
42
|
+
|
|
31
43
|
# output.tracesPath
|
|
32
44
|
|
|
33
45
|
Session traces: %s
|
|
@@ -36,12 +48,12 @@ Session traces: %s
|
|
|
36
48
|
|
|
37
49
|
- End a preview session of a published agent by specifying its session ID and API name ; use the default org:
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
<%= config.bin %> <%= command.id %> --session-id <SESSION_ID> --api-name My_Published_Agent
|
|
40
52
|
|
|
41
53
|
- Similar to previous example, but don't specify a session ID; you get an error if the published agent has more than one active session. Use the org with alias "my-dev-org":
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
<%= config.bin %> <%= command.id %> --api-name My_Published_Agent --target-org my-dev-org
|
|
44
56
|
|
|
45
57
|
- End a preview session of an agent using its authoring bundle API name; you get an error if the agent has more than one active session.
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
<%= config.bin %> <%= command.id %> --authoring-bundle My_Local_Agent
|
|
@@ -6,7 +6,7 @@ Send a message to an existing agent preview session.
|
|
|
6
6
|
|
|
7
7
|
You must have previously started a programmatic agent preview session with the "agent preview start" command to then use this command to send the agent a message (utterance). This command then displays the agent's response.
|
|
8
8
|
|
|
9
|
-
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to send a message.
|
|
9
|
+
The original "agent preview start" command outputs a session ID which you then use with the --session-id flag of this command to send a message. You don't have to specify the --session-id flag if an agent has only one active preview session. You must also use either the --authoring-bundle or --api-name flag to specify the API name of the authoring bundle or the published agent, respecitvely. To find either API name, navigate to your package directory in your DX project. The API name of an authoring bundle is the same as its directory name under the "aiAuthoringBundles" metadata directory. Similarly, the published agent's API name is the same as its directory name under the "Bots" metadata directory.
|
|
10
10
|
|
|
11
11
|
# flags.session-id.summary
|
|
12
12
|
|
|
@@ -32,16 +32,28 @@ No agent preview session found. Run "sf agent preview start" to start a new agen
|
|
|
32
32
|
|
|
33
33
|
Multiple preview sessions found for this agent. Use the --session-id flag to identify a specific session. Sessions: %s
|
|
34
34
|
|
|
35
|
+
# error.agentNotFound
|
|
36
|
+
|
|
37
|
+
Agent '%s' not found. Check that the API name is correct and that the agent exists in your org or project.
|
|
38
|
+
|
|
39
|
+
# error.sessionInvalid
|
|
40
|
+
|
|
41
|
+
Preview session '%s' is invalid or has expired. Start a new session with "sf agent preview start".
|
|
42
|
+
|
|
43
|
+
# error.sendFailed
|
|
44
|
+
|
|
45
|
+
Failed to send message to preview session: %s
|
|
46
|
+
|
|
35
47
|
# examples
|
|
36
48
|
|
|
37
49
|
- Send a message to an activated published agent using its API name and session ID; use the default org:
|
|
38
50
|
|
|
39
|
-
|
|
51
|
+
<%= config.bin %> <%= command.id %> --utterance "What can you help me with?" --api-name My_Published_Agent --session-id <SESSION_ID>
|
|
40
52
|
|
|
41
53
|
- Similar to previous example, but don't specify a session ID; you get an error if the agent has more than one active session. Use the org with alias "my-dev-org":
|
|
42
54
|
|
|
43
|
-
|
|
55
|
+
<%= config.bin %> <%= command.id %> --utterance "What can you help me with?" --api-name My_Published_Agent --target-org my-dev-org
|
|
44
56
|
|
|
45
57
|
- Send a message to an agent using its authoring bundle API name; you get an error if the agent has more than one active session:
|
|
46
58
|
|
|
47
|
-
|
|
59
|
+
<%= config.bin %> <%= command.id %> --utterance "what can you help me with?" --authoring-bundle My_Local_Agent
|