@lmnr-ai/claude-code-proxy 0.1.11 → 0.1.13
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.d.ts +9 -3
- package/dist/index.js +17 -14
- package/package.json +8 -8
package/dist/index.d.ts
CHANGED
|
@@ -67,8 +67,11 @@ export declare class ProxyServer {
|
|
|
67
67
|
runServer(url: string): void;
|
|
68
68
|
/**
|
|
69
69
|
* Stop the proxy server and its health monitoring.
|
|
70
|
+
*
|
|
71
|
+
* @param timeout - Maximum time in seconds to wait for graceful shutdown (default: 4).
|
|
72
|
+
* The server will abort pending connections and background tasks after timeout/2.
|
|
70
73
|
*/
|
|
71
|
-
stopServer(): void;
|
|
74
|
+
stopServer(timeout?: number): void;
|
|
72
75
|
/**
|
|
73
76
|
* Check if the server is currently running.
|
|
74
77
|
*/
|
|
@@ -96,8 +99,11 @@ export declare function runServer(url: string, port?: number): void;
|
|
|
96
99
|
*
|
|
97
100
|
* This is a backwards-compatible function that uses a global singleton instance.
|
|
98
101
|
* For more control, consider creating your own ProxyServer instance.
|
|
102
|
+
*
|
|
103
|
+
* @param timeout - Maximum time in seconds to wait for graceful shutdown (default: 4).
|
|
104
|
+
* The server will abort pending connections and background tasks after timeout/2.
|
|
99
105
|
*/
|
|
100
|
-
export declare function stopServer(): void;
|
|
106
|
+
export declare function stopServer(timeout?: number): void;
|
|
101
107
|
/**
|
|
102
108
|
* Set the current trace context by sending an HTTP request to the running proxy server.
|
|
103
109
|
*
|
|
@@ -108,4 +114,4 @@ export declare function stopServer(): void;
|
|
|
108
114
|
* @throws Error if the HTTP request fails
|
|
109
115
|
*/
|
|
110
116
|
export declare function setCurrentTrace(context: SpanContext): Promise<void>;
|
|
111
|
-
export declare const run: any, stop: any;
|
|
117
|
+
export declare const run: any, stop: any, stopWithTimeout: any;
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Laminar Claude Code Proxy - TypeScript/JavaScript bindings for HTTP proxy server
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.stop = exports.run = exports.ProxyServer = void 0;
|
|
6
|
+
exports.stopWithTimeout = exports.stop = exports.run = exports.ProxyServer = void 0;
|
|
7
7
|
exports.runServer = runServer;
|
|
8
8
|
exports.stopServer = stopServer;
|
|
9
9
|
exports.setCurrentTrace = setCurrentTrace;
|
|
@@ -148,7 +148,7 @@ class ProxyServer {
|
|
|
148
148
|
try {
|
|
149
149
|
// Try to stop the existing server (it might be stuck)
|
|
150
150
|
try {
|
|
151
|
-
native.
|
|
151
|
+
native.stopWithTimeout(this.port, 4);
|
|
152
152
|
}
|
|
153
153
|
catch {
|
|
154
154
|
// Server might already be dead
|
|
@@ -157,7 +157,6 @@ class ProxyServer {
|
|
|
157
157
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
158
158
|
// Restart the server
|
|
159
159
|
native.run(this.targetUrl, this.port);
|
|
160
|
-
console.info(`Server restarted successfully on port ${this.port}`);
|
|
161
160
|
}
|
|
162
161
|
catch (restartError) {
|
|
163
162
|
console.error(`Failed to restart server on port ${this.port}: ${restartError}`);
|
|
@@ -201,8 +200,11 @@ class ProxyServer {
|
|
|
201
200
|
}
|
|
202
201
|
/**
|
|
203
202
|
* Stop the proxy server and its health monitoring.
|
|
203
|
+
*
|
|
204
|
+
* @param timeout - Maximum time in seconds to wait for graceful shutdown (default: 4).
|
|
205
|
+
* The server will abort pending connections and background tasks after timeout/2.
|
|
204
206
|
*/
|
|
205
|
-
stopServer() {
|
|
207
|
+
stopServer(timeout = 4) {
|
|
206
208
|
// Stop the monitor
|
|
207
209
|
if (this.monitorInterval !== null) {
|
|
208
210
|
clearInterval(this.monitorInterval);
|
|
@@ -210,13 +212,11 @@ class ProxyServer {
|
|
|
210
212
|
}
|
|
211
213
|
// Reset the health check flag
|
|
212
214
|
this.isHealthCheckRunning = false;
|
|
213
|
-
//
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
catch {
|
|
219
|
-
}
|
|
215
|
+
// Once we stop monitoring, we've lost active management of the server,
|
|
216
|
+
// so we mark it as not running regardless of shutdown success
|
|
217
|
+
this._isRunning = false;
|
|
218
|
+
// Stop the server and re-throw any errors to inform caller
|
|
219
|
+
native.stopWithTimeout(this.port, timeout);
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
222
222
|
* Check if the server is currently running.
|
|
@@ -270,9 +270,12 @@ function runServer(url, port = 45667) {
|
|
|
270
270
|
*
|
|
271
271
|
* This is a backwards-compatible function that uses a global singleton instance.
|
|
272
272
|
* For more control, consider creating your own ProxyServer instance.
|
|
273
|
+
*
|
|
274
|
+
* @param timeout - Maximum time in seconds to wait for graceful shutdown (default: 4).
|
|
275
|
+
* The server will abort pending connections and background tasks after timeout/2.
|
|
273
276
|
*/
|
|
274
|
-
function stopServer() {
|
|
275
|
-
getGlobalProxy().stopServer();
|
|
277
|
+
function stopServer(timeout = 4) {
|
|
278
|
+
getGlobalProxy().stopServer(timeout);
|
|
276
279
|
}
|
|
277
280
|
/**
|
|
278
281
|
* Set the current trace context by sending an HTTP request to the running proxy server.
|
|
@@ -287,4 +290,4 @@ async function setCurrentTrace(context) {
|
|
|
287
290
|
return getGlobalProxy().setCurrentTrace(context);
|
|
288
291
|
}
|
|
289
292
|
// Re-export native functions for direct access if needed
|
|
290
|
-
exports.run = native.run, exports.stop = native.stop;
|
|
293
|
+
exports.run = native.run, exports.stop = native.stop, exports.stopWithTimeout = native.stopWithTimeout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmnr-ai/claude-code-proxy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "HTTP proxy for Claude Desktop API requests with Laminar observability",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"@lmnr-ai/claude-code-proxy-darwin-arm64": "0.1.
|
|
27
|
-
"@lmnr-ai/claude-code-proxy-darwin-x64": "0.1.
|
|
28
|
-
"@lmnr-ai/claude-code-proxy-win32-x64-msvc": "0.1.
|
|
29
|
-
"@lmnr-ai/claude-code-proxy-linux-x64-gnu": "0.1.
|
|
30
|
-
"@lmnr-ai/claude-code-proxy-linux-arm64-gnu": "0.1.
|
|
31
|
-
"@lmnr-ai/claude-code-proxy-linux-x64-musl": "0.1.
|
|
32
|
-
"@lmnr-ai/claude-code-proxy-linux-arm64-musl": "0.1.
|
|
26
|
+
"@lmnr-ai/claude-code-proxy-darwin-arm64": "0.1.13",
|
|
27
|
+
"@lmnr-ai/claude-code-proxy-darwin-x64": "0.1.13",
|
|
28
|
+
"@lmnr-ai/claude-code-proxy-win32-x64-msvc": "0.1.13",
|
|
29
|
+
"@lmnr-ai/claude-code-proxy-linux-x64-gnu": "0.1.13",
|
|
30
|
+
"@lmnr-ai/claude-code-proxy-linux-arm64-gnu": "0.1.13",
|
|
31
|
+
"@lmnr-ai/claude-code-proxy-linux-x64-musl": "0.1.13",
|
|
32
|
+
"@lmnr-ai/claude-code-proxy-linux-arm64-musl": "0.1.13"
|
|
33
33
|
},
|
|
34
34
|
"keywords": [
|
|
35
35
|
"claude",
|