bridgerapi 1.9.1 → 1.9.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.
Files changed (2) hide show
  1. package/dist/cli.js +28 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -481,7 +481,7 @@ var DroidBackend = class _DroidBackend {
481
481
  try {
482
482
  out = (0, import_child_process.execFileSync)(
483
483
  which("droid") || this.bin,
484
- ["exec", "--output-format", "text", "--model", model2, "-"],
484
+ ["exec", "--output-format", "text", "--model", model2],
485
485
  { input: prompt, encoding: "utf8", timeout: 3e5 }
486
486
  );
487
487
  } catch (e) {
@@ -492,7 +492,7 @@ var DroidBackend = class _DroidBackend {
492
492
  async *stream(prompt, model2) {
493
493
  yield* spawnStream(
494
494
  which("droid") || this.bin,
495
- ["exec", "--output-format", "text", "--model", model2, "-"],
495
+ ["exec", "--output-format", "text", "--model", model2],
496
496
  prompt
497
497
  );
498
498
  }
@@ -653,26 +653,33 @@ async function handleChat(req, res) {
653
653
  }
654
654
  function createBridgeServer(port2) {
655
655
  const server = (0, import_http.createServer)(async (req, res) => {
656
- const path = (req.url ?? "/").split("?")[0];
657
- const method = req.method ?? "GET";
658
- if (method === "OPTIONS") {
659
- cors(res, 200);
660
- res.end();
661
- return;
662
- }
663
- if (method === "GET" && (path === "/v1/models" || path === "/models")) {
664
- await handleModels(res);
665
- return;
666
- }
667
- if (method === "GET" && path === "/health") {
668
- handleHealth(res, port2);
669
- return;
670
- }
671
- if (method === "POST" && (path === "/v1/chat/completions" || path === "/chat/completions")) {
672
- await handleChat(req, res);
673
- return;
656
+ try {
657
+ const path = (req.url ?? "/").split("?")[0];
658
+ const method = req.method ?? "GET";
659
+ if (method === "OPTIONS") {
660
+ cors(res, 200);
661
+ res.end();
662
+ return;
663
+ }
664
+ if (method === "GET" && (path === "/v1/models" || path === "/models")) {
665
+ await handleModels(res);
666
+ return;
667
+ }
668
+ if (method === "GET" && path === "/health") {
669
+ handleHealth(res, port2);
670
+ return;
671
+ }
672
+ if (method === "POST" && (path === "/v1/chat/completions" || path === "/chat/completions")) {
673
+ await handleChat(req, res);
674
+ return;
675
+ }
676
+ sendJson(res, 404, { error: { message: "not found", type: "not_found_error" } });
677
+ } catch (err) {
678
+ console.error(" unhandled server error:", err.message);
679
+ if (!res.headersSent) {
680
+ sendJson(res, 500, { error: { message: "internal server error", type: "server_error" } });
681
+ }
674
682
  }
675
- sendJson(res, 404, { error: { message: "not found", type: "not_found_error" } });
676
683
  });
677
684
  return server;
678
685
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bridgerapi",
3
- "version": "1.9.1",
3
+ "version": "1.9.2",
4
4
  "description": "Turn any AI CLI (Claude Code, Gemini, Codex, GitHub Copilot) into an OpenAI-compatible API — no API keys needed",
5
5
  "keywords": [
6
6
  "claude",