claude-scionos 3.0.1 → 3.0.2

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.0.2] - 2026-01-11
9
+
10
+ ### Added
11
+ - **Robust Proxy**: Integrated `undici` library for advanced HTTP agent control in the local proxy.
12
+ - **SSL Bypass**: Added support for internal/self-signed certificates (`rejectUnauthorized: false`) when using the proxy.
13
+
14
+ ### Fixed
15
+ - **Proxy Connectivity**: Fixed `fetch failed` and protocol errors by cleaning conflicting headers (`Host`, `Content-Length`) before upstream forwarding.
16
+ - **Code Quality**: Removed unused variables and dead code for cleaner execution.
17
+
8
18
  ## [3.0.1] - 2026-01-11
9
19
 
10
20
  ### Added
package/index.js CHANGED
@@ -98,7 +98,7 @@ function startProxyServer(targetModel, validToken) {
98
98
  let bodyJson;
99
99
  try {
100
100
  bodyJson = JSON.parse(bodyBuffer.toString());
101
- } catch (e) {
101
+ } catch {
102
102
  // If not JSON, forward as is
103
103
  bodyJson = null;
104
104
  }
@@ -115,14 +115,26 @@ function startProxyServer(targetModel, validToken) {
115
115
  }
116
116
 
117
117
  // Prepare upstream request
118
+ // 1. Create an agent that ignores SSL errors (CRITICAL for internal/testing environments)
119
+ const { Agent } = await import('undici');
120
+ const dispatcher = new Agent({
121
+ connect: {
122
+ rejectUnauthorized: false // WARNING: Ignores SSL certificate errors
123
+ }
124
+ });
125
+
126
+ // 2. Remove problematic headers that fetch handles automatically
127
+ const upstreamHeaders = { ...req.headers };
128
+ delete upstreamHeaders['host']; // Let fetch set the correct Host based on URL
129
+ delete upstreamHeaders['content-length']; // Let fetch calculate length based on body
130
+ upstreamHeaders['x-api-key'] = validToken;
131
+
132
+ // 3. Execute request with the permissive dispatcher
118
133
  const upstreamRes = await fetch(`${BASE_URL}${req.url}`, {
119
134
  method: 'POST',
120
- headers: {
121
- ...req.headers,
122
- 'host': new URL(BASE_URL).host,
123
- 'x-api-key': validToken // Ensure we use the validated token
124
- },
125
- body: bodyJson ? JSON.stringify(bodyJson) : bodyBuffer
135
+ headers: upstreamHeaders,
136
+ body: bodyJson ? JSON.stringify(bodyJson) : bodyBuffer,
137
+ dispatcher: dispatcher // <--- Apply the custom agent here
126
138
  });
127
139
 
128
140
  // Pipe response back
@@ -150,13 +162,20 @@ function startProxyServer(targetModel, validToken) {
150
162
 
151
163
  // Simple Redirect implementation for non-body requests
152
164
  try {
165
+ // 1. Create agent (SSL bypass)
166
+ const { Agent } = await import('undici');
167
+ const dispatcher = new Agent({ connect: { rejectUnauthorized: false } });
168
+
169
+ // 2. Clean headers
170
+ const upstreamHeaders = { ...req.headers };
171
+ delete upstreamHeaders['host'];
172
+ delete upstreamHeaders['content-length'];
173
+ upstreamHeaders['x-api-key'] = validToken;
174
+
153
175
  const upstreamRes = await fetch(`${BASE_URL}${req.url}`, {
154
176
  method: req.method,
155
- headers: {
156
- ...req.headers,
157
- 'host': new URL(BASE_URL).host,
158
- 'x-api-key': validToken
159
- }
177
+ headers: upstreamHeaders,
178
+ dispatcher: dispatcher
160
179
  });
161
180
  res.writeHead(upstreamRes.status, upstreamRes.headers);
162
181
  if (upstreamRes.body) {
@@ -166,7 +185,7 @@ function startProxyServer(targetModel, validToken) {
166
185
  }
167
186
  }
168
187
  res.end();
169
- } catch (e) {
188
+ } catch {
170
189
  res.writeHead(502);
171
190
  res.end();
172
191
  }
@@ -231,7 +250,6 @@ if (!claudeStatus.installed) {
231
250
  }
232
251
 
233
252
  // Check Git Bash on Windows
234
- let gitBashPath = null;
235
253
  if (process.platform === 'win32') {
236
254
  const gitBashStatus = checkGitBashOnWindows();
237
255
  if (!gitBashStatus.available) {
@@ -239,7 +257,6 @@ if (process.platform === 'win32') {
239
257
  console.log(chalk.cyan('Please install Git for Windows: https://git-scm.com/downloads/win'));
240
258
  process.exit(1);
241
259
  }
242
- gitBashPath = gitBashStatus.path;
243
260
  }
244
261
 
245
262
  // 3. Token Loop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-scionos",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "description": "Ephemeral and secure runner for Claude Code CLI in ScioNos environment",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -38,6 +38,7 @@
38
38
  "@inquirer/prompts": "^8.1.0",
39
39
  "chalk": "^5.6.2",
40
40
  "cross-spawn": "^7.0.6",
41
+ "undici": "^7.18.2",
41
42
  "update-notifier": "^7.3.1",
42
43
  "which": "^6.0.0"
43
44
  },
@@ -58,7 +58,7 @@ function isClaudeCodeInstalled() {
58
58
  cliPath = foundPath;
59
59
  details.push(`✓ Found in PATH: ${foundPath}`);
60
60
  }
61
- } catch (e) {
61
+ } catch {
62
62
  // Ignore error if not found in PATH
63
63
  }
64
64
  }