@blockrun/clawrouter 0.8.23 → 0.8.24

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.d.ts CHANGED
@@ -478,7 +478,8 @@ declare function getSessionId(headers: Record<string, string | string[] | undefi
478
478
  */
479
479
 
480
480
  /**
481
- * Get the proxy port from environment variable or default.
481
+ * Get the proxy port from pre-loaded configuration.
482
+ * Port is validated at module load time, this just returns the cached value.
482
483
  */
483
484
  declare function getProxyPort(): number;
484
485
  /** Callback info for low balance warning */
package/dist/index.js CHANGED
@@ -1642,9 +1642,15 @@ var DEFAULT_ROUTING_CONFIG = {
1642
1642
  ]
1643
1643
  },
1644
1644
  COMPLEX: {
1645
- primary: "google/gemini-2.5-pro",
1646
- fallback: ["xai/grok-4-0709", "openai/gpt-4o", "openai/gpt-5.2", "anthropic/claude-sonnet-4"]
1647
- // Grok first for cost efficiency, Sonnet as last resort
1645
+ primary: "google/gemini-3-pro-preview",
1646
+ // Latest Gemini - upgraded from 2.5
1647
+ fallback: [
1648
+ "google/gemini-2.5-pro",
1649
+ "xai/grok-4-0709",
1650
+ "openai/gpt-4o",
1651
+ "openai/gpt-5.2",
1652
+ "anthropic/claude-sonnet-4"
1653
+ ]
1648
1654
  },
1649
1655
  REASONING: {
1650
1656
  primary: "xai/grok-4-1-fast-reasoning",
@@ -1652,7 +1658,8 @@ var DEFAULT_ROUTING_CONFIG = {
1652
1658
  fallback: [
1653
1659
  "xai/grok-4-fast-reasoning",
1654
1660
  "openai/o3",
1655
- // Strong reasoning model
1661
+ "openai/o4-mini",
1662
+ // Latest o-series mini
1656
1663
  "deepseek/deepseek-reasoner",
1657
1664
  "moonshot/kimi-k2.5"
1658
1665
  ]
@@ -1695,13 +1702,25 @@ var DEFAULT_ROUTING_CONFIG = {
1695
1702
  },
1696
1703
  COMPLEX: {
1697
1704
  primary: "anthropic/claude-opus-4.5",
1698
- // $15/$75
1699
- fallback: ["openai/gpt-5.2", "anthropic/claude-sonnet-4", "google/gemini-2.5-pro"]
1705
+ // $5/$25 - Latest Opus
1706
+ fallback: [
1707
+ "openai/gpt-5.2-pro",
1708
+ // $21/$168 - Latest GPT pro
1709
+ "google/gemini-3-pro-preview",
1710
+ // Latest Gemini
1711
+ "openai/gpt-5.2",
1712
+ "anthropic/claude-sonnet-4"
1713
+ ]
1700
1714
  },
1701
1715
  REASONING: {
1702
1716
  primary: "openai/o3",
1703
- // $10/$40
1704
- fallback: ["anthropic/claude-opus-4.5", "openai/o1", "google/gemini-2.5-pro"]
1717
+ // $2/$8 - Best value reasoning
1718
+ fallback: [
1719
+ "openai/o4-mini",
1720
+ // Latest o-series
1721
+ "anthropic/claude-opus-4.5",
1722
+ "google/gemini-3-pro-preview"
1723
+ ]
1705
1724
  }
1706
1725
  },
1707
1726
  // Agentic tier configs - models that excel at multi-step autonomous tasks
@@ -1722,13 +1741,23 @@ var DEFAULT_ROUTING_CONFIG = {
1722
1741
  },
1723
1742
  COMPLEX: {
1724
1743
  primary: "anthropic/claude-sonnet-4",
1725
- fallback: ["anthropic/claude-opus-4.5", "openai/gpt-5.2", "xai/grok-4-0709"]
1726
- // Opus 4.5 is 3x cheaper than Opus 4
1744
+ fallback: [
1745
+ "anthropic/claude-opus-4.5",
1746
+ // Latest Opus - best agentic
1747
+ "openai/gpt-5.2",
1748
+ "google/gemini-3-pro-preview",
1749
+ "xai/grok-4-0709"
1750
+ ]
1727
1751
  },
1728
1752
  REASONING: {
1729
1753
  primary: "anthropic/claude-sonnet-4",
1730
1754
  // Strong tool use + reasoning for agentic tasks
1731
- fallback: ["xai/grok-4-fast-reasoning", "moonshot/kimi-k2.5", "deepseek/deepseek-reasoner"]
1755
+ fallback: [
1756
+ "anthropic/claude-opus-4.5",
1757
+ "xai/grok-4-fast-reasoning",
1758
+ "moonshot/kimi-k2.5",
1759
+ "deepseek/deepseek-reasoner"
1760
+ ]
1732
1761
  }
1733
1762
  },
1734
1763
  overrides: {
@@ -2512,6 +2541,16 @@ var FREE_MODEL = "nvidia/gpt-oss-120b";
2512
2541
  var HEARTBEAT_INTERVAL_MS = 2e3;
2513
2542
  var DEFAULT_REQUEST_TIMEOUT_MS = 18e4;
2514
2543
  var DEFAULT_PORT = 8402;
2544
+ var PROXY_PORT = (() => {
2545
+ const envPort = process.env.BLOCKRUN_PROXY_PORT;
2546
+ if (envPort) {
2547
+ const parsed = parseInt(envPort, 10);
2548
+ if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
2549
+ return parsed;
2550
+ }
2551
+ }
2552
+ return DEFAULT_PORT;
2553
+ })();
2515
2554
  var MAX_FALLBACK_ATTEMPTS = 3;
2516
2555
  var HEALTH_CHECK_TIMEOUT_MS = 2e3;
2517
2556
  var RATE_LIMIT_COOLDOWN_MS = 6e4;
@@ -2611,14 +2650,7 @@ function safeWrite(res, data) {
2611
2650
  }
2612
2651
  var BALANCE_CHECK_BUFFER = 1.5;
2613
2652
  function getProxyPort() {
2614
- const envPort = process.env.BLOCKRUN_PROXY_PORT;
2615
- if (envPort) {
2616
- const parsed = parseInt(envPort, 10);
2617
- if (!isNaN(parsed) && parsed > 0 && parsed < 65536) {
2618
- return parsed;
2619
- }
2620
- }
2621
- return DEFAULT_PORT;
2653
+ return PROXY_PORT;
2622
2654
  }
2623
2655
  async function checkExistingProxy(port) {
2624
2656
  const controller = new AbortController();
@@ -3926,19 +3958,15 @@ function injectModelsConfig(logger) {
3926
3958
  { id: "sonnet", alias: "sonnet" },
3927
3959
  { id: "opus", alias: "opus" },
3928
3960
  { id: "haiku", alias: "haiku" },
3929
- { id: "gpt", alias: "gpt" },
3930
3961
  { id: "gpt5", alias: "gpt5" },
3931
3962
  { id: "mini", alias: "mini" },
3932
- { id: "o3", alias: "o3" },
3933
- { id: "grok", alias: "grok" },
3934
3963
  { id: "grok-fast", alias: "grok-fast" },
3935
3964
  { id: "grok-code", alias: "grok-code" },
3936
3965
  { id: "deepseek", alias: "deepseek" },
3937
3966
  { id: "reasoner", alias: "reasoner" },
3938
3967
  { id: "kimi", alias: "kimi" },
3939
3968
  { id: "gemini", alias: "gemini" },
3940
- { id: "flash", alias: "flash" },
3941
- { id: "nvidia", alias: "nvidia" }
3969
+ { id: "flash", alias: "flash" }
3942
3970
  ];
3943
3971
  if (!defaults.models) {
3944
3972
  defaults.models = {};