@botbotgo/better-call 0.1.40 → 0.1.41

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/package.json +1 -1
  2. package/scripts/demo.mjs +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/better-call",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "Small-model tool-call reliability layer for LangChain and custom agent runtimes.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
package/scripts/demo.mjs CHANGED
@@ -76,7 +76,7 @@ const stockQuote = {
76
76
  throw new Error("Invalid ticker: expected a non-empty string.");
77
77
  }
78
78
 
79
- if (!VALID_MARKETS.includes(market)) {
79
+ if (typeof market !== "string" || !VALID_MARKETS.includes(market)) {
80
80
  throw new Error("Invalid market: expected one of US, HK, CN.");
81
81
  }
82
82
 
@@ -181,7 +181,11 @@ const gatewayRepair =
181
181
  errorCause: null,
182
182
  };
183
183
 
184
- const repairedCall = reliableResult?.calls?.[0] ?? null;
184
+ // Missing or empty calls are expected in some demo/error paths; normalize to null for reporting.
185
+ const repairedCall =
186
+ Array.isArray(reliableResult?.calls) && reliableResult.calls.length > 0
187
+ ? reliableResult.calls[0]
188
+ : null;
185
189
 
186
190
  const report = {
187
191
  wrappedTool: {