freegate 0.6.28 → 0.6.29

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": "freegate",
3
- "version": "0.6.28",
3
+ "version": "0.6.29",
4
4
  "description": "Free multi-provider LLM gateway with automatic failover. One OpenAI-compatible endpoint routes to many free models (Groq, Mistral, Gemini, NIM, OpenRouter, ZAI, Cerebras, DeepSeek and more). Never pay for LLMs.",
5
5
  "license": "MIT",
6
6
  "bin": {
package/providers.json CHANGED
@@ -676,7 +676,7 @@
676
676
  "gemini-gemini-3-1-flash-lite-preview": {
677
677
  "endpoint": "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
678
678
  "model": "gemini-3.1-flash-lite-preview",
679
- "priority": 4,
679
+ "priority": 3,
680
680
  "dailyLimit": 1500,
681
681
  "keyHint": "gemini → Keys (автодобавлено, general)",
682
682
  "envVar": "PROVIDER_GEMINI_APIKEY",
@@ -696,7 +696,7 @@
696
696
  "gemini-gemini-3-5-flash-lite": {
697
697
  "endpoint": "https://generativelanguage.googleapis.com/v1beta/openai/chat/completions",
698
698
  "model": "gemini-3.5-flash-lite",
699
- "priority": 3,
699
+ "priority": 4,
700
700
  "dailyLimit": 1500,
701
701
  "keyHint": "gemini → Keys (автодобавлено, general)",
702
702
  "envVar": "PROVIDER_GEMINI_APIKEY",
package/server.js CHANGED
@@ -164,6 +164,10 @@ const autoUpdate = require('./lib/autoupdate');
164
164
  const AUTO_UPDATE = (config.autoUpdate && typeof config.autoUpdate === 'object') ? config.autoUpdate : {};
165
165
  const diagMonitor = require('./lib/diagmonitor');
166
166
  const DIAG_MONITOR = (config.diagMonitor && typeof config.diagMonitor === 'object') ? config.diagMonitor : { enabled: true, intervalMs: 30 * 60 * 1000 };
167
+ // Прокси-компакция по умолчанию ВЫКЛЮЧЕНА: её делает клиент (opencode/BigPickle),
168
+ // который знает структуру диалога. Прокси не переписывает контент — иначе агент
169
+ // теряет рабочий контекст и «не продолжает». Включить: {"compacter":{"enabled":true}}.
170
+ const COMPACTER_ENABLED = !!(config.compacter && config.compacter.enabled);
167
171
  const modelManager = new ModelManager({
168
172
  dbPath: path.join(__dirname, 'models-db.json'),
169
173
  catalogPath: path.join(__dirname, 'providers.json'),
@@ -430,7 +434,12 @@ async function handleChatCompletion(req, res, body) {
430
434
  // Runs AFTER the vision pipeline (images already converted to text above).
431
435
  // Skipped in window-upgrade mode — the big provider takes the raw context.
432
436
  if (Array.isArray(body.messages)) measure.origTokens = estimateTokens(body.messages);
433
- if (Array.isArray(body.messages) && body.messages.length > 0 && !windowUpgraded) {
437
+ // Прокси-компакция ОПЦИОНАЛЬНА (config.compacter.enabled, по умолчанию false).
438
+ // Компактит сам клиент (opencode auto-compaction / BigPickle) — он знает
439
+ // смысловую структуру диалога и сохраняет «что осталось сделать». Прокси лишь
440
+ // роутит и не должен переписывать контент — иначе агент теряет нить.
441
+ // Окно-роутинг (ниже) остаётся всегда: выбирает провайдера под размер запроса.
442
+ if (COMPACTER_ENABLED && !windowUpgraded) {
434
443
  body.messages = await prepareMessages(body.messages, { contextWindow: PROVIDERS[targetProviderKey]?.context_window || 0 });
435
444
  }
436
445
  // Контекстная телеметрия: токены после компакции + доля системного промпта.