@elvatis_com/openclaw-cli-bridge-elvatis 0.2.5 → 0.2.6

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/index.ts CHANGED
@@ -351,6 +351,8 @@ const plugin = {
351
351
  }
352
352
 
353
353
  // ── Phase 2: CLI request proxy ─────────────────────────────────────────────
354
+ let proxyServer: import("node:http").Server | null = null;
355
+
354
356
  if (enableProxy) {
355
357
  startProxyServer({
356
358
  port,
@@ -359,7 +361,8 @@ const plugin = {
359
361
  log: (msg) => api.logger.info(msg),
360
362
  warn: (msg) => api.logger.warn(msg),
361
363
  })
362
- .then(() => {
364
+ .then((server) => {
365
+ proxyServer = server;
363
366
  api.logger.info(
364
367
  `[cli-bridge] proxy ready on :${port} — vllm/cli-gemini/* and vllm/cli-claude/* available`
365
368
  );
@@ -375,6 +378,26 @@ const plugin = {
375
378
  });
376
379
  }
377
380
 
381
+ // ── Cleanup: close proxy server on plugin stop (hot-reload / gateway restart) ──
382
+ // Register a named service so OpenClaw can call stop() on plugin teardown.
383
+ api.registerService({
384
+ id: "cli-bridge-proxy",
385
+ start: async () => { /* proxy already started above */ },
386
+ stop: async () => {
387
+ if (proxyServer) {
388
+ await new Promise<void>((resolve) => {
389
+ proxyServer!.close((err) => {
390
+ if (err) api.logger.warn(`[cli-bridge] proxy close error: ${err.message}`);
391
+ else api.logger.info(`[cli-bridge] proxy server closed on plugin stop`);
392
+ resolve();
393
+ });
394
+ });
395
+ proxyServer = null;
396
+ }
397
+ },
398
+ });
399
+
400
+
378
401
  // ── Phase 3a: /cli-* model switch commands ─────────────────────────────────
379
402
  for (const entry of CLI_MODEL_COMMANDS) {
380
403
  const { name, model, description, label } = entry;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "openclaw-cli-bridge-elvatis",
3
3
  "name": "OpenClaw CLI Bridge",
4
- "version": "0.2.5",
4
+ "version": "0.2.6",
5
5
  "description": "Phase 1: openai-codex auth bridge. Phase 2: local HTTP proxy routing model calls through gemini/claude CLIs (vllm provider).",
6
6
  "providers": [
7
7
  "openai-codex"
package/package.json CHANGED
@@ -1,8 +1,13 @@
1
1
  {
2
2
  "name": "@elvatis_com/openclaw-cli-bridge-elvatis",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Bridges gemini, claude, and codex CLI tools as OpenClaw model providers. Reads existing CLI auth without re-login.",
5
5
  "type": "module",
6
+ "openclaw": {
7
+ "extensions": [
8
+ "./index.ts"
9
+ ]
10
+ },
6
11
  "scripts": {
7
12
  "build": "tsc",
8
13
  "typecheck": "tsc -p tsconfig.check.json",