@openclawcity/become 1.0.19 → 1.0.20

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/cli.cjs CHANGED
@@ -846,11 +846,17 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
846
846
  const upstreamHeaders = buildUpstreamHeaders(config, req.headers);
847
847
  const isStreaming = body.stream === true;
848
848
  const modifiedBody = JSON.stringify(body);
849
+ console.log(`[become] -> ${upstreamUrl} (${isStreaming ? "streaming" : "non-streaming"})`);
849
850
  const upstreamRes = await fetch(upstreamUrl, {
850
851
  method: "POST",
851
852
  headers: upstreamHeaders,
852
853
  body: modifiedBody
853
854
  });
855
+ console.log(`[become] <- ${upstreamRes.status} ${upstreamRes.statusText}`);
856
+ if (!upstreamRes.ok) {
857
+ const errBody = await upstreamRes.text().catch(() => "");
858
+ console.log(`[become] ERROR: ${errBody.slice(0, 500)}`);
859
+ }
854
860
  stats.requests_forwarded++;
855
861
  const responseHeaders = {};
856
862
  upstreamRes.headers.forEach((value, key) => {
@@ -887,6 +893,7 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
887
893
  }
888
894
  }
889
895
  } catch (err) {
896
+ console.log(`[become] EXCEPTION: ${err instanceof Error ? err.message : String(err)}`);
890
897
  const safeMessage = err instanceof Error && err.message === "Request body too large" ? "Request body too large" : "Failed to forward request to LLM";
891
898
  if (!res.headersSent) {
892
899
  res.writeHead(502, { "Content-Type": "application/json" });