@ducci/jarvis 1.0.82 → 1.0.84
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
CHANGED
|
@@ -329,9 +329,9 @@ export async function startTelegramChannel(config) {
|
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
const totalMessages = Math.max(0, session.messages.length - 1); // exclude system prompt
|
|
332
|
-
const windowed = session.messages.length <= config.
|
|
332
|
+
const windowed = session.messages.length <= config.messageWindow + 1
|
|
333
333
|
? session.messages
|
|
334
|
-
: [session.messages[0], ...session.messages.slice(-config.
|
|
334
|
+
: [session.messages[0], ...session.messages.slice(-config.messageWindow)];
|
|
335
335
|
const inContext = Math.max(0, windowed.length - 1);
|
|
336
336
|
const estimatedTokens = Math.round(JSON.stringify(windowed).length / 4);
|
|
337
337
|
const model = config.selectedModel || 'unknown';
|
package/src/server/agent.js
CHANGED
|
@@ -202,8 +202,8 @@ async function runSubagent(client, config, args, parentSessionId) {
|
|
|
202
202
|
}
|
|
203
203
|
return msg;
|
|
204
204
|
});
|
|
205
|
-
if (resolved.length <= subConfig.
|
|
206
|
-
return [resolved[0], ...resolved.slice(-(subConfig.
|
|
205
|
+
if (resolved.length <= subConfig.messageWindow + 1) return resolved;
|
|
206
|
+
return [resolved[0], ...resolved.slice(-(subConfig.messageWindow))];
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
const run = await runAgentLoop(client, subConfig, subSession, prepareMessages, usageAccum);
|
|
@@ -766,7 +766,7 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [],
|
|
|
766
766
|
|
|
767
767
|
// Resolves {{user_info}} in system prompt at runtime (never persisted).
|
|
768
768
|
// Applies a sliding window: always includes the system prompt (messages[0])
|
|
769
|
-
// plus the most recent
|
|
769
|
+
// plus the most recent messageWindow messages, so long sessions don't overflow
|
|
770
770
|
// the model's context. Full history is always preserved on disk.
|
|
771
771
|
function prepareMessages(messages) {
|
|
772
772
|
const resolved = messages.map((msg, i) => {
|
|
@@ -775,8 +775,8 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [],
|
|
|
775
775
|
}
|
|
776
776
|
return msg;
|
|
777
777
|
});
|
|
778
|
-
if (resolved.length <= config.
|
|
779
|
-
return [resolved[0], ...resolved.slice(-(config.
|
|
778
|
+
if (resolved.length <= config.messageWindow + 1) return resolved;
|
|
779
|
+
return [resolved[0], ...resolved.slice(-(config.messageWindow))];
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
const allToolCalls = [];
|
package/src/server/config.js
CHANGED
|
@@ -71,7 +71,7 @@ export function loadConfig() {
|
|
|
71
71
|
fallbackModel: settings.fallbackModel || (provider === 'anthropic' ? 'claude-haiku-4-5-20251001' : 'openrouter/free'),
|
|
72
72
|
maxIterations: settings.maxIterations || 20,
|
|
73
73
|
maxHandoffs: settings.maxHandoffs || 3,
|
|
74
|
-
|
|
74
|
+
messageWindow: settings.messageWindow || 300,
|
|
75
75
|
modelContextWindow: settings.modelContextWindow || null,
|
|
76
76
|
port: settings.port || 18008,
|
|
77
77
|
telegram: {
|