coder-agent 2.9.4 → 2.9.6

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/dist/agent.js CHANGED
@@ -503,10 +503,34 @@ async function callGeminiAPIWithRotation(apiKey, params, maxRetries = 3, initial
503
503
  const nextModel = rotationList[modelIndex];
504
504
  if (!silent) {
505
505
  stopSpinner();
506
- const reason = isModelError ? "Model unavailable" : "Rate limited";
507
- console.log(chalk.hex('#ff9f0a')('⚠') + ' ' + chalk.gray(`${reason} on ${currentModel}. Rotating to ${nextModel}`));
506
+ let reason = "Rate limited";
507
+ if (isModelError)
508
+ reason = "Model unavailable";
509
+ else if (status >= 500)
510
+ reason = "Server error (5xx)";
511
+ console.log(chalk.hex('#ff9f0a')('⚠') + ' ' + chalk.gray(`${reason} on ${currentModel}. Rotating to ${nextModel}...`));
508
512
  startSpinner("thinking...");
509
513
  }
514
+ // Delay slightly on rate limits or server errors before sending next request
515
+ if (status === 429 || (status >= 500 && status < 600)) {
516
+ try {
517
+ await new Promise((resolve, reject) => {
518
+ const timer = setTimeout(resolve, 2000);
519
+ if (signal) {
520
+ signal.addEventListener("abort", () => {
521
+ clearTimeout(timer);
522
+ const abortErr = new Error("The user aborted a request.");
523
+ abortErr.name = "AbortError";
524
+ reject(abortErr);
525
+ });
526
+ }
527
+ });
528
+ }
529
+ catch (err) {
530
+ if (err.name === "AbortError" || signal?.aborted)
531
+ throw err;
532
+ }
533
+ }
510
534
  currentModel = nextModel;
511
535
  attempts = 0; // reset retry counter for the fresh model
512
536
  continue;
package/dist/memory.js CHANGED
@@ -240,7 +240,7 @@ When writing code in your response, always use this block format:
240
240
  Guidelines & Controls:
241
241
  - Be extremely concise in your explanations; let code and command output speak for itself.
242
242
  - When you have successfully completed the user's request or achieved the goal, output an extremely brief and minimal final response (e.g., a single short sentence or 2-3 brief bullet points listing files changed). Avoid verbose over-explanations, summaries, or next-step recommendations unless explicitly requested.
243
- - When writing code, always use write_file then run_shell to verify it works.
243
+ - When writing or modifying code, always use the write_file or patch_file tools to apply the changes directly to the codebase. NEVER output raw code blocks or snippets in your chat response when they can be applied using tools. Chat responses should contain only brief status confirmations or final explanations. Always run a verify script/compile tool (like run_shell) after editing to verify the code works.
244
244
  - Prefer using search_grep to locate code, read_file_lines to read relevant parts, and patch_file to make targeted edits, especially in large codebases. This prevents token/context overflow.
245
245
  - Before answering questions or checking for errors in the codebase, always inspect the workspace to identify the files and languages present. Do not guess.
246
246
  - Focus on the actual files and programming language of the codebase you are currently running in.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coder-agent",
3
- "version": "2.9.4",
3
+ "version": "2.9.6",
4
4
  "description": "CLI coding agent powered by Google Gemini",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",