@autonoma-ai/planner 0.1.16 → 0.1.17

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.js CHANGED
@@ -284,9 +284,21 @@ function chainMessages(err) {
284
284
  }
285
285
  return parts.join(" \u2190 ").toLowerCase();
286
286
  }
287
+ function apiStatusOf(err) {
288
+ let cur = err;
289
+ for (let depth = 0; cur != null && depth < 10; depth++) {
290
+ if (APICallError.isInstance(cur)) return cur.statusCode;
291
+ if (RetryError.isInstance(cur)) {
292
+ cur = cur.lastError;
293
+ continue;
294
+ }
295
+ cur = cur instanceof Error ? cur.cause : void 0;
296
+ }
297
+ return void 0;
298
+ }
287
299
  function describeKnownError(err) {
288
300
  const msg = chainMessages(err);
289
- const status = APICallError.isInstance(err) ? err.statusCode : void 0;
301
+ const status = apiStatusOf(err);
290
302
  const looksLikeAuth = msg.includes("missing authentication header") || msg.includes("no auth credentials") || msg.includes("not authenticated") || msg.includes("unauthorized") || msg.includes("user not found") || status === 401 || status === 403;
291
303
  if (looksLikeAuth) {
292
304
  return {
@@ -312,6 +324,12 @@ function describeKnownError(err) {
312
324
  hint: "Wait a minute and re-run. If it persists, reach out to support."
313
325
  };
314
326
  }
327
+ if (status === 404 || status === 502 || status === 503 || msg.includes("llm_proxy_unconfigured")) {
328
+ return {
329
+ title: "The Autonoma planner service is temporarily unavailable.",
330
+ hint: "This is on our side, not your setup - retry in a minute, and contact support if it keeps happening. If you set a custom AUTONOMA_API_URL, confirm it points at a host running the planner."
331
+ };
332
+ }
315
333
  return void 0;
316
334
  }
317
335
  function supportReference(extra = {}) {