@hamp10/agentforge 0.2.50 → 0.2.51
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 +11 -2
- package/src/OpenClawCLI.js +1 -1
- package/src/worker.js +45 -7
package/package.json
CHANGED
|
@@ -291,9 +291,18 @@ try {
|
|
|
291
291
|
);
|
|
292
292
|
git(fixture.repo, ['restore', '--', nestedAlphaRel]);
|
|
293
293
|
const untrackedGammaRel = 'public_html/domains/gamma.html';
|
|
294
|
+
writeFileSync(path.join(fixture.repo, untrackedGammaRel), '');
|
|
295
|
+
assert.match(
|
|
296
|
+
worker._buildIncompleteScopedUiTargetsNudge(
|
|
297
|
+
[{ root: fixture.repo, head: fixture.head, initialDirtyPaths: [] }],
|
|
298
|
+
'Work on the Example.com listing pages for Alpha.ai, Beta.ai, and Gamma.ai. Make all three pages visually polished.'
|
|
299
|
+
),
|
|
300
|
+
/gamma-ai[\s\S]*blank or too little page source/i,
|
|
301
|
+
'blank scoped page files should not count as meaningfully addressed targets'
|
|
302
|
+
);
|
|
294
303
|
writeFileSync(
|
|
295
304
|
path.join(fixture.repo, untrackedGammaRel),
|
|
296
|
-
'<!doctype html><html><body><main><section><h1>Gamma</h1><p>New scoped page.</p></section></main></body></html>'
|
|
305
|
+
'<!doctype html><html><body><main><section><h1>Gamma</h1><p>New scoped page with enough visible product copy to prove the target was actually rebuilt rather than created as an empty placeholder file.</p></section></main></body></html>'
|
|
297
306
|
);
|
|
298
307
|
assert.equal(
|
|
299
308
|
worker._buildIncompleteScopedUiTargetsNudge(
|
|
@@ -536,7 +545,7 @@ try {
|
|
|
536
545
|
worker._findIncompleteScopedUiTargets = originalFindIncompleteScopedUiTargets;
|
|
537
546
|
assert.match(
|
|
538
547
|
incompleteRepairLead,
|
|
539
|
-
/missing-target pass for target page\(s\) not yet changed in the current diff: beta-ai/i,
|
|
548
|
+
/missing-target pass for target page\(s\) not yet changed with meaningful page content in the current diff: beta-ai/i,
|
|
540
549
|
'missing-target retries should name only the targets not yet addressed'
|
|
541
550
|
);
|
|
542
551
|
assert.match(
|
package/src/OpenClawCLI.js
CHANGED
|
@@ -917,7 +917,7 @@ export class OpenClawCLI extends EventEmitter {
|
|
|
917
917
|
_directFocusedRetryAllowedSlugs(task) {
|
|
918
918
|
const text = String(task || '');
|
|
919
919
|
const patterns = [
|
|
920
|
-
/missing-target pass for target page\(s\) not yet changed in the current diff:\s*([^\n.]+)/i,
|
|
920
|
+
/missing-target pass for target page\(s\) not yet changed(?: with meaningful page content)? in the current diff:\s*([^\n.]+)/i,
|
|
921
921
|
/visual repair pass for currently failing target page\(s\):\s*([^\n.]+)/i,
|
|
922
922
|
];
|
|
923
923
|
for (const pattern of patterns) {
|
package/src/worker.js
CHANGED
|
@@ -775,6 +775,24 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
775
775
|
return [...names].sort();
|
|
776
776
|
}
|
|
777
777
|
|
|
778
|
+
_pageSourceContentIssue(repo, rel) {
|
|
779
|
+
if (!repo || !/\.html?$/i.test(String(rel || ''))) return null;
|
|
780
|
+
const fullPath = path.join(repo, rel);
|
|
781
|
+
if (!existsSync(fullPath)) return 'missing page source file';
|
|
782
|
+
let content = '';
|
|
783
|
+
try {
|
|
784
|
+
content = readFileSync(fullPath, 'utf-8');
|
|
785
|
+
} catch {
|
|
786
|
+
return 'unreadable page source file';
|
|
787
|
+
}
|
|
788
|
+
const trimmed = content.trim();
|
|
789
|
+
if (trimmed.length < 200) return 'blank or too little page source';
|
|
790
|
+
if (!/<(?:html|body|main|section|article|h1)\b/i.test(trimmed)) {
|
|
791
|
+
return 'does not look like a rendered page source';
|
|
792
|
+
}
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
|
|
778
796
|
_isNewScopedPageOwnedAsset(baseline, rel, allowedSlugs, pageOnly) {
|
|
779
797
|
if (!baseline?.root || !pageOnly || !Array.isArray(allowedSlugs) || allowedSlugs.length === 0) return false;
|
|
780
798
|
if (!this._isPageAssetPath(rel)) return false;
|
|
@@ -1696,20 +1714,40 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
1696
1714
|
if (changedFiles.length === 0) continue;
|
|
1697
1715
|
|
|
1698
1716
|
const touchedSlugs = new Set();
|
|
1717
|
+
const touchedFilesBySlug = new Map();
|
|
1699
1718
|
for (const filePath of changedFiles) {
|
|
1700
1719
|
const lower = String(filePath || '').toLowerCase();
|
|
1701
1720
|
for (const slug of allowedSlugs) {
|
|
1702
|
-
if (this._scopeSlugsMatchingText(lower, [slug]).length > 0)
|
|
1721
|
+
if (this._scopeSlugsMatchingText(lower, [slug]).length > 0) {
|
|
1722
|
+
touchedSlugs.add(slug);
|
|
1723
|
+
if (!touchedFilesBySlug.has(slug)) touchedFilesBySlug.set(slug, []);
|
|
1724
|
+
touchedFilesBySlug.get(slug).push(filePath);
|
|
1725
|
+
}
|
|
1703
1726
|
}
|
|
1704
1727
|
}
|
|
1705
1728
|
|
|
1706
1729
|
const missingSlugs = allowedSlugs.filter(slug => !touchedSlugs.has(slug));
|
|
1707
|
-
|
|
1730
|
+
const contentIssues = [];
|
|
1731
|
+
for (const slug of allowedSlugs.filter(slug => touchedSlugs.has(slug))) {
|
|
1732
|
+
const pageFiles = (touchedFilesBySlug.get(slug) || [])
|
|
1733
|
+
.filter(rel => /\.html?$/i.test(rel));
|
|
1734
|
+
if (pageFiles.length === 0) continue;
|
|
1735
|
+
const issues = pageFiles
|
|
1736
|
+
.map(rel => ({ rel, issue: this._pageSourceContentIssue(baseline.root, rel) }))
|
|
1737
|
+
.filter(item => item.issue);
|
|
1738
|
+
if (issues.length > 0 && issues.length === pageFiles.length) {
|
|
1739
|
+
missingSlugs.push(slug);
|
|
1740
|
+
contentIssues.push(`${slug}: ${issues.map(item => `${item.rel} (${item.issue})`).join(', ')}`);
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
const uniqueMissingSlugs = [...new Set(missingSlugs)];
|
|
1744
|
+
if (uniqueMissingSlugs.length === 0) continue;
|
|
1708
1745
|
warnings.push({
|
|
1709
1746
|
repo: baseline.root,
|
|
1710
|
-
missingSlugs,
|
|
1747
|
+
missingSlugs: uniqueMissingSlugs,
|
|
1711
1748
|
touchedSlugs: [...touchedSlugs],
|
|
1712
1749
|
changedFiles: [...new Set(changedFiles)].slice(0, 8),
|
|
1750
|
+
contentIssues,
|
|
1713
1751
|
});
|
|
1714
1752
|
}
|
|
1715
1753
|
|
|
@@ -1718,12 +1756,12 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
1718
1756
|
|
|
1719
1757
|
_formatIncompleteScopedUiTargetsNudge(warnings) {
|
|
1720
1758
|
const lines = warnings.slice(0, 5).map(w =>
|
|
1721
|
-
`- ${w.repo}: missing target(s) ${w.missingSlugs.join(', ')}; changed ${w.changedFiles.join(', ') || 'no UI files'}`
|
|
1759
|
+
`- ${w.repo}: missing or incomplete target(s) ${w.missingSlugs.join(', ')}; changed ${w.changedFiles.join(', ') || 'no UI files'}${w.contentIssues?.length ? `; content issue(s): ${w.contentIssues.join('; ')}` : ''}`
|
|
1722
1760
|
);
|
|
1723
1761
|
return [
|
|
1724
|
-
'The task names multiple scoped UI targets, but the current diff does not
|
|
1762
|
+
'The task names multiple scoped UI targets, but the current diff does not meaningfully address every named target.',
|
|
1725
1763
|
...lines,
|
|
1726
|
-
'For scoped page/listing work, each requested target page must be addressed directly unless the final response clearly reports a blocker for that specific target. Continue from the current files and update the missing target page(s), then visually verify all edited target screens.',
|
|
1764
|
+
'For scoped page/listing work, each requested target page must be addressed directly with non-empty, rendered page content unless the final response clearly reports a blocker for that specific target. Continue from the current files and update the missing or incomplete target page(s), then visually verify all edited target screens.',
|
|
1727
1765
|
].join('\n');
|
|
1728
1766
|
}
|
|
1729
1767
|
|
|
@@ -1741,7 +1779,7 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
1741
1779
|
const alreadyTouchedSlugs = allSlugs.filter(slug => !missingSlugs.includes(slug));
|
|
1742
1780
|
return [
|
|
1743
1781
|
`Original scoped UI target set: ${allSlugs.join(', ')}.`,
|
|
1744
|
-
`This retry is a missing-target pass for target page(s) not yet changed in the current diff: ${missingSlugs.join(', ')}.`,
|
|
1782
|
+
`This retry is a missing-target pass for target page(s) not yet changed with meaningful page content in the current diff: ${missingSlugs.join(', ')}.`,
|
|
1745
1783
|
alreadyTouchedSlugs.length > 0
|
|
1746
1784
|
? `Do not delete, rewrite, or restart target page(s) already changed in this diff just to repeat earlier work: ${alreadyTouchedSlugs.join(', ')}.`
|
|
1747
1785
|
: '',
|