@ducci/jarvis 1.0.99 → 1.0.101
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/channels/telegram/index.js +7 -4
- package/src/server/agent.js +10 -2
- package/src/server/app.js +7 -0
package/package.json
CHANGED
|
@@ -775,7 +775,7 @@ export async function startTelegramChannel(config) {
|
|
|
775
775
|
|
|
776
776
|
isRunning.add(key);
|
|
777
777
|
runStartTimes.set(key, new Date());
|
|
778
|
-
await ctx.api.sendChatAction(chatId, 'typing');
|
|
778
|
+
await ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
779
779
|
const typingInterval = setInterval(() => {
|
|
780
780
|
ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
781
781
|
}, 4000);
|
|
@@ -802,7 +802,7 @@ export async function startTelegramChannel(config) {
|
|
|
802
802
|
}
|
|
803
803
|
|
|
804
804
|
console.log(`[telegram] incoming voice chat_id=${chatId}`);
|
|
805
|
-
await ctx.api.sendChatAction(chatId, 'typing');
|
|
805
|
+
await ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
806
806
|
|
|
807
807
|
// Download voice file (OGG/Opus from Telegram)
|
|
808
808
|
let transcription;
|
|
@@ -904,7 +904,7 @@ export async function startTelegramChannel(config) {
|
|
|
904
904
|
|
|
905
905
|
isRunning.add(key);
|
|
906
906
|
runStartTimes.set(key, new Date());
|
|
907
|
-
await ctx.api.sendChatAction(chatId, 'typing');
|
|
907
|
+
await ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
908
908
|
const typingInterval = setInterval(() => {
|
|
909
909
|
ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
910
910
|
}, 4000);
|
|
@@ -952,7 +952,7 @@ export async function startTelegramChannel(config) {
|
|
|
952
952
|
isRunning.add(key);
|
|
953
953
|
runStartTimes.set(key, new Date());
|
|
954
954
|
console.log(`[telegram] incoming chat_id=${chatId} slot=${slot}`);
|
|
955
|
-
await ctx.api.sendChatAction(chatId, 'typing');
|
|
955
|
+
await ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
956
956
|
const typingInterval = setInterval(() => {
|
|
957
957
|
ctx.api.sendChatAction(chatId, 'typing').catch(() => {});
|
|
958
958
|
}, 4000);
|
|
@@ -966,6 +966,9 @@ export async function startTelegramChannel(config) {
|
|
|
966
966
|
}
|
|
967
967
|
});
|
|
968
968
|
|
|
969
|
+
bot.catch((err) => {
|
|
970
|
+
console.error(`[telegram] grammy error: ${err.message}`, err.error);
|
|
971
|
+
});
|
|
969
972
|
run(bot);
|
|
970
973
|
console.log('[telegram] channel started');
|
|
971
974
|
}
|
package/src/server/agent.js
CHANGED
|
@@ -231,7 +231,11 @@ async function runSubagent(client, config, args, parentSessionId) {
|
|
|
231
231
|
return msg;
|
|
232
232
|
});
|
|
233
233
|
if (resolved.length <= subConfig.messageWindow + 1) return resolved;
|
|
234
|
-
|
|
234
|
+
// Walk back from the window boundary past any orphaned tool results to avoid
|
|
235
|
+
// starting mid-tool-call-sequence (MiniMax error 2013: tool_call_id not found)
|
|
236
|
+
let startIdx = resolved.length - subConfig.messageWindow;
|
|
237
|
+
while (startIdx > 1 && resolved[startIdx].role === 'tool') startIdx--;
|
|
238
|
+
return [resolved[0], ...resolved.slice(startIdx)];
|
|
235
239
|
}
|
|
236
240
|
|
|
237
241
|
const run = await runAgentLoop(client, subConfig, subSession, prepareMessages, usageAccum);
|
|
@@ -806,7 +810,11 @@ async function _runHandleChat(config, sessionId, userMessage, attachments = [],
|
|
|
806
810
|
return msg;
|
|
807
811
|
});
|
|
808
812
|
if (resolved.length <= config.messageWindow + 1) return resolved;
|
|
809
|
-
|
|
813
|
+
// Walk back from the window boundary past any orphaned tool results to avoid
|
|
814
|
+
// starting mid-tool-call-sequence (MiniMax error 2013: tool_call_id not found)
|
|
815
|
+
let startIdx = resolved.length - config.messageWindow;
|
|
816
|
+
while (startIdx > 1 && resolved[startIdx].role === 'tool') startIdx--;
|
|
817
|
+
return [resolved[0], ...resolved.slice(startIdx)];
|
|
810
818
|
}
|
|
811
819
|
|
|
812
820
|
const allToolCalls = [];
|
package/src/server/app.js
CHANGED
|
@@ -187,6 +187,13 @@ function startServer() {
|
|
|
187
187
|
process.exit(1);
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
process.on('uncaughtException', (err) => {
|
|
191
|
+
console.error('[jarvis] uncaughtException:', err.message, err.stack);
|
|
192
|
+
});
|
|
193
|
+
process.on('unhandledRejection', (reason) => {
|
|
194
|
+
console.error('[jarvis] unhandledRejection:', reason instanceof Error ? reason.stack : reason);
|
|
195
|
+
});
|
|
196
|
+
|
|
190
197
|
ensureDirectories();
|
|
191
198
|
seedTools();
|
|
192
199
|
seedIdentity();
|