@hamp10/agentforge 0.2.21 → 0.2.22
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/src/OllamaAgent.js +10 -4
package/package.json
CHANGED
package/src/OllamaAgent.js
CHANGED
|
@@ -418,6 +418,7 @@ B6. npm install: cd ${projectsDir}/PROJECT_NAME && /usr/local/bin/npm init -y &&
|
|
|
418
418
|
B7. After starting server, verify: sleep 3 && curl -s -o /dev/null -w '%{http_code}' http://localhost:PORT — if 000, check /tmp/server.log and fix the error.
|
|
419
419
|
B8. PORT MANAGEMENT: Check port before starting: lsof -i :PORT | head -3. If in use: kill old process, restart. If crashed: restart. If busy with something else: pick different port.
|
|
420
420
|
B9. EXPRESS WILDCARD ROUTE: NEVER write app.get('*', ...) — crashes in newer versions. Use app.use((req, res) => { ... }) instead.
|
|
421
|
+
B10a. STATIC FILE PATHS: ALWAYS use path.join(__dirname, 'public') for express.static and file reads — NEVER './public' or 'public'. Relative paths break when server starts with nohup from a different directory. __dirname is always the directory containing server.js.
|
|
421
422
|
B10. MANDATORY SCREENSHOT QA: After curl returns 200, call screenshot_and_describe with send_to_user:true. You are NOT done until the screenshot shows the real working app.
|
|
422
423
|
B11. ALWAYS open the finished app: bash open http://localhost:PORT
|
|
423
424
|
B12. CANVAS GAMES: canvas 800×600, dark background #1a1a2e, all elements clearly visible. Dark theme, styled UI.
|
|
@@ -874,13 +875,18 @@ B16. TEST LIKE A USER: Scroll, click buttons, simulate actions, check different
|
|
|
874
875
|
this.emit('agent_image', { agentId, image: result });
|
|
875
876
|
}
|
|
876
877
|
|
|
877
|
-
// ── Bash: curl returned 000
|
|
878
|
+
// ── Bash: curl returned 000 or 404 — force log read and targeted fix ──
|
|
878
879
|
if (name === 'bash') {
|
|
879
880
|
const resultStr = String(result).trim();
|
|
880
881
|
const isCurlZero = resultStr === '000' || resultStr.endsWith('\n000') || /\b000$/.test(resultStr);
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
882
|
+
const isCurl404 = resultStr === '404' || resultStr.endsWith('\n404') || /\b404$/.test(resultStr);
|
|
883
|
+
if (isCurlZero || isCurl404) {
|
|
884
|
+
const logRead = await this._executeTool('bash', { command: 'cat /tmp/server.log 2>/dev/null | tail -40 || echo "No server.log found"' }, workDir, agentId);
|
|
885
|
+
if (isCurlZero) {
|
|
886
|
+
messages.push({ role: 'user', content: `[bash result]: 000 (connection refused — server is NOT running)\n\nCrash log:\n${logRead}\n\nThe server crashed or never started. Fix the actual error shown above. Do NOT assume it is running. Do NOT change the port. Make a targeted fix to the code then restart.` });
|
|
887
|
+
} else {
|
|
888
|
+
messages.push({ role: 'user', content: `[bash result]: 404 (server is running but root route not found)\n\nServer log:\n${logRead}\n\nCommon cause: static files path is wrong. In server.js ALWAYS use path.join(__dirname, 'public') — NEVER './public' or 'public' — relative paths break when server is started with nohup. Fix the static file path and restart. Do NOT rewrite the whole file.` });
|
|
889
|
+
}
|
|
884
890
|
continue;
|
|
885
891
|
}
|
|
886
892
|
}
|