@hamp10/agentforge 0.2.20 → 0.2.21
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 +14 -2
package/package.json
CHANGED
package/src/OllamaAgent.js
CHANGED
|
@@ -874,6 +874,17 @@ B16. TEST LIKE A USER: Scroll, click buttons, simulate actions, check different
|
|
|
874
874
|
this.emit('agent_image', { agentId, image: result });
|
|
875
875
|
}
|
|
876
876
|
|
|
877
|
+
// ── Bash: curl returned 000 = server not running — force log read ──
|
|
878
|
+
if (name === 'bash') {
|
|
879
|
+
const resultStr = String(result).trim();
|
|
880
|
+
const isCurlZero = resultStr === '000' || resultStr.endsWith('\n000') || /\b000$/.test(resultStr);
|
|
881
|
+
if (isCurlZero) {
|
|
882
|
+
const logRead = await this._executeTool('bash', { command: 'cat /tmp/server.log 2>/dev/null | tail -30 || echo "No server.log found"' }, workDir, agentId);
|
|
883
|
+
messages.push({ role: 'user', content: `[bash result]: 000\n\nThe server is NOT running — curl got 000 (connection refused). Here are the crash logs:\n\n${logRead}\n\nThe server crashed. Read the error above, fix the bug in the code, then restart. Do NOT assume it is running. Do NOT change the port. Fix the actual error.` });
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
877
888
|
// ALL models get tool results fed back — no model should run blind.
|
|
878
889
|
// This is the core of the observe → reason → act loop: every tool result
|
|
879
890
|
// must be in context so the model can see what happened and react correctly.
|
|
@@ -889,11 +900,12 @@ B16. TEST LIKE A USER: Scroll, click buttons, simulate actions, check different
|
|
|
889
900
|
if (name === 'screenshot_and_describe') {
|
|
890
901
|
const screenshotResult = String(result);
|
|
891
902
|
const isLocalhost = (parsedArgs.url || '').includes('localhost') || (parsedArgs.url || '').includes('127.0.0.1');
|
|
892
|
-
// Server unreachable on localhost —
|
|
903
|
+
// Server unreachable on localhost — read crash log and force a fix
|
|
893
904
|
if (screenshotResult.includes('SERVER IS NOT REACHABLE') && isLocalhost) {
|
|
894
905
|
const portMatch = (parsedArgs.url || '').match(/:(\d+)/);
|
|
895
906
|
const port = portMatch ? portMatch[1] : '????';
|
|
896
|
-
|
|
907
|
+
const logRead = await this._executeTool('bash', { command: 'cat /tmp/server.log 2>/dev/null | tail -40 || echo "No server.log found"' }, workDir, agentId);
|
|
908
|
+
messages.push({ role: 'user', content: `The server on port ${port} is NOT running. Here are the crash logs:\n\n${logRead}\n\nThe server crashed or failed to start. Read the error above and fix the bug in your code. Then restart:\n pkill -f 'node.*${port}' 2>/dev/null; nohup /usr/local/bin/node server.js > /tmp/server.log 2>&1 &\nDo NOT assume it is running. Do NOT change the port. Fix the actual error first.` });
|
|
897
909
|
}
|
|
898
910
|
// Public URL unreachable — try web_fetch instead
|
|
899
911
|
else if (screenshotResult.includes('SERVER IS NOT REACHABLE') && !isLocalhost) {
|