squeezr-ai 1.11.2 → 1.11.4

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/index.js CHANGED
@@ -1,9 +1,10 @@
1
+ import tls from 'node:tls';
1
2
  import { serve } from '@hono/node-server';
2
3
  import { app, stats } from './server.js';
3
4
  import { config } from './config.js';
4
5
  import { VERSION } from './version.js';
5
6
  const PORT = config.port;
6
- serve({ fetch: app.fetch, port: PORT }, () => {
7
+ const server = serve({ fetch: app.fetch, port: PORT }, () => {
7
8
  console.log(`Squeezr v${VERSION} listening on http://localhost:${PORT}`);
8
9
  console.log(`Mode: ${config.dryRun ? 'dry-run' : 'active'}`);
9
10
  if (config.disabled)
@@ -11,6 +12,29 @@ serve({ fetch: app.fetch, port: PORT }, () => {
11
12
  console.log(`Backends: Anthropic → Haiku | OpenAI → GPT-4o-mini | Gemini → Flash-8B | Local → ${config.localCompressionModel}`);
12
13
  console.log(`Stats: http://localhost:${PORT}/squeezr/stats`);
13
14
  });
15
+ server.on('upgrade', (req, socket, head) => {
16
+ if (req.url !== '/responses') {
17
+ socket.destroy();
18
+ return;
19
+ }
20
+ const targetHost = 'api.openai.com';
21
+ const targetPath = '/v1/responses';
22
+ const upstream = tls.connect({ host: targetHost, port: 443, servername: targetHost }, () => {
23
+ // Rebuild the HTTP upgrade request with the correct host and path
24
+ const fwdHeaders = Object.entries(req.headers)
25
+ .filter(([k]) => k.toLowerCase() !== 'host')
26
+ .map(([k, v]) => `${k}: ${v}`)
27
+ .join('\r\n');
28
+ const upgradeReq = `GET ${targetPath} HTTP/1.1\r\nHost: ${targetHost}\r\n${fwdHeaders}\r\n\r\n`;
29
+ upstream.write(upgradeReq);
30
+ if (head.length > 0)
31
+ upstream.write(head);
32
+ upstream.pipe(socket);
33
+ socket.pipe(upstream);
34
+ });
35
+ upstream.on('error', () => socket.destroy());
36
+ socket.on('error', () => upstream.destroy());
37
+ });
14
38
  const isDaemon = !!process.env.SQUEEZR_DAEMON;
15
39
  if (isDaemon) {
16
40
  // Daemon mode: ignore SIGINT (Ctrl+C) and SIGHUP (terminal close)
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.11.1";
1
+ export declare const VERSION = "1.11.4";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.11.1';
1
+ export const VERSION = '1.11.4';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.11.2",
3
+ "version": "1.11.4",
4
4
  "description": "AI proxy that compresses Claude Code, Codex, Aider, Gemini CLI and Ollama context windows to save thousands of tokens per session",
5
5
  "keywords": [
6
6
  "claude",