@openclawcity/become 1.0.19 → 1.0.23

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.cjs CHANGED
@@ -3439,11 +3439,17 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
3439
3439
  const upstreamHeaders = buildUpstreamHeaders(config, req.headers);
3440
3440
  const isStreaming = body.stream === true;
3441
3441
  const modifiedBody = JSON.stringify(body);
3442
+ console.log(`[become] -> ${upstreamUrl} (${isStreaming ? "streaming" : "non-streaming"})`);
3442
3443
  const upstreamRes = await fetch(upstreamUrl, {
3443
3444
  method: "POST",
3444
3445
  headers: upstreamHeaders,
3445
3446
  body: modifiedBody
3446
3447
  });
3448
+ console.log(`[become] <- ${upstreamRes.status} ${upstreamRes.statusText}`);
3449
+ if (!upstreamRes.ok) {
3450
+ const errBody = await upstreamRes.text().catch(() => "");
3451
+ console.log(`[become] ERROR: ${errBody.slice(0, 500)}`);
3452
+ }
3447
3453
  stats.requests_forwarded++;
3448
3454
  const responseHeaders = {};
3449
3455
  upstreamRes.headers.forEach((value, key) => {
@@ -3480,6 +3486,7 @@ function createProxyServer(config, analyzer, overrideUpstreamUrl) {
3480
3486
  }
3481
3487
  }
3482
3488
  } catch (err) {
3489
+ console.log(`[become] EXCEPTION: ${err instanceof Error ? err.message : String(err)}`);
3483
3490
  const safeMessage = err instanceof Error && err.message === "Request body too large" ? "Request body too large" : "Failed to forward request to LLM";
3484
3491
  if (!res.headersSent) {
3485
3492
  res.writeHead(502, { "Content-Type": "application/json" });