agentxchain 2.155.58 → 2.155.60
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
|
@@ -7039,14 +7039,7 @@ function evaluateIntentCoverage(turnResult, intakeContext, { state = null, confi
|
|
|
7039
7039
|
}
|
|
7040
7040
|
|
|
7041
7041
|
// Build a searchable corpus from the turn result for semantic fallback
|
|
7042
|
-
const corpus =
|
|
7043
|
-
turnResult.summary || '',
|
|
7044
|
-
...(turnResult.decisions || []).map(d => `${d.statement || ''} ${d.rationale || ''}`),
|
|
7045
|
-
...(turnResult.objections || []).map(o => o.statement || ''),
|
|
7046
|
-
...(turnResult.files_changed || []),
|
|
7047
|
-
...(turnResult.artifacts_created || []),
|
|
7048
|
-
...(Array.isArray(turnResult.intent_response) ? turnResult.intent_response.map(r => `${r.item || ''} ${r.detail || ''}`) : []),
|
|
7049
|
-
].join('\n').toLowerCase();
|
|
7042
|
+
const corpus = buildIntentCoverageCorpus(turnResult);
|
|
7050
7043
|
|
|
7051
7044
|
for (const item of acceptanceItems) {
|
|
7052
7045
|
const normalizedItem = item.toLowerCase().trim();
|
|
@@ -7085,7 +7078,7 @@ function evaluateIntentCoverage(turnResult, intakeContext, { state = null, confi
|
|
|
7085
7078
|
}
|
|
7086
7079
|
|
|
7087
7080
|
// Check 2: Semantic fallback — significant keyword overlap
|
|
7088
|
-
const words = normalizedItem
|
|
7081
|
+
const words = tokenizeIntentCoverageText(normalizedItem).filter(w => w.length > 3);
|
|
7089
7082
|
if (words.length === 0) {
|
|
7090
7083
|
addressed.push(item);
|
|
7091
7084
|
continue;
|
|
@@ -7204,16 +7197,7 @@ function evaluateRoadmapDerivedConditionalCoverage(item, turnResult, intakeConte
|
|
|
7204
7197
|
const milestoneId = sectionMatch[1].toLowerCase();
|
|
7205
7198
|
|
|
7206
7199
|
// Build a searchable corpus from the turn result
|
|
7207
|
-
const corpus =
|
|
7208
|
-
turnResult.summary || '',
|
|
7209
|
-
...(turnResult.decisions || []).map(d => `${d.statement || ''} ${d.rationale || ''}`),
|
|
7210
|
-
...(turnResult.objections || []).map(o => o.statement || ''),
|
|
7211
|
-
...(turnResult.files_changed || []),
|
|
7212
|
-
...(turnResult.artifacts_created || []),
|
|
7213
|
-
...(Array.isArray(turnResult.intent_response)
|
|
7214
|
-
? turnResult.intent_response.map(r => `${r.item || ''} ${r.detail || ''}`)
|
|
7215
|
-
: []),
|
|
7216
|
-
].join('\n').toLowerCase();
|
|
7200
|
+
const corpus = buildIntentCoverageCorpus(turnResult);
|
|
7217
7201
|
|
|
7218
7202
|
// If the turn mentions the milestone section ID, the item is addressed
|
|
7219
7203
|
return corpus.includes(milestoneId);
|
|
@@ -7244,16 +7228,7 @@ function evaluateRoadmapReplenishmentConditionalCoverage(item, turnResult, intak
|
|
|
7244
7228
|
return null;
|
|
7245
7229
|
}
|
|
7246
7230
|
|
|
7247
|
-
const corpus =
|
|
7248
|
-
turnResult.summary || '',
|
|
7249
|
-
...(turnResult.decisions || []).map(d => `${d.statement || ''} ${d.rationale || ''}`),
|
|
7250
|
-
...(turnResult.objections || []).map(o => o.statement || ''),
|
|
7251
|
-
...(turnResult.files_changed || []),
|
|
7252
|
-
...(turnResult.artifacts_created || []),
|
|
7253
|
-
...(Array.isArray(turnResult.intent_response)
|
|
7254
|
-
? turnResult.intent_response.map(r => `${r.item || ''} ${r.detail || ''}`)
|
|
7255
|
-
: []),
|
|
7256
|
-
].join('\n').toLowerCase();
|
|
7231
|
+
const corpus = buildIntentCoverageCorpus(turnResult);
|
|
7257
7232
|
|
|
7258
7233
|
if (!corpus.includes('vision.md')) {
|
|
7259
7234
|
return false;
|
|
@@ -7275,6 +7250,40 @@ function evaluateRoadmapReplenishmentConditionalCoverage(item, turnResult, intak
|
|
|
7275
7250
|
return sectionNames.some((section) => corpus.includes(section));
|
|
7276
7251
|
}
|
|
7277
7252
|
|
|
7253
|
+
function buildIntentCoverageCorpus(turnResult) {
|
|
7254
|
+
const verification = turnResult?.verification && typeof turnResult.verification === 'object'
|
|
7255
|
+
? turnResult.verification
|
|
7256
|
+
: {};
|
|
7257
|
+
const machineEvidenceText = Array.isArray(verification.machine_evidence)
|
|
7258
|
+
? verification.machine_evidence.map((entry) => {
|
|
7259
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) return '';
|
|
7260
|
+
return Object.values(entry).map((value) => {
|
|
7261
|
+
if (typeof value === 'string') return value;
|
|
7262
|
+
if (Array.isArray(value)) return value.join(' ');
|
|
7263
|
+
if (value && typeof value === 'object') return JSON.stringify(value);
|
|
7264
|
+
return '';
|
|
7265
|
+
}).join(' ');
|
|
7266
|
+
})
|
|
7267
|
+
: [];
|
|
7268
|
+
|
|
7269
|
+
return [
|
|
7270
|
+
turnResult.summary || '',
|
|
7271
|
+
...(turnResult.decisions || []).map(d => `${d.statement || ''} ${d.rationale || ''}`),
|
|
7272
|
+
...(turnResult.objections || []).map(o => o.statement || ''),
|
|
7273
|
+
...(turnResult.files_changed || []),
|
|
7274
|
+
...(turnResult.artifacts_created || []),
|
|
7275
|
+
verification.evidence_summary || '',
|
|
7276
|
+
...machineEvidenceText,
|
|
7277
|
+
...(Array.isArray(turnResult.intent_response) ? turnResult.intent_response.map(r => `${r.item || ''} ${r.detail || ''}`) : []),
|
|
7278
|
+
].join('\n').toLowerCase();
|
|
7279
|
+
}
|
|
7280
|
+
|
|
7281
|
+
function tokenizeIntentCoverageText(value) {
|
|
7282
|
+
return String(value || '')
|
|
7283
|
+
.toLowerCase()
|
|
7284
|
+
.match(/[a-z0-9]+/g) || [];
|
|
7285
|
+
}
|
|
7286
|
+
|
|
7278
7287
|
export {
|
|
7279
7288
|
STATE_PATH,
|
|
7280
7289
|
HISTORY_PATH,
|
|
@@ -1421,6 +1421,47 @@ export function normalizeTurnResult(tr, config, context = {}) {
|
|
|
1421
1421
|
}
|
|
1422
1422
|
}
|
|
1423
1423
|
|
|
1424
|
+
// ── BUG-106: auto-declare expected_exit_code when verification.status is "pass" ──
|
|
1425
|
+
// When verification.status is "pass" but some machine_evidence commands have
|
|
1426
|
+
// non-zero exit codes without expected_exit_code, the agent clearly intended
|
|
1427
|
+
// those failures (e.g. testing error handling). Auto-set expected_exit_code to
|
|
1428
|
+
// match exit_code so the Stage D validator passes. This is safe because the
|
|
1429
|
+
// agent explicitly declared the overall verification as passing.
|
|
1430
|
+
if (
|
|
1431
|
+
normalized.verification
|
|
1432
|
+
&& typeof normalized.verification === 'object'
|
|
1433
|
+
&& !Array.isArray(normalized.verification)
|
|
1434
|
+
&& normalized.verification.status === 'pass'
|
|
1435
|
+
&& Array.isArray(normalized.verification.machine_evidence)
|
|
1436
|
+
) {
|
|
1437
|
+
const patchedEvidence = [];
|
|
1438
|
+
let anyPatched = false;
|
|
1439
|
+
normalized.verification.machine_evidence.forEach((entry, index) => {
|
|
1440
|
+
if (
|
|
1441
|
+
entry
|
|
1442
|
+
&& typeof entry === 'object'
|
|
1443
|
+
&& typeof entry.exit_code === 'number'
|
|
1444
|
+
&& entry.exit_code !== 0
|
|
1445
|
+
&& !Number.isInteger(entry.expected_exit_code)
|
|
1446
|
+
) {
|
|
1447
|
+
patchedEvidence.push({ ...entry, expected_exit_code: entry.exit_code });
|
|
1448
|
+
anyPatched = true;
|
|
1449
|
+
corrections.push(`verification.machine_evidence[${index}].expected_exit_code: set to ${entry.exit_code} (verification.status is "pass")`);
|
|
1450
|
+
normalizationEvents.push({
|
|
1451
|
+
field: `verification.machine_evidence[${index}].expected_exit_code`,
|
|
1452
|
+
original_value: null,
|
|
1453
|
+
normalized_value: entry.exit_code,
|
|
1454
|
+
rationale: 'verification_pass_expected_exit_code_inferred',
|
|
1455
|
+
});
|
|
1456
|
+
} else {
|
|
1457
|
+
patchedEvidence.push(entry);
|
|
1458
|
+
}
|
|
1459
|
+
});
|
|
1460
|
+
if (anyPatched) {
|
|
1461
|
+
normalized.verification = { ...normalized.verification, machine_evidence: patchedEvidence };
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1424
1465
|
// ── BUG-90: normalize missing artifact.type ─────────────────────────
|
|
1425
1466
|
if (
|
|
1426
1467
|
normalized.artifact
|