@hamp10/agentforge 0.2.2 → 0.2.3
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 +8 -0
package/package.json
CHANGED
package/src/OllamaAgent.js
CHANGED
|
@@ -203,6 +203,7 @@ export class OllamaAgent extends EventEmitter {
|
|
|
203
203
|
messages.push(userMessage);
|
|
204
204
|
|
|
205
205
|
let finalContent = '';
|
|
206
|
+
let allOutput = ''; // accumulate everything streamed across all turns
|
|
206
207
|
const MAX_TURNS = 25;
|
|
207
208
|
|
|
208
209
|
for (let turn = 0; turn < MAX_TURNS; turn++) {
|
|
@@ -316,6 +317,7 @@ export class OllamaAgent extends EventEmitter {
|
|
|
316
317
|
thinkBuffer = inThinkBlock ? thinkBuffer.slice(thinkBuffer.lastIndexOf('<think>')) : '';
|
|
317
318
|
|
|
318
319
|
streamContent += out;
|
|
320
|
+
allOutput += out;
|
|
319
321
|
if (out) {
|
|
320
322
|
this.emit('agent_output', { agentId, output: out });
|
|
321
323
|
}
|
|
@@ -397,6 +399,12 @@ export class OllamaAgent extends EventEmitter {
|
|
|
397
399
|
finalContent = streamContent;
|
|
398
400
|
}
|
|
399
401
|
break;
|
|
402
|
+
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Use all accumulated output if final turn had no content (agent ended after tool calls)
|
|
406
|
+
if (!finalContent && allOutput) {
|
|
407
|
+
finalContent = allOutput;
|
|
400
408
|
}
|
|
401
409
|
|
|
402
410
|
// Persist history for next task
|