@corbat-tech/coco 2.15.0 → 2.15.1

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
@@ -4705,12 +4705,12 @@ var init_copilot2 = __esm({
4705
4705
  init_openai();
4706
4706
  init_copilot();
4707
4707
  CONTEXT_WINDOWS4 = {
4708
- // Claude models
4709
- "claude-sonnet-4.6": 2e5,
4710
- "claude-opus-4.6": 2e5,
4711
- "claude-sonnet-4.5": 2e5,
4712
- "claude-opus-4.5": 2e5,
4713
- "claude-haiku-4.5": 2e5,
4708
+ // Claude models — Copilot API caps these at 168 000 (not 200 000 like Anthropic direct)
4709
+ "claude-sonnet-4.6": 168e3,
4710
+ "claude-opus-4.6": 168e3,
4711
+ "claude-sonnet-4.5": 168e3,
4712
+ "claude-opus-4.5": 168e3,
4713
+ "claude-haiku-4.5": 168e3,
4714
4714
  // OpenAI models — chat/completions
4715
4715
  "gpt-4.1": 1048576,
4716
4716
  // OpenAI models — /responses API (Codex/GPT-5+)
@@ -9401,7 +9401,7 @@ function humanizeError(message, toolName) {
9401
9401
  )) {
9402
9402
  return msg;
9403
9403
  }
9404
- if (/run git_init\b/.test(msg)) {
9404
+ if (/run git_init\b/i.test(msg)) {
9405
9405
  return msg;
9406
9406
  }
9407
9407
  if (/ECONNREFUSED/i.test(msg)) {
@@ -50073,6 +50073,25 @@ async function startRepl(options = {}) {
50073
50073
  continue;
50074
50074
  }
50075
50075
  const errorMsg = error instanceof Error ? error.message : String(error);
50076
+ if (errorMsg.includes("prompt token count") && errorMsg.includes("exceeds the limit")) {
50077
+ renderError("Context window full \u2014 compacting conversation history...");
50078
+ try {
50079
+ const compactionResult = await checkAndCompactContext(
50080
+ session,
50081
+ provider,
50082
+ void 0,
50083
+ toolRegistry
50084
+ );
50085
+ if (compactionResult?.wasCompacted) {
50086
+ console.log(chalk2.green(" \u2713 Context compacted. Please retry your message."));
50087
+ } else {
50088
+ console.log(chalk2.yellow(" \u26A0 Could not compact context. Use /clear to start fresh."));
50089
+ }
50090
+ } catch {
50091
+ console.log(chalk2.yellow(" \u26A0 Context compaction failed. Use /clear to start fresh."));
50092
+ }
50093
+ continue;
50094
+ }
50076
50095
  if (errorMsg.includes("context length") || errorMsg.includes("tokens to keep")) {
50077
50096
  renderError(errorMsg);
50078
50097
  console.log();