@hamp10/agentforge 0.2.46 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hamp10/agentforge",
3
- "version": "0.2.46",
3
+ "version": "0.2.47",
4
4
  "description": "AgentForge worker — connect your machine to agentforge.ai",
5
5
  "type": "module",
6
6
  "bin": {
@@ -540,6 +540,25 @@ try {
540
540
  /Keep other requested target page\(s\) intact[\s\S]*alpha-ai, beta-ai/i,
541
541
  'visual-warning retries should focus on the failing target instead of recreating unrelated completed targets'
542
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
+ );
543
562
  assert.match(
544
563
  worker._buildScopedUiTargetSetNudge(baseline, message),
545
564
  /one delivery set/i,
package/src/worker.js CHANGED
@@ -1491,6 +1491,23 @@ export class AgentForgeWorker extends EventEmitter {
1491
1491
  ].filter(Boolean).join('\n');
1492
1492
  }
1493
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
+
1494
1511
  _formatUiVerificationFailureLogSummary(nudge) {
1495
1512
  const lines = String(nudge || '')
1496
1513
  .split('\n')
@@ -4425,13 +4442,14 @@ export class AgentForgeWorker extends EventEmitter {
4425
4442
  const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
4426
4443
  const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
4427
4444
  const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
4445
+ const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
4428
4446
  const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
4429
4447
  if (nudgeCount < MAX_NUDGES) {
4430
4448
  console.log(`[${taskId}] UI completion still had visual verification warnings — nudging (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
4431
4449
  if (visualFailureSummary) {
4432
4450
  console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
4433
4451
  }
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.`);
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.`);
4435
4453
  continue;
4436
4454
  }
4437
4455
  throw new Error('UI task claimed completion while visual verification still reported issues');
@@ -4698,13 +4716,14 @@ export class AgentForgeWorker extends EventEmitter {
4698
4716
  const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
4699
4717
  const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiRepairNudgeCount);
4700
4718
  const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
4719
+ const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
4701
4720
  const visualFailureSummary = this._formatUiVerificationFailureLogSummary(uiVerificationFailureNudge);
4702
4721
  if (nudgeCount < MAX_NUDGES) {
4703
4722
  console.log(`[${taskId}] Publish evidence still had visual verification warnings — continuing (${nudgeCount}/${MAX_NUDGES}, total UI repairs ${repairBudget})`);
4704
4723
  if (visualFailureSummary) {
4705
4724
  console.log(`[${taskId}] UI visual verification issue(s): ${visualFailureSummary}`);
4706
4725
  }
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.`);
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.`);
4708
4727
  continue;
4709
4728
  }
4710
4729
  throw new Error('Publish task still had visual verification issues after repeated retries');
@@ -4843,6 +4862,7 @@ export class AgentForgeWorker extends EventEmitter {
4843
4862
  const scopedTargetSetNudge = this._formatScopedUiTargetSetReminder(scopeAwareUserMessage);
4844
4863
  const repeatedVisualRepairNudge = this._formatRepeatedVisualRepairNudge(uiVerificationRetryCount);
4845
4864
  const visualFailureFocusNudge = this._formatVisualFailureFocusNudge(output, scopeAwareUserMessage);
4865
+ const visualRepairTaskLead = this._formatVisualRepairTaskLead(scopeAwareUserMessage, output);
4846
4866
  const visualFailureSummary = this._formatUiVerificationFailureLogSummary(visualVerificationFailureNudge);
4847
4867
  nudgeCount = 0;
4848
4868
  console.log(`[${taskId}] UI task visual verification still reported visible issues — retrying (${uiVerificationRetryCount}/${UI_REPAIR_NUDGE_LIMIT}, total UI repairs ${repairBudget})`);
@@ -4852,7 +4872,7 @@ export class AgentForgeWorker extends EventEmitter {
4852
4872
  const retryInstruction = generatedResetNudge
4853
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.'
4854
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.';
4855
- iterationMessage = withTaskContext(`The task is: "${userMessage}"\n\n${[visualVerificationFailureNudge, visualFailureFocusNudge, generatedResetNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\n${retryInstruction}`);
4875
+ iterationMessage = withTaskContext(`${visualRepairTaskLead}\n\n${[visualVerificationFailureNudge, visualFailureFocusNudge, generatedResetNudge, scopedTargetSetNudge, repeatedVisualRepairNudge].filter(Boolean).join('\n\n')}\n\n${retryInstruction}`);
4856
4876
  } else if (hasMissingLocalUiVerification) {
4857
4877
  uiVerificationRetryCount++;
4858
4878
  const uiVerificationFailureDetails = this._extractUiVerificationFailureDetails(output);