@bunny-agent/runner-cli 0.9.52 → 0.9.55

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/bundle.mjs +55 -4
  2. package/package.json +3 -3
package/dist/bundle.mjs CHANGED
@@ -2483,6 +2483,52 @@ function isRateLimitError(err) {
2483
2483
  const msg = err.message;
2484
2484
  return msg.includes("429") || msg.includes("rate") || msg.includes("quota") || msg.includes("limit");
2485
2485
  }
2486
+ function getErrorField(error, key) {
2487
+ if (!(key in error))
2488
+ return void 0;
2489
+ const value = error[key];
2490
+ if (typeof value === "string" || typeof value === "number") {
2491
+ return String(value);
2492
+ }
2493
+ return void 0;
2494
+ }
2495
+ function formatErrorCause(cause) {
2496
+ if (cause === null || cause === void 0)
2497
+ return "unknown";
2498
+ if (typeof cause !== "object")
2499
+ return String(cause);
2500
+ const details = [
2501
+ ["code", getErrorField(cause, "code")],
2502
+ [
2503
+ "message",
2504
+ cause instanceof Error ? cause.message : getErrorField(cause, "message")
2505
+ ],
2506
+ ["errno", getErrorField(cause, "errno")],
2507
+ ["syscall", getErrorField(cause, "syscall")],
2508
+ ["hostname", getErrorField(cause, "hostname")],
2509
+ ["address", getErrorField(cause, "address")],
2510
+ ["port", getErrorField(cause, "port")]
2511
+ ].filter((entry) => Boolean(entry[1])).map(([key, value]) => `${key}=${value}`);
2512
+ const nestedErrors = "errors" in cause && Array.isArray(cause.errors) ? cause.errors : [];
2513
+ if (nestedErrors.length > 0) {
2514
+ const nested = nestedErrors.slice(0, 3).map(formatErrorCause).join("; ");
2515
+ details.push(`errors=[${nested}]`);
2516
+ }
2517
+ return details.length > 0 ? details.join(", ") : String(cause);
2518
+ }
2519
+ function formatWebToolError(error) {
2520
+ if (!(error instanceof Error))
2521
+ return String(error);
2522
+ const cause = "cause" in error ? error.cause : void 0;
2523
+ return cause === void 0 ? error.message : `${error.name}: ${error.message} (cause: ${formatErrorCause(cause)})`;
2524
+ }
2525
+ function getSafeTarget(url) {
2526
+ try {
2527
+ return new URL(url).origin;
2528
+ } catch {
2529
+ return "invalid-url";
2530
+ }
2531
+ }
2486
2532
  var BROWSER_UA = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36";
2487
2533
  function stripNullBytes(s) {
2488
2534
  return s.replace(/\0/g, "");
@@ -2513,7 +2559,8 @@ async function fetchPageContent(url, externalSignal) {
2513
2559
 
2514
2560
  [Truncated]` : text;
2515
2561
  } catch (e) {
2516
- const msg = e instanceof Error ? e.message : String(e);
2562
+ const msg = formatWebToolError(e);
2563
+ console.error(`[bunny-agent:pi] web_fetch failed target=${getSafeTarget(url)}: ${msg}`);
2517
2564
  return `(Error fetching ${url}: ${msg})`;
2518
2565
  } finally {
2519
2566
  clearTimeout(timeout);
@@ -2600,7 +2647,9 @@ function buildWebSearchTool(env) {
2600
2647
  const freshness = p.freshness;
2601
2648
  const shouldFetchContent = p.fetch_content ?? false;
2602
2649
  let lastError;
2650
+ let lastProviderLabel = "unknown provider";
2603
2651
  for (const { provider, apiKey } of providers) {
2652
+ lastProviderLabel = provider.label;
2604
2653
  try {
2605
2654
  const { results } = await provider.search({
2606
2655
  apiKey,
@@ -2638,6 +2687,8 @@ function buildWebSearchTool(env) {
2638
2687
  };
2639
2688
  } catch (e) {
2640
2689
  lastError = e;
2690
+ const diagnostic = formatWebToolError(e);
2691
+ console.error(`[bunny-agent:pi] ${provider.label} web_search failed: ${diagnostic}`);
2641
2692
  if (isRateLimitError(e) && providers.length > 1) {
2642
2693
  console.error(`[bunny-agent:pi] ${provider.label} rate-limited, trying next provider...`);
2643
2694
  continue;
@@ -2645,12 +2696,12 @@ function buildWebSearchTool(env) {
2645
2696
  break;
2646
2697
  }
2647
2698
  }
2648
- const msg = lastError instanceof Error ? lastError.message : String(lastError);
2699
+ const msg = formatWebToolError(lastError);
2649
2700
  return {
2650
2701
  content: [
2651
2702
  {
2652
2703
  type: "text",
2653
- text: `Web search error: ${msg}`
2704
+ text: `Web search error (${lastProviderLabel}): ${msg}`
2654
2705
  }
2655
2706
  ],
2656
2707
  details: void 0
@@ -2680,7 +2731,7 @@ function buildWebFetchTool() {
2680
2731
  details: void 0
2681
2732
  };
2682
2733
  } catch (e) {
2683
- const msg = e instanceof Error ? e.message : String(e);
2734
+ const msg = formatWebToolError(e);
2684
2735
  return {
2685
2736
  content: [
2686
2737
  { type: "text", text: `Error fetching URL: ${msg}` }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunny-agent/runner-cli",
3
- "version": "0.9.52",
3
+ "version": "0.9.55",
4
4
  "description": "BunnyAgent Runner CLI - Like gemini-cli or claude-code, runs in your local terminal with AI SDK UI streaming",
5
5
  "type": "module",
6
6
  "bin": {
@@ -56,9 +56,9 @@
56
56
  "vitest": "^1.6.1",
57
57
  "@bunny-agent/runner-codex": "0.6.2",
58
58
  "@bunny-agent/runner-gemini": "0.6.2",
59
- "@bunny-agent/runner-claude": "0.6.2",
60
- "@bunny-agent/runner-opencode": "0.6.2",
61
59
  "@bunny-agent/runner-harness": "0.1.1-beta.0",
60
+ "@bunny-agent/runner-opencode": "0.6.2",
61
+ "@bunny-agent/runner-claude": "0.6.2",
62
62
  "@bunny-agent/runner-pi": "0.6.4-beta.0"
63
63
  },
64
64
  "scripts": {