@hamp10/agentforge 0.2.45 → 0.2.46
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 +1 -1
- package/scripts/check-task-semantics.js +13 -0
- package/src/worker.js +21 -3
package/package.json
CHANGED
|
@@ -532,6 +532,14 @@ try {
|
|
|
532
532
|
/current repair strategy is not converging/i,
|
|
533
533
|
'repeated visual failures should force a strategy change instead of another micro-edit loop'
|
|
534
534
|
);
|
|
535
|
+
assert.match(
|
|
536
|
+
worker._formatVisualFailureFocusNudge(
|
|
537
|
+
'gamma-ai: Visual warning: target hero text is clipped.',
|
|
538
|
+
'Work on the Example.com listing pages for Alpha.ai, Beta.ai, and Gamma.ai. Delete and rebuild Alpha.ai and Beta.ai from a clean start, and fix Gamma.ai so all three are visually polished.'
|
|
539
|
+
),
|
|
540
|
+
/Keep other requested target page\(s\) intact[\s\S]*alpha-ai, beta-ai/i,
|
|
541
|
+
'visual-warning retries should focus on the failing target instead of recreating unrelated completed targets'
|
|
542
|
+
);
|
|
535
543
|
assert.match(
|
|
536
544
|
worker._buildScopedUiTargetSetNudge(baseline, message),
|
|
537
545
|
/one delivery set/i,
|
|
@@ -1177,6 +1185,11 @@ assert.match(
|
|
|
1177
1185
|
/_formatRepeatedVisualRepairNudge[\s\S]*current repair strategy is not converging/i,
|
|
1178
1186
|
'repeated visual failures should inject a generic strategy-change nudge'
|
|
1179
1187
|
);
|
|
1188
|
+
assert.match(
|
|
1189
|
+
workerSource,
|
|
1190
|
+
/_formatVisualFailureFocusNudge[\s\S]*Do not delete or recreate already-built target pages during a visual-warning repair/i,
|
|
1191
|
+
'visual-warning retries should preserve completed targets outside the failing page'
|
|
1192
|
+
);
|
|
1180
1193
|
assert.match(
|
|
1181
1194
|
workerSource,
|
|
1182
1195
|
/_formatUiVerificationFailureLogSummary[\s\S]*UI visual verification issue\(s\)/i,
|
package/src/worker.js
CHANGED
|
@@ -1476,6 +1476,21 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
1476
1476
|
].join('\n');
|
|
1477
1477
|
}
|
|
1478
1478
|
|
|
1479
|
+
_formatVisualFailureFocusNudge(output, userMessage) {
|
|
1480
|
+
const { slugs: allSlugs } = this._extractExplicitScope(userMessage);
|
|
1481
|
+
const failedSlugs = this._extractUiVerificationFailureSlugs(output, userMessage);
|
|
1482
|
+
if (allSlugs.length < 2 || failedSlugs.length === 0 || failedSlugs.length >= allSlugs.length) return '';
|
|
1483
|
+
const untouched = allSlugs.filter(slug => !failedSlugs.includes(slug));
|
|
1484
|
+
return [
|
|
1485
|
+
`Current visual verification warnings identify target page(s): ${failedSlugs.join(', ')}.`,
|
|
1486
|
+
untouched.length > 0
|
|
1487
|
+
? `Keep other requested target page(s) intact unless their own verification reports a concrete issue: ${untouched.join(', ')}.`
|
|
1488
|
+
: '',
|
|
1489
|
+
'If the original task included delete/rebuild or clean-start language, treat that as already satisfied for target files that now exist. Do not delete or recreate already-built target pages during a visual-warning repair unless the warning is for that same page.',
|
|
1490
|
+
'After fixing the failing target-owned structure, re-verify every requested target page locally before commit or completion.',
|
|
1491
|
+
].filter(Boolean).join('\n');
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1479
1494
|
_formatUiVerificationFailureLogSummary(nudge) {
|
|
1480
1495
|
const lines = String(nudge || '')
|
|
1481
1496
|
.split('\n')
|
|
@@ -4409,13 +4424,14 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4409
4424
|
const repairBudget = consumeUiRepairNudge('visual verification warnings', uiVerificationFailureNudge);
|
|
4410
4425
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4411
4426
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
|
|
4427
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4412
4428
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
|
|
4413
4429
|
if (nudgeCount < MAX_NUDGES) {
|
|
4414
4430
|
console.log(`[${taskId}] UI completion still had visual verification warnings — nudging (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
|
|
4415
4431
|
if (visualFailureSummary) {
|
|
4416
4432
|
console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
|
|
4417
4433
|
}
|
|
4418
|
-
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[uiVerificationFailureNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\nFix the visible UI issues, verify again with the browser, and only then end with ✓ TASK_COMPLETE.`);
|
|
4434
|
+
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[uiVerificationFailureNudge, visualFailureFocusNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\nFix the visible UI issues, verify again with the browser, and only then end with ✓ TASK_COMPLETE.`);
|
|
4419
4435
|
continue;
|
|
4420
4436
|
}
|
|
4421
4437
|
throw new Error('UI task claimed completion while visual verification still reported issues');
|
|
@@ -4681,13 +4697,14 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4681
4697
|
const repairBudget = consumeUiRepairNudge('publish visual verification warnings', uiVerificationFailureNudge);
|
|
4682
4698
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4683
4699
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
|
|
4700
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4684
4701
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
|
|
4685
4702
|
if (nudgeCount < MAX_NUDGES) {
|
|
4686
4703
|
console.log(`[${taskId}] Publish evidence still had visual verification warnings — continuing (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
|
|
4687
4704
|
if (visualFailureSummary) {
|
|
4688
4705
|
console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
|
|
4689
4706
|
}
|
|
4690
|
-
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[uiVerificationFailureNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\nContinue from the current repo state, fix the visible UI issues, verify again, then commit/push any additional changes before reporting delivery complete.`);
|
|
4707
|
+
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[uiVerificationFailureNudge, visualFailureFocusNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\nContinue from the current repo state, fix the visible UI issues, verify again, then commit/push any additional changes before reporting delivery complete.`);
|
|
4691
4708
|
continue;
|
|
4692
4709
|
}
|
|
4693
4710
|
throw new Error('Publish task still had visual verification issues after repeated retries');
|
|
@@ -4825,6 +4842,7 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4825
4842
|
);
|
|
4826
4843
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4827
4844
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiVerificationRetryCount);
|
|
4845
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4828
4846
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(visualVerificationFailureNudge);
|
|
4829
4847
|
nudgeCount = 0;
|
|
4830
4848
|
console.log(`[${taskId}] UI task visual verification still reported visible issues — retrying (${uiVerificationRetryCount}/${UI_REPAIR_NUDGE_LIMIT}, total UI repairs ${repairBudget})`);
|
|
@@ -4834,7 +4852,7 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4834
4852
|
const retryInstruction = generatedResetNudge
|
|
4835
4853
|
? 'Rebuild the removed target page file(s) from already-inspected project context and comparable existing pages. Do not reuse the rejected generated page as the basis for the next attempt. Address every requested target that is currently missing or changed in one coherent pass, fix the visible issues reported by local browser verification, reopen each edited target screen locally after the final edit, and only then end with ✓ TASK_COMPLETE.'
|
|
4836
4854
|
: 'Continue from the current changed files and latest browser evidence. Fix the visible issues reported by the local browser verification, reopen each edited target screen locally after the final edit, and only then end with ✓ TASK_COMPLETE.';
|
|
4837
|
-
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[visualVerificationFailureNudge, generatedResetNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\n${retryInstruction}`);
|
|
4855
|
+
iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[visualVerificationFailureNudge, visualFailureFocusNudge, generatedResetNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\n${retryInstruction}`);
|
|
4838
4856
|
} else if (hasMissingLocalUiVerification) {
|
|
4839
4857
|
uiVerificationRetryCount++;
|
|
4840
4858
|
const uiVerificationFailureDetails = this._extractUiVerificationFailureDetails(output);
|