@wix/pathgrade 1.0.29 → 1.0.30

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.
@@ -2,10 +2,20 @@ export function clamp(n) {
2
2
  return Math.max(0, Math.min(1, n));
3
3
  }
4
4
  export function getErrorMessage(error) {
5
- if (error instanceof Error) {
6
- return error.message;
5
+ if (!(error instanceof Error)) {
6
+ return String(error);
7
7
  }
8
- return String(error);
8
+ const seen = new Set();
9
+ let message = error.message;
10
+ let cause = error.cause;
11
+ while (cause instanceof Error && !seen.has(cause)) {
12
+ seen.add(cause);
13
+ if (cause.message && !message.includes(cause.message)) {
14
+ message = message ? `${message}: ${cause.message}` : cause.message;
15
+ }
16
+ cause = cause.cause;
17
+ }
18
+ return message || String(error);
9
19
  }
10
20
  export function matchesExpectation(event, expectation) {
11
21
  if (event.action !== expectation.action)
@@ -73,7 +73,7 @@ async function postAnthropic(apiKey, useCache, body, env) {
73
73
  });
74
74
  if (!response.ok) {
75
75
  const errBody = await response.text().catch(() => '');
76
- throw new Error(`Anthropic API error (${response.status}): ${errBody.slice(0, 300)}`);
76
+ throw new Error(`Anthropic API error (${response.status}) for model ${String(body.model)}: ${errBody.slice(0, 300)}`);
77
77
  }
78
78
  return await response.json();
79
79
  }
@@ -116,7 +116,10 @@ export const anthropicProvider = {
116
116
  };
117
117
  }
118
118
  catch (error) {
119
- throw new Error(`Anthropic API call failed`, { cause: error });
119
+ // Reporting seams only propagate error.message, never error.cause.
120
+ const reason = error instanceof Error ? error.message : String(error);
121
+ const modelTag = reason.includes(model) ? '' : ` (model ${model})`;
122
+ throw new Error(`Anthropic API call failed${modelTag}: ${reason}`, { cause: error });
120
123
  }
121
124
  },
122
125
  async callWithTools(messages, opts) {
package/dist/utils/llm.js CHANGED
@@ -114,6 +114,7 @@ export function createLLMClient(arg, legacyAgentName) {
114
114
  const toTry = narrowed.length > 0 ? narrowed : candidates;
115
115
  let lastError;
116
116
  let lastFailed;
117
+ const failures = [];
117
118
  for (const provider of toTry) {
118
119
  if (!await provider.isAvailable(opts.env))
119
120
  continue;
@@ -128,6 +129,7 @@ export function createLLMClient(arg, legacyAgentName) {
128
129
  catch (error) {
129
130
  lastError = error;
130
131
  lastFailed = { name: provider.name, reason: lastError.message };
132
+ failures.push(lastFailed);
131
133
  // Fall through to next provider
132
134
  }
133
135
  }
@@ -149,11 +151,15 @@ export function createLLMClient(arg, legacyAgentName) {
149
151
  catch (error) {
150
152
  lastError = error;
151
153
  lastFailed = { name: provider.name, reason: lastError.message };
154
+ failures.push(lastFailed);
152
155
  }
153
156
  }
154
157
  }
155
- if (lastError)
156
- throw lastError;
158
+ if (lastError) {
159
+ if (failures.length <= 1)
160
+ throw lastError;
161
+ throw new Error(`All LLM providers failed: ${failures.map((f) => `${f.name}: ${f.reason}`).join('; ')}`, { cause: lastError });
162
+ }
157
163
  if (agentName === 'claude') {
158
164
  throw new Error('Claude CLI not found on PATH. Install with: npm install -g @anthropic-ai/claude-code');
159
165
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/pathgrade",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "packageManager": "yarn@4.12.0",
5
5
  "description": "Evaluate whether AI agents discover and use your skills correctly",
6
6
  "exports": {
@@ -140,5 +140,5 @@
140
140
  "typescript": "^5.9.3",
141
141
  "zod": "4.3.6"
142
142
  },
143
- "falconPackageHash": "126198d020df14b3e6fceef3b0325ac5e84411c5e1b544a0167de604"
143
+ "falconPackageHash": "c85431c64d766806f41ca2adad9d390e73dc8d09a2feea2ae9285a1c"
144
144
  }