@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ducci/jarvis",
3
- "version": "1.0.99",
3
+ "version": "1.0.100",
4
4
  "description": "A fully automated agent system that lives on a server.",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -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
- return [resolved[0], ...resolved.slice(-(subConfig.messageWindow))];
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
- return [resolved[0], ...resolved.slice(-(config.messageWindow))];
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 = [];