@ducci/jarvis 1.0.99 → 1.0.100
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/server/agent.js +10 -2
package/package.json
CHANGED
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 = [];
|