@peopl-health/nexus 5.76.8 → 5.76.10

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.
@@ -880,6 +880,13 @@ function issuePaths(issues) {
880
880
  return [...new Set(issues.map((issue) => String(issue.path || '').replace(/\[[^\]]*\]/g, '[]')).filter(Boolean))];
881
881
  }
882
882
 
883
+ // Zod issue paths in dotted form with indices collapsed; keys are the DTO's camelCase, not the model's snake_case.
884
+ function dtoIssues(err) {
885
+ const issues = Array.isArray(err?.issues) ? err.issues : [];
886
+ const paths = issues.map((issue) => ({ path: arr(issue.path).map((key) => (typeof key === 'number' ? '[]' : `.${String(key)}`)).join('').replace(/^\./, '') }));
887
+ return paths.some((issue) => issue.path) ? paths : null;
888
+ }
889
+
883
890
  function truncateToCardLimit(elements, repairs) {
884
891
  const excess = elements.length - MAX_TRIAGE_CARDS;
885
892
  if (excess <= 0) return 0;
@@ -992,7 +999,7 @@ async function runPlan({ provider, presetId, casoBase, gate, boundary = null, ra
992
999
  plan = buildPlan(takeaways, elements);
993
1000
  } catch (err) {
994
1001
  lastIssues = [{ path: 'plan', problem: err?.message || 'DTO inválido' }];
995
- if (attempt < PLAN_MAX_ATTEMPTS) { retried(attempt, 'plan_dto_invalid'); continue; }
1002
+ if (attempt < PLAN_MAX_ATTEMPTS) { retried(attempt, 'plan_dto_invalid', dtoIssues(err)); continue; }
996
1003
  return outcome({ attempts: attempt, repairs, failure: { status: 'failed', stage: 'validate', reason: 'plan_invalid', hardRejectIssues: lastIssues } });
997
1004
  }
998
1005
  return outcome({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.76.8",
3
+ "version": "5.76.10",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",