protoagent 0.1.12 → 0.1.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.
@@ -281,8 +281,10 @@ export async function runAgenticLoop(client, model, messages, userInput, onEvent
281
281
  let contextRetryCount = 0;
282
282
  let retriggerCount = 0;
283
283
  let truncateRetryCount = 0;
284
+ let continueRetryCount = 0;
284
285
  const MAX_RETRIGGERS = 3;
285
286
  const MAX_TRUNCATE_RETRIES = 5;
287
+ const MAX_CONTINUE_RETRIES = 1;
286
288
  const validToolNames = getValidToolNames();
287
289
  while (iterationCount < maxIterations) {
288
290
  // Check if abort was requested
@@ -714,6 +716,21 @@ export async function runAgenticLoop(client, model, messages, userInput, onEvent
714
716
  continue;
715
717
  }
716
718
  }
719
+ // After truncation retries exhausted, try adding a "continue" message
720
+ if (continueRetryCount < MAX_CONTINUE_RETRIES) {
721
+ continueRetryCount++;
722
+ updatedMessages.push({ role: 'user', content: 'continue' });
723
+ logger.warn('400 error: adding "continue" message to retry', {
724
+ continueRetryCount,
725
+ messageCount: updatedMessages.length,
726
+ });
727
+ onEvent({
728
+ type: 'error',
729
+ error: 'Request failed. Retrying with "continue"...',
730
+ transient: true,
731
+ });
732
+ continue;
733
+ }
717
734
  }
718
735
  // Handle context-window-exceeded (prompt too long) — attempt forced compaction
719
736
  // This fires when our token estimate was too low (e.g. base64 images from MCP tools)
@@ -778,7 +795,7 @@ export async function runAgenticLoop(client, model, messages, userInput, onEvent
778
795
  if (apiError?.status === 400) {
779
796
  onEvent({
780
797
  type: 'error',
781
- error: 'The conversation history appears to be corrupted and could not be automatically repaired. Try /clear to start fresh.',
798
+ error: `Request failed: ${errMsg}\n\nThe conversation history could not be automatically repaired. Try /clear to start fresh.`,
782
799
  transient: false,
783
800
  });
784
801
  onEvent({ type: 'done' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "protoagent",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",