@corbat-tech/coco 2.20.1 → 2.21.0

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/cli/index.js CHANGED
@@ -4487,7 +4487,7 @@ var init_codex = __esm({
4487
4487
  model,
4488
4488
  input,
4489
4489
  instructions: instructions ?? "You are a helpful coding assistant.",
4490
- max_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
4490
+ max_output_tokens: options?.maxTokens ?? this.config.maxTokens ?? 8192,
4491
4491
  temperature: options?.temperature ?? this.config.temperature ?? 0,
4492
4492
  store: false,
4493
4493
  stream: true
@@ -10461,8 +10461,9 @@ function isNonRetryableProviderError(error) {
10461
10461
  if (error instanceof ProviderError) {
10462
10462
  const code = error.statusCode;
10463
10463
  if (code === 401 || code === 403) return true;
10464
+ if (code === 400) return true;
10464
10465
  const msg = error.message.toLowerCase();
10465
- if (msg.includes("exceeded your current quota") || msg.includes("usage limit") || msg.includes("insufficient_quota") || msg.includes("billing") || msg.includes("payment") || msg.includes("invalid_api_key") || msg.includes("incorrect api key") || msg.includes("bad credentials") || msg.includes("not authorized")) {
10466
+ if (msg.includes("exceeded your current quota") || msg.includes("usage limit") || msg.includes("insufficient_quota") || msg.includes("billing") || msg.includes("payment") || msg.includes("invalid_api_key") || msg.includes("incorrect api key") || msg.includes("bad credentials") || msg.includes("not authorized") || msg.includes("unsupported parameter")) {
10466
10467
  return true;
10467
10468
  }
10468
10469
  }
@@ -11177,12 +11178,12 @@ function renderFileBlock(file, opts) {
11177
11178
  }
11178
11179
  }
11179
11180
  }
11180
- console.log();
11181
11181
  }
11182
11182
  function formatLineNo(line, show) {
11183
11183
  if (!show) return "";
11184
- const lineNo = line.type === "delete" ? line.oldLineNo : line.newLineNo;
11185
- return chalk2.dim(`${String(lineNo ?? "").padStart(5)} `);
11184
+ const oldStr = line.oldLineNo !== void 0 ? String(line.oldLineNo) : "";
11185
+ const newStr = line.newLineNo !== void 0 ? String(line.newLineNo) : "";
11186
+ return chalk2.dim(`${oldStr.padStart(4)} | ${newStr.padStart(4)} `);
11186
11187
  }
11187
11188
  function getChangedLines(diff) {
11188
11189
  const result = /* @__PURE__ */ new Map();
@@ -47698,7 +47699,7 @@ function wordLevelHighlight(deletedContent, addedContent) {
47698
47699
  return { styledDelete, styledAdd };
47699
47700
  }
47700
47701
  function printEditDiff(oldStr, newStr) {
47701
- const termWidth = Math.max(getTerminalWidth2() - 14, 30);
47702
+ const termWidth = Math.max(getTerminalWidth2() - 15, 30);
47702
47703
  const MAX_SHOWN = 30;
47703
47704
  if (!oldStr.trim()) {
47704
47705
  const lines = newStr.split("\n").filter((l) => l.trim().length > 0).slice(0, 6);
@@ -50080,6 +50081,9 @@ ${tail}`;
50080
50081
  if (isAbortError(streamError, options.signal)) {
50081
50082
  return abortReturn();
50082
50083
  }
50084
+ if (isNonRetryableProviderError(streamError)) {
50085
+ throw streamError;
50086
+ }
50083
50087
  const errorMsg = streamError instanceof Error ? streamError.message : String(streamError);
50084
50088
  addMessage(session, {
50085
50089
  role: "assistant",
@@ -51780,6 +51784,8 @@ ${imagePrompts}`.trim() : imagePrompts;
51780
51784
  console.log(chalk2.dim(" Recovery failed after multiple attempts. Returning to prompt."));
51781
51785
  continue;
51782
51786
  }
51787
+ session.messages.length = preCallMessageLength;
51788
+ consecutiveErrors = 0;
51783
51789
  renderError(errorMsg);
51784
51790
  } finally {
51785
51791
  clearSpinner();