claude-simple 0.2.34 → 0.2.35

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.html CHANGED
@@ -4,13 +4,13 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
6
6
  <title>Claude Code</title>
7
- <link rel="stylesheet" href="/style.0.2.34.min.css">
7
+ <link rel="stylesheet" href="/style.0.2.35.min.css">
8
8
  <link rel="stylesheet" href="/highlight.min.css">
9
9
  <script src="/marked.min.js"></script>
10
10
  <script src="/highlight.min.js"></script>
11
11
  </head>
12
12
  <body class="h-dvh overflow-hidden flex flex-col bg-base-100 text-base-content">
13
13
  <div id="root" class="flex flex-col flex-1 overflow-hidden"></div>
14
- <script type="module" src="/app.0.2.34.min.js"></script>
14
+ <script type="module" src="/app.0.2.35.min.js"></script>
15
15
  </body>
16
16
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-simple",
3
- "version": "0.2.34",
3
+ "version": "0.2.35",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude-simple": "server.js",
@@ -1,4 +1,5 @@
1
1
  import { WebSocket } from 'ws';
2
+ import { request } from 'node:http';
2
3
  import { setTimeout as sleep } from 'node:timers/promises';
3
4
 
4
5
  // Aggregate wire budget across downloads/previews, separate from chat traffic.
@@ -46,15 +47,22 @@ export function createHTTPTransfer({ gatewayURL, token, machineId, budget = new
46
47
  ws.send(JSON.stringify({ ...data, reqId: msg.reqId }), err => err ? reject(err) : resolve());
47
48
  });
48
49
  try {
49
- const res = await fetch(url, { ...options, signal: controller.signal });
50
- const headers = sanitizeHeaders(Object.fromEntries(res.headers.entries()));
50
+ // A paced consumer can outlive the local server's keep-alive timeout.
51
+ // Read the dedicated HTTP stream directly instead of fetch's pooled parser.
52
+ const res = await new Promise((resolve, reject) => {
53
+ const req = request(url, { method: options.method, headers: { ...options.headers, Connection: 'close', 'Accept-Encoding': 'identity' }, signal: controller.signal }, resolve);
54
+ req.on('error', reject);
55
+ req.end(options.body);
56
+ });
57
+ const upstreamHeaders = Object.fromEntries(Object.entries(res.headers).filter(([, value]) => value != null).map(([key, value]) => [key, Array.isArray(value) ? value.join(', ') : String(value)]));
58
+ const headers = sanitizeHeaders(upstreamHeaders);
51
59
  // Identity bodies retain their exact length (ordinary proxy replies recompute it).
52
- if (!res.headers.get('content-encoding') || res.headers.get('content-encoding') === 'identity') {
53
- const length = res.headers.get('content-length');
54
- if (length !== null) headers['content-length'] = length;
60
+ if (!upstreamHeaders['content-encoding'] || upstreamHeaders['content-encoding'] === 'identity') {
61
+ const length = upstreamHeaders['content-length'];
62
+ if (length != null) headers['content-length'] = length;
55
63
  }
56
- await send({ type: 'http-res-start', status: res.status, headers });
57
- for await (const value of res.body || []) {
64
+ await send({ type: 'http-res-start', status: res.statusCode, headers });
65
+ for await (const value of res) {
58
66
  // Each frame is small; sends wait for socket backpressure and share a rate cap.
59
67
  for (let offset = 0; offset < value.byteLength; offset += 24 * 1024) {
60
68
  const chunk = Buffer.from(value.subarray(offset, offset + 24 * 1024));
@@ -65,6 +73,7 @@ export function createHTTPTransfer({ gatewayURL, token, machineId, budget = new
65
73
  await send({ type: 'http-end' });
66
74
  } catch (err) {
67
75
  if (ws.readyState === WebSocket.OPEN) await send({ type: 'http-error', message: err.message }).catch(() => {});
76
+ console.warn(`[transfer] ${msg.reqId}: ${err.message}`);
68
77
  throw err;
69
78
  }
70
79
  } finally {
File without changes