agentxchain 2.155.49 → 2.155.50
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/package.json
CHANGED
|
@@ -499,6 +499,7 @@ function renderPrompt(role, roleId, turn, state, config, root) {
|
|
|
499
499
|
lines.push('- `proposed_next_role`: **REQUIRED**. Must be in allowed_next_roles for the current phase, or `"human"`.');
|
|
500
500
|
lines.push('- `decisions[].id`: pattern `DEC-NNN` where NNN is digits only (e.g. `DEC-001`, `DEC-002`). Do NOT use `D1`, `D2`, or freeform IDs.');
|
|
501
501
|
lines.push('- `decisions[].statement`: non-empty string describing the decision. Do NOT use `decision` or `description` as the field name — the field is `statement`.');
|
|
502
|
+
lines.push('- `decisions[].rationale`: REQUIRED non-empty string explaining why the decision was made. Do NOT omit this field.');
|
|
502
503
|
lines.push('- `decisions[].category`: one of `implementation`, `architecture`, `scope`, `process`, `quality`, `release`');
|
|
503
504
|
lines.push('- `objections[].id`: pattern `OBJ-NNN` where NNN is digits only (e.g. `OBJ-001`, `OBJ-002`). Do NOT append extra suffixes like `-M31` or use non-numeric characters after `OBJ-`.');
|
|
504
505
|
lines.push('- `objections[].severity`: one of `low`, `medium`, `high`, `blocking`');
|
|
@@ -1199,6 +1199,32 @@ export function normalizeTurnResult(tr, config, context = {}) {
|
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
|
+
// Normalize missing rationale from existing decision text. Do not invent
|
|
1203
|
+
// rationale when the decision object has no meaningful source material.
|
|
1204
|
+
const rationale = typeof patched.rationale === 'string' ? patched.rationale.trim() : '';
|
|
1205
|
+
if (!rationale) {
|
|
1206
|
+
const rationaleSources = [
|
|
1207
|
+
['reason', patched.reason],
|
|
1208
|
+
['why', patched.why],
|
|
1209
|
+
['description', patched.description],
|
|
1210
|
+
['decision', patched.decision],
|
|
1211
|
+
['statement', patched.statement],
|
|
1212
|
+
];
|
|
1213
|
+
const source = rationaleSources.find(([, value]) => typeof value === 'string' && value.trim());
|
|
1214
|
+
if (source) {
|
|
1215
|
+
const [srcField, srcValue] = source;
|
|
1216
|
+
const alt = srcValue.trim();
|
|
1217
|
+
corrections.push(`decisions[${index}].rationale: copied from ${srcField}`);
|
|
1218
|
+
normalizationEvents.push({
|
|
1219
|
+
field: `decisions[${index}].rationale`,
|
|
1220
|
+
original_value: patched.rationale ?? null,
|
|
1221
|
+
normalized_value: alt,
|
|
1222
|
+
rationale: `copied_from_${srcField}`,
|
|
1223
|
+
});
|
|
1224
|
+
patched = { ...patched, rationale: alt };
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1202
1228
|
// Default missing category to 'implementation'
|
|
1203
1229
|
if (!patched.category || !VALID_CATEGORIES.includes(patched.category)) {
|
|
1204
1230
|
const defaultCat = 'implementation';
|