openzoo 0.29.0 → 0.29.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.
@@ -126,23 +126,37 @@ function respond(req, res, method, models) {
126
126
  */
127
127
  export function startCursorBackend({ port = 8443, models, log = () => {} } = {}) {
128
128
  const { cert, key } = ensureCert(log);
129
+ let conns = 0;
129
130
  const server = https.createServer(
130
- { cert: fs.readFileSync(cert), key: fs.readFileSync(key) },
131
+ {
132
+ cert: fs.readFileSync(cert),
133
+ key: fs.readFileSync(key),
134
+ // Log which hostname the editor asked for on the TLS handshake — this is
135
+ // the single clearest proof the redirect is working and the editor is
136
+ // reaching US instead of the real backend.
137
+ SNICallback: (servername, cb) => { log(`cursor-tls: <- ClientHello SNI=${servername}`); cb(null); },
138
+ },
131
139
  async (req, res) => {
132
- // Connect method is the last path segment: /aiserver.v1.XService/Method
133
- const method = (req.url || '').split('/').filter(Boolean).pop() || '';
134
- await readBody(req);
140
+ conns += 1;
141
+ const full = req.url || '';
142
+ const method = full.split('/').filter(Boolean).pop() || '';
143
+ const ct = req.headers['content-type'] || '?';
144
+ const body = await readBody(req);
145
+ log(`cursor-backend: #${conns} ${req.method} ${full} ct=${ct} body=${body.length}b`);
135
146
  try {
136
147
  respond(req, res, method, models);
137
- if (method === 'AvailableModels') log(`cursor-backend: served AvailableModels (${models.length} models, all gates open)`);
148
+ log(`cursor-backend: -> ${method === 'AvailableModels' ? `AvailableModels (${models.length} models, gates open)` : 'empty-ok'}`);
138
149
  } catch (e) {
139
150
  res.writeHead(200, { 'content-type': 'application/proto', 'grpc-status': '0' });
140
151
  res.end(Buffer.alloc(0));
141
- log(`cursor-backend: ${method} -> empty-ok (${e.message})`);
152
+ log(`cursor-backend: -> empty-ok (err ${e.message})`);
142
153
  }
143
154
  },
144
155
  );
145
- server.on('tlsClientError', () => { /* editor probing; ignore */ });
156
+ // NEVER swallow this a rejected handshake is exactly the failure to see.
157
+ server.on('tlsClientError', (e, sock) => {
158
+ log(`cursor-tls: HANDSHAKE FAILED ${e.code || e.message} (peer ${sock?.remoteAddress || '?'})`);
159
+ });
146
160
  server.listen(port, '127.0.0.1', () => log(`cursor-backend: listening on 127.0.0.1:${port} as ${CURSOR_HOSTS[0]}`));
147
161
  return { server, port };
148
162
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openzoo",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "Local x402-paying proxy + MCP server for openzoo.fun — point any OpenAI-compatible harness (Cursor, Claude Code, aider, SDKs) at localhost and it pays per call from a local burner wallet. Solana and Base rails live; Robinhood experimental.",
5
5
  "license": "MIT",
6
6
  "type": "module",