@hamp10/agentforge 0.2.45 → 0.2.47
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 +32 -0
- package/src/worker.js +41 -3
package/package.json
CHANGED
|
@@ -532,6 +532,33 @@ 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
|
+
);
|
|
543
|
+
const focusedRepairLead = worker._formatVisualRepairTaskLead(
|
|
544
|
+
'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.',
|
|
545
|
+
'gamma-ai: Visual warning: target hero text is clipped.'
|
|
546
|
+
);
|
|
547
|
+
assert.match(
|
|
548
|
+
focusedRepairLead,
|
|
549
|
+
/visual repair pass for currently failing target page\(s\): gamma-ai/i,
|
|
550
|
+
'focused visual repair retries should name the failing target set'
|
|
551
|
+
);
|
|
552
|
+
assert.match(
|
|
553
|
+
focusedRepairLead,
|
|
554
|
+
/Do not repeat initial delete\/rebuild\/reset\/setup work[\s\S]*alpha-ai, beta-ai/i,
|
|
555
|
+
'focused visual repair retries should not replay clean-start work for already-built non-failing targets'
|
|
556
|
+
);
|
|
557
|
+
assert.doesNotMatch(
|
|
558
|
+
focusedRepairLead,
|
|
559
|
+
/The task is:|Delete and rebuild Alpha\.ai/i,
|
|
560
|
+
'focused visual repair retries should not put the original reset-heavy task text at the top of the retry prompt'
|
|
561
|
+
);
|
|
535
562
|
assert.match(
|
|
536
563
|
worker._buildScopedUiTargetSetNudge(baseline, message),
|
|
537
564
|
/one delivery set/i,
|
|
@@ -1177,6 +1204,11 @@ assert.match(
|
|
|
1177
1204
|
/_formatRepeatedVisualRepairNudge[\s\S]*current repair strategy is not converging/i,
|
|
1178
1205
|
'repeated visual failures should inject a generic strategy-change nudge'
|
|
1179
1206
|
);
|
|
1207
|
+
assert.match(
|
|
1208
|
+
workerSource,
|
|
1209
|
+
/_formatVisualFailureFocusNudge[\s\S]*Do not delete or recreate already-built target pages during a visual-warning repair/i,
|
|
1210
|
+
'visual-warning retries should preserve completed targets outside the failing page'
|
|
1211
|
+
);
|
|
1180
1212
|
assert.match(
|
|
1181
1213
|
workerSource,
|
|
1182
1214
|
/_formatUiVerificationFailureLogSummary[\s\S]*UI visual verification issue\(s\)/i,
|
package/src/worker.js
CHANGED
|
@@ -1476,6 +1476,38 @@ 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
|
+
|
|
1494
|
+
_formatVisualRepairTaskLead(userMessage, output) {
|
|
1495
|
+
const { slugs: allSlugs } = this._extractExplicitScope(userMessage);
|
|
1496
|
+
const failedSlugs = this._extractUiVerificationFailureSlugs(output, userMessage);
|
|
1497
|
+
if (allSlugs.length >= 2 && failedSlugs.length > 0 && failedSlugs.length < allSlugs.length) {
|
|
1498
|
+
const preservedSlugs = allSlugs.filter(slug => !failedSlugs.includes(slug));
|
|
1499
|
+
return [
|
|
1500
|
+
`Original scoped UI target set: ${allSlugs.join(', ')}.`,
|
|
1501
|
+
`This retry is a visual repair pass for currently failing target page(s): ${failedSlugs.join(', ')}.`,
|
|
1502
|
+
preservedSlugs.length > 0
|
|
1503
|
+
? `Do not repeat initial delete/rebuild/reset/setup work for target page(s) not currently failing: ${preservedSlugs.join(', ')}.`
|
|
1504
|
+
: '',
|
|
1505
|
+
'Continue from the current repo state and change only files needed to repair the failing target page(s), then re-verify every requested target page locally before completion or delivery.',
|
|
1506
|
+
].filter(Boolean).join('\n');
|
|
1507
|
+
}
|
|
1508
|
+
return `The task is: "${userMessage}"`;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1479
1511
|
_formatUiVerificationFailureLogSummary(nudge) {
|
|
1480
1512
|
const lines = String(nudge || '')
|
|
1481
1513
|
.split('\n')
|
|
@@ -4409,13 +4441,15 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4409
4441
|
const repairBudget = consumeUiRepairNudge('visual verification warnings', uiVerificationFailureNudge);
|
|
4410
4442
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4411
4443
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
|
|
4444
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4445
|
+
const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
|
|
4412
4446
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
|
|
4413
4447
|
if (nudgeCount < MAX_NUDGES) {
|
|
4414
4448
|
console.log(`[${taskId}] UI completion still had visual verification warnings — nudging (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
|
|
4415
4449
|
if (visualFailureSummary) {
|
|
4416
4450
|
console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
|
|
4417
4451
|
}
|
|
4418
|
-
iterationMessage = withTaskContext(
|
|
4452
|
+
iterationMessage = withTaskContext(`${visualRepairTaskLead}\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
4453
|
continue;
|
|
4420
4454
|
}
|
|
4421
4455
|
throw new Error('UI task claimed completion while visual verification still reported issues');
|
|
@@ -4681,13 +4715,15 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4681
4715
|
const repairBudget = consumeUiRepairNudge('publish visual verification warnings', uiVerificationFailureNudge);
|
|
4682
4716
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4683
4717
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
|
|
4718
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4719
|
+
const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
|
|
4684
4720
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
|
|
4685
4721
|
if (nudgeCount < MAX_NUDGES) {
|
|
4686
4722
|
console.log(`[${taskId}] Publish evidence still had visual verification warnings — continuing (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
|
|
4687
4723
|
if (visualFailureSummary) {
|
|
4688
4724
|
console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
|
|
4689
4725
|
}
|
|
4690
|
-
iterationMessage = withTaskContext(
|
|
4726
|
+
iterationMessage = withTaskContext(`${visualRepairTaskLead}\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
4727
|
continue;
|
|
4692
4728
|
}
|
|
4693
4729
|
throw new Error('Publish task still had visual verification issues after repeated retries');
|
|
@@ -4825,6 +4861,8 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4825
4861
|
);
|
|
4826
4862
|
const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
|
|
4827
4863
|
const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiVerificationRetryCount);
|
|
4864
|
+
const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
|
|
4865
|
+
const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
|
|
4828
4866
|
const visualFailureSummary = this._formatUiVerificationFailureLogSummary(visualVerificationFailureNudge);
|
|
4829
4867
|
nudgeCount = 0;
|
|
4830
4868
|
console.log(`[${taskId}] UI task visual verification still reported visible issues — retrying (${uiVerificationRetryCount}/${UI_REPAIR_NUDGE_LIMIT}, total UI repairs ${repairBudget})`);
|
|
@@ -4834,7 +4872,7 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
4834
4872
|
const retryInstruction = generatedResetNudge
|
|
4835
4873
|
? '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
4874
|
: '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(
|
|
4875
|
+
iterationMessage = withTaskContext(`${visualRepairTaskLead}\n\n${[visualVerificationFailureNudge, visualFailureFocusNudge, generatedResetNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\n${retryInstruction}`);
|
|
4838
4876
|
} else if (hasMissingLocalUiVerification) {
|
|
4839
4877
|
uiVerificationRetryCount++;
|
|
4840
4878
|
const uiVerificationFailureDetails = this._extractUiVerificationFailureDetails(output);
|