@salesforce/plugin-agent 1.36.1 → 1.37.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.
@@ -1,431 +0,0 @@
1
- /*
2
- * Copyright 2026, Salesforce, Inc.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- // --- Evaluator classification ---
17
- const SCORING_EVALUATORS = new Set([
18
- 'evaluator.text_alignment',
19
- 'evaluator.hallucination_detection',
20
- 'evaluator.citation_recall',
21
- 'evaluator.answer_faithfulness',
22
- ]);
23
- const ASSERTION_EVALUATORS = new Set(['evaluator.string_assertion', 'evaluator.json_assertion']);
24
- const DEFAULT_METRIC_NAMES = {
25
- 'evaluator.text_alignment': 'base.cosine_similarity',
26
- 'evaluator.hallucination_detection': 'hallucination_detection',
27
- 'evaluator.citation_recall': 'citation_recall',
28
- 'evaluator.answer_faithfulness': 'answer_faithfulness',
29
- };
30
- const SCORING_VALID_FIELDS = new Set([
31
- 'type',
32
- 'id',
33
- 'generated_output',
34
- 'reference_answer',
35
- 'metric_name',
36
- 'threshold',
37
- ]);
38
- const ASSERTION_VALID_FIELDS = new Set([
39
- 'type',
40
- 'id',
41
- 'actual',
42
- 'expected',
43
- 'operator',
44
- 'threshold',
45
- 'json_path',
46
- 'json_schema',
47
- 'metric_name',
48
- ]);
49
- const VALID_AGENT_FIELDS = {
50
- 'agent.create_session': new Set([
51
- 'type',
52
- 'id',
53
- 'agent_id',
54
- 'agent_version_id',
55
- 'use_agent_api',
56
- 'planner_id',
57
- 'state',
58
- 'setupSessionContext',
59
- 'context_variables',
60
- ]),
61
- 'agent.send_message': new Set(['type', 'id', 'session_id', 'utterance']),
62
- 'agent.get_state': new Set(['type', 'id', 'session_id']),
63
- };
64
- // --- Auto-correction maps ---
65
- const AGENT_CORRECTIONS = {
66
- agentId: 'agent_id',
67
- agentVersionId: 'agent_version_id',
68
- sessionId: 'session_id',
69
- text: 'utterance',
70
- message: 'utterance',
71
- input: 'utterance',
72
- prompt: 'utterance',
73
- user_message: 'utterance',
74
- userMessage: 'utterance',
75
- };
76
- const EVALUATOR_CORRECTIONS = {
77
- subject: 'actual',
78
- expectedValue: 'expected',
79
- expected_value: 'expected',
80
- actualValue: 'actual',
81
- actual_value: 'actual',
82
- assertionType: 'operator',
83
- assertion_type: 'operator',
84
- comparator: 'operator',
85
- };
86
- // --- camelCase alias maps for agent.create_session ---
87
- const AGENT_FIELD_ALIASES = {
88
- useAgentApi: 'use_agent_api',
89
- plannerId: 'planner_id',
90
- plannerDefinitionId: 'planner_id',
91
- planner_definition_id: 'planner_id',
92
- planner_version_id: 'planner_id',
93
- plannerVersionId: 'planner_id',
94
- };
95
- // --- Scoring evaluator field aliases ---
96
- const SCORING_FIELD_ALIASES = {
97
- actual: 'generated_output',
98
- expected: 'reference_answer',
99
- actual_value: 'generated_output',
100
- expected_value: 'reference_answer',
101
- actual_output: 'generated_output',
102
- expected_output: 'reference_answer',
103
- response: 'generated_output',
104
- ground_truth: 'reference_answer',
105
- };
106
- // --- Assertion evaluator field aliases ---
107
- const ASSERTION_FIELD_ALIASES = {
108
- actual_value: 'actual',
109
- expected_value: 'expected',
110
- generated_output: 'actual',
111
- reference_answer: 'expected',
112
- actual_output: 'actual',
113
- expected_output: 'expected',
114
- response: 'actual',
115
- ground_truth: 'expected',
116
- };
117
- // --- MCP shorthand field mapping ---
118
- // MCP uses `field: "gs1.planner_state.topic"` — map to Eval API `actual` with correct JSONPath
119
- const MCP_FIELD_MAP = {
120
- 'planner_state.topic': 'response.planner_response.lastExecution.topic',
121
- 'planner_state.invokedActions': 'response.planner_response.lastExecution.invokedActions',
122
- 'planner_state.actionsSequence': 'response.planner_response.lastExecution.invokedActions',
123
- response: 'response',
124
- 'response.messages': 'response',
125
- };
126
- // --- Main entry point ---
127
- /**
128
- * Apply all normalizations to a test payload.
129
- * Passes run in order: mcp-shorthand -> auto-correct -> camelCase -> evaluator fields -> shorthand refs -> defaults -> strip.
130
- */
131
- export function normalizePayload(payload) {
132
- const normalized = {
133
- tests: payload.tests.map((test) => {
134
- let steps = [...test.steps];
135
- steps = normalizeMcpShorthand(steps);
136
- steps = autoCorrectFields(steps);
137
- steps = normalizeCamelCase(steps);
138
- steps = normalizeEvaluatorFields(steps);
139
- steps = convertShorthandRefs(steps);
140
- steps = injectDefaults(steps);
141
- steps = stripUnrecognizedFields(steps);
142
- return { ...test, steps };
143
- }),
144
- };
145
- return normalized;
146
- }
147
- // --- Individual normalization passes ---
148
- /**
149
- * Convert MCP shorthand format to raw Eval API format.
150
- * MCP uses type="evaluator" + evaluator_type, raw API uses type="evaluator.xxx".
151
- * Also maps `field` to `actual` with proper JSONPath and auto-generates missing `id` fields.
152
- */
153
- export function normalizeMcpShorthand(steps) {
154
- let evalCounter = 0;
155
- return steps.map((step) => {
156
- const evaluator_type = step.evaluator_type;
157
- // Only applies to MCP shorthand: type="evaluator" with evaluator_type field
158
- if (step.type !== 'evaluator' || !evaluator_type)
159
- return step;
160
- const normalized = { ...step };
161
- // Merge type: "evaluator" + evaluator_type: "xxx" → type: "evaluator.xxx"
162
- normalized.type = `evaluator.${evaluator_type}`;
163
- delete normalized.evaluator_type;
164
- // Convert `field` to `actual` with proper shorthand ref format
165
- if ('field' in normalized) {
166
- if (!('actual' in normalized)) {
167
- const fieldValue = normalized.field;
168
- // Parse "gs1.planner_state.topic" → stepId="gs1", fieldPath="planner_state.topic"
169
- const dotIdx = fieldValue.indexOf('.');
170
- if (dotIdx > 0) {
171
- const stepId = fieldValue.substring(0, dotIdx);
172
- const fieldPath = fieldValue.substring(dotIdx + 1);
173
- const mappedPath = MCP_FIELD_MAP[fieldPath] ?? fieldPath;
174
- normalized.actual = `{${stepId}.${mappedPath}}`;
175
- }
176
- else {
177
- normalized.actual = fieldValue;
178
- }
179
- }
180
- delete normalized.field;
181
- }
182
- // Auto-generate id if missing
183
- if (!normalized.id || normalized.id === '') {
184
- normalized.id = `eval_${evalCounter}`;
185
- }
186
- evalCounter++;
187
- return normalized;
188
- });
189
- }
190
- /**
191
- * Auto-correct common field name mistakes.
192
- * Maps wrong field names to correct ones (agentId->agent_id, text->utterance, etc.)
193
- */
194
- export function autoCorrectFields(steps) {
195
- return steps.map((step) => {
196
- const corrected = { ...step };
197
- const stepType = corrected.type ?? '';
198
- if (stepType.startsWith('agent.')) {
199
- for (const [wrong, correct] of Object.entries(AGENT_CORRECTIONS)) {
200
- if (wrong in corrected && !(correct in corrected)) {
201
- corrected[correct] = corrected[wrong];
202
- delete corrected[wrong];
203
- }
204
- }
205
- }
206
- else if (stepType.startsWith('evaluator.')) {
207
- for (const [wrong, correct] of Object.entries(EVALUATOR_CORRECTIONS)) {
208
- if (wrong in corrected && !(correct in corrected)) {
209
- corrected[correct] = corrected[wrong];
210
- delete corrected[wrong];
211
- }
212
- }
213
- }
214
- return corrected;
215
- });
216
- }
217
- /**
218
- * Normalize camelCase agent field names to snake_case.
219
- * useAgentApi->use_agent_api, plannerDefinitionId->planner_id, etc.
220
- */
221
- export function normalizeCamelCase(steps) {
222
- return steps.map((step) => {
223
- if (step.type !== 'agent.create_session')
224
- return step;
225
- const normalized = { ...step };
226
- for (const [alias, canonical] of Object.entries(AGENT_FIELD_ALIASES)) {
227
- if (alias in normalized) {
228
- if (!(canonical in normalized)) {
229
- normalized[canonical] = normalized[alias];
230
- }
231
- delete normalized[alias];
232
- }
233
- }
234
- return normalized;
235
- });
236
- }
237
- /**
238
- * Apply field aliases: remap alias keys to canonical keys, removing duplicates.
239
- */
240
- function applyFieldAliases(step, aliases) {
241
- for (const [alias, canonical] of Object.entries(aliases)) {
242
- if (alias in step && !(canonical in step)) {
243
- step[canonical] = step[alias];
244
- delete step[alias];
245
- }
246
- else if (alias in step && canonical in step) {
247
- delete step[alias];
248
- }
249
- }
250
- }
251
- /**
252
- * Normalize a scoring evaluator step (field aliases + metric_name injection).
253
- */
254
- function normalizeScoringEvaluator(normalized, evalType) {
255
- applyFieldAliases(normalized, SCORING_FIELD_ALIASES);
256
- // Auto-inject or correct metric_name
257
- if (!('metric_name' in normalized)) {
258
- const defaultMetric = DEFAULT_METRIC_NAMES[evalType];
259
- if (defaultMetric) {
260
- normalized.metric_name = defaultMetric;
261
- }
262
- }
263
- else if (normalized.metric_name === evalType.split('.')[1]) {
264
- const defaultMetric = DEFAULT_METRIC_NAMES[evalType];
265
- if (defaultMetric) {
266
- normalized.metric_name = defaultMetric;
267
- }
268
- }
269
- }
270
- /**
271
- * Normalize an assertion evaluator step (field aliases + operator lowercase + metric_name).
272
- */
273
- function normalizeAssertionEvaluator(normalized, evalType) {
274
- applyFieldAliases(normalized, ASSERTION_FIELD_ALIASES);
275
- // Auto-lowercase operator
276
- if ('operator' in normalized && typeof normalized.operator === 'string') {
277
- normalized.operator = normalized.operator.toLowerCase();
278
- }
279
- // Auto-inject metric_name for assertion evaluators
280
- if (!('metric_name' in normalized)) {
281
- normalized.metric_name = evalType.split('.')[1];
282
- }
283
- }
284
- /**
285
- * Normalize evaluator field names based on evaluator category.
286
- * Maps actual/expected <-> generated_output/reference_answer.
287
- * Also auto-lowercases operator values and auto-injects metric_name.
288
- */
289
- export function normalizeEvaluatorFields(steps) {
290
- return steps.map((step) => {
291
- const evalType = step.type ?? '';
292
- if (!evalType.startsWith('evaluator.'))
293
- return step;
294
- const normalized = { ...step };
295
- if (SCORING_EVALUATORS.has(evalType)) {
296
- normalizeScoringEvaluator(normalized, evalType);
297
- }
298
- else if (ASSERTION_EVALUATORS.has(evalType)) {
299
- normalizeAssertionEvaluator(normalized, evalType);
300
- }
301
- // Don't inject metric_name for unknown evaluator types to avoid API validation errors
302
- // Unknown evaluators like bot_response_rating and planner_topic_assertion don't use metric_name
303
- return normalized;
304
- });
305
- }
306
- /**
307
- * Convert {step_id.field} shorthand references to JSONPath $.outputs[N].field.
308
- * Builds step_id->index mapping from non-evaluator steps.
309
- */
310
- export function convertShorthandRefs(steps) {
311
- // Build step_id -> output-array index mapping
312
- const stepIdToIdx = {};
313
- let outputIdx = 0;
314
- for (const step of steps) {
315
- const sid = step.id;
316
- const stype = step.type ?? '';
317
- if (sid && !stype.startsWith('evaluator.')) {
318
- stepIdToIdx[sid] = outputIdx;
319
- outputIdx += 1;
320
- }
321
- }
322
- const refPattern = /\{([^}]+)\}/g;
323
- function replaceValue(value) {
324
- if (typeof value !== 'string')
325
- return value;
326
- return value.replace(refPattern, (match, ref) => {
327
- const dotIdx = ref.indexOf('.');
328
- if (dotIdx < 0)
329
- return match;
330
- const sid = ref.substring(0, dotIdx);
331
- let field = ref.substring(dotIdx + 1);
332
- if (!(sid in stepIdToIdx))
333
- return match;
334
- const idx = stepIdToIdx[sid];
335
- // Normalize legacy nested-response path to flat response
336
- if (field.startsWith('response.messages')) {
337
- field = 'response';
338
- }
339
- return `$.outputs[${idx}].${field}`;
340
- });
341
- }
342
- return steps.map((step) => {
343
- const newStep = {};
344
- for (const [key, val] of Object.entries(step)) {
345
- if (typeof val === 'string') {
346
- newStep[key] = replaceValue(val);
347
- }
348
- else if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
349
- const newObj = {};
350
- for (const [k, v] of Object.entries(val)) {
351
- newObj[k] = typeof v === 'string' ? replaceValue(v) : v;
352
- }
353
- newStep[key] = newObj;
354
- }
355
- else if (Array.isArray(val)) {
356
- newStep[key] = val.map((item) => typeof item === 'string' ? replaceValue(item) : item);
357
- }
358
- else {
359
- newStep[key] = val;
360
- }
361
- }
362
- return newStep;
363
- });
364
- }
365
- /**
366
- * Inject default values:
367
- * - use_agent_api=true on agent.create_session if neither use_agent_api nor planner_id present
368
- */
369
- export function injectDefaults(steps) {
370
- return steps.map((step) => {
371
- if (step.type === 'agent.create_session') {
372
- if (!('use_agent_api' in step) && !('planner_id' in step)) {
373
- return { ...step, use_agent_api: true };
374
- }
375
- }
376
- return step;
377
- });
378
- }
379
- /**
380
- * Strip unrecognized fields from steps based on type-specific whitelists.
381
- */
382
- export function stripUnrecognizedFields(steps) {
383
- return steps.map((step) => {
384
- const stepType = step.type ?? '';
385
- // Agent steps
386
- if (stepType in VALID_AGENT_FIELDS) {
387
- const validFields = VALID_AGENT_FIELDS[stepType];
388
- const stripped = {};
389
- for (const [key, val] of Object.entries(step)) {
390
- if (validFields.has(key)) {
391
- stripped[key] = val;
392
- }
393
- }
394
- return stripped;
395
- }
396
- // Scoring evaluators
397
- if (SCORING_EVALUATORS.has(stepType)) {
398
- const stripped = {};
399
- for (const [key, val] of Object.entries(step)) {
400
- if (SCORING_VALID_FIELDS.has(key)) {
401
- stripped[key] = val;
402
- }
403
- }
404
- return stripped;
405
- }
406
- // Assertion evaluators
407
- if (ASSERTION_EVALUATORS.has(stepType)) {
408
- const stripped = {};
409
- for (const [key, val] of Object.entries(step)) {
410
- if (ASSERTION_VALID_FIELDS.has(key)) {
411
- stripped[key] = val;
412
- }
413
- }
414
- return stripped;
415
- }
416
- // Unknown types: don't strip (to avoid breaking future evaluator types)
417
- return step;
418
- });
419
- }
420
- // --- Batch splitting ---
421
- /**
422
- * Split tests array into chunks of batchSize.
423
- */
424
- export function splitIntoBatches(tests, batchSize) {
425
- const batches = [];
426
- for (let i = 0; i < tests.length; i += batchSize) {
427
- batches.push(tests.slice(i, i + batchSize));
428
- }
429
- return batches;
430
- }
431
- //# sourceMappingURL=evalNormalizer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"evalNormalizer.js","sourceRoot":"","sources":["../src/evalNormalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAqBH,mCAAmC;AAEnC,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IACjC,0BAA0B;IAC1B,mCA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,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9C,IAAI,oBAAoB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBAClC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;gBACtB,CAAC;YACH,CAAC;YACD,OAAO,QAAoB,CAAC;QAC9B,CAAC;QAED,uBAAuB;QACvB,IAAI,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,MAAM,QAAQ,GAA4B,EAAE,CAAC;YAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC9C,IAAI,sBAAsB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;oBACpC,QAAQ,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;gBACtB,CAAC;YACH,CAAC;YACD,OAAO,QAAoB,CAAC;QAC9B,CAAC;QAED,wEAAwE;QACxE,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC;AAED,0BAA0B;AAE1B;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAiB,EAAE,SAAiB;IACnE,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -1,20 +0,0 @@
1
- import type { TestSpec, TestCase } from '@salesforce/agents';
2
- import type { EvalPayload, EvalTest } from './evalNormalizer.js';
3
- /**
4
- * Returns true if the content looks like a YAML TestSpec (has testCases + subjectName).
5
- * Returns false for JSON EvalPayload, invalid content, or YAML missing required fields.
6
- */
7
- export declare function isYamlTestSpec(content: string): boolean;
8
- /**
9
- * Parse a YAML string into a TestSpec.
10
- * Throws if the content is not valid YAML or is missing required fields.
11
- */
12
- export declare function parseTestSpec(content: string): TestSpec;
13
- /**
14
- * Translate a full TestSpec into an EvalPayload.
15
- */
16
- export declare function translateTestSpec(spec: TestSpec): EvalPayload;
17
- /**
18
- * Translate a single TestCase into an EvalTest with ordered steps.
19
- */
20
- export declare function translateTestCase(testCase: TestCase, index: number, specName?: string): EvalTest;