@hamp10/agentforge 0.2.12 → 0.2.13
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 +2 -2
- package/src/worker.js +3 -1
package/package.json
CHANGED
package/src/OllamaAgent.js
CHANGED
|
@@ -781,7 +781,7 @@ export class OllamaAgent extends EventEmitter {
|
|
|
781
781
|
if (existsSync(fp)) {
|
|
782
782
|
const data = JSON.parse(readFileSync(fp, 'utf-8'));
|
|
783
783
|
// Keep last 20 messages to stay within context
|
|
784
|
-
return data.slice(-
|
|
784
|
+
return data.slice(-12);
|
|
785
785
|
}
|
|
786
786
|
} catch {}
|
|
787
787
|
return [];
|
|
@@ -790,7 +790,7 @@ export class OllamaAgent extends EventEmitter {
|
|
|
790
790
|
_saveHistory(agentId, workDir, sessionId, messages) {
|
|
791
791
|
try {
|
|
792
792
|
const fp = this._historyPath(workDir, sessionId);
|
|
793
|
-
writeFileSync(fp, JSON.stringify(messages.slice(-
|
|
793
|
+
writeFileSync(fp, JSON.stringify(messages.slice(-20), null, 2));
|
|
794
794
|
} catch {}
|
|
795
795
|
}
|
|
796
796
|
}
|
package/src/worker.js
CHANGED
|
@@ -1206,7 +1206,9 @@ export class AgentForgeWorker extends EventEmitter {
|
|
|
1206
1206
|
// Only inject history when gateway is unavailable (subprocess fallback).
|
|
1207
1207
|
// Hampagent manages its own session history natively — never inject DB history for it
|
|
1208
1208
|
const gatewayActive = !!(this.cli.gatewayPort && this.cli.gatewayToken);
|
|
1209
|
-
|
|
1209
|
+
// OllamaAgent manages its own disk-based session history natively —
|
|
1210
|
+
// injecting DB history as text would double the context and overflow the model.
|
|
1211
|
+
const sessionExists = useHampagent || gatewayActive || isLocalModelRunner;
|
|
1210
1212
|
|
|
1211
1213
|
if (!sessionExists) {
|
|
1212
1214
|
// Session is gone — inject DB history as context prefix so the agent remembers
|