@project-ava-supernova/core 0.2.178 → 0.2.180

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 (141) hide show
  1. package/dist/agent/social-craft.d.ts +1 -1
  2. package/dist/agent/social-craft.js +1 -1
  3. package/dist/agent/system-prompt.d.ts +1 -1
  4. package/dist/agent/system-prompt.d.ts.map +1 -1
  5. package/dist/agent/system-prompt.js +1185 -1156
  6. package/dist/agent/system-prompt.js.map +1 -1
  7. package/dist/config/personality.js +1 -1
  8. package/dist/creative/folder-export.d.ts +7 -0
  9. package/dist/creative/folder-export.d.ts.map +1 -1
  10. package/dist/creative/folder-export.js +53 -46
  11. package/dist/creative/folder-export.js.map +1 -1
  12. package/dist/creative/library-upload.d.ts +2 -1
  13. package/dist/creative/library-upload.d.ts.map +1 -1
  14. package/dist/creative/library-upload.js +73 -2
  15. package/dist/creative/library-upload.js.map +1 -1
  16. package/dist/creative/project-copy.d.ts +49 -0
  17. package/dist/creative/project-copy.d.ts.map +1 -0
  18. package/dist/creative/project-copy.js +149 -0
  19. package/dist/creative/project-copy.js.map +1 -0
  20. package/dist/creative/store-profiles.d.ts +10 -1
  21. package/dist/creative/store-profiles.d.ts.map +1 -1
  22. package/dist/creative/store-profiles.js +98 -54
  23. package/dist/creative/store-profiles.js.map +1 -1
  24. package/dist/docs/content/features.d.ts.map +1 -1
  25. package/dist/docs/content/features.js +20 -13
  26. package/dist/docs/content/features.js.map +1 -1
  27. package/dist/docs/content/troubleshooting.d.ts.map +1 -1
  28. package/dist/docs/content/troubleshooting.js +9 -0
  29. package/dist/docs/content/troubleshooting.js.map +1 -1
  30. package/dist/docs/i18n/translations.d.ts.map +1 -1
  31. package/dist/docs/i18n/translations.js +1 -1
  32. package/dist/docs/i18n/translations.js.map +1 -1
  33. package/dist/health/room-directives.d.ts +16 -0
  34. package/dist/health/room-directives.d.ts.map +1 -0
  35. package/dist/health/room-directives.js +30 -0
  36. package/dist/health/room-directives.js.map +1 -0
  37. package/dist/health/safety.d.ts +166 -0
  38. package/dist/health/safety.d.ts.map +1 -0
  39. package/dist/health/safety.js +336 -0
  40. package/dist/health/safety.js.map +1 -0
  41. package/dist/health/share-list.d.ts +28 -0
  42. package/dist/health/share-list.d.ts.map +1 -0
  43. package/dist/health/share-list.js +71 -0
  44. package/dist/health/share-list.js.map +1 -0
  45. package/dist/health/types.d.ts +4 -0
  46. package/dist/health/types.d.ts.map +1 -1
  47. package/dist/i18n/keep-english.d.ts.map +1 -1
  48. package/dist/i18n/keep-english.js +0 -22
  49. package/dist/i18n/keep-english.js.map +1 -1
  50. package/dist/i18n/locales/ar.d.ts.map +1 -1
  51. package/dist/i18n/locales/ar.js +460 -226
  52. package/dist/i18n/locales/ar.js.map +1 -1
  53. package/dist/i18n/locales/de.d.ts.map +1 -1
  54. package/dist/i18n/locales/de.js +460 -226
  55. package/dist/i18n/locales/de.js.map +1 -1
  56. package/dist/i18n/locales/en.d.ts +460 -226
  57. package/dist/i18n/locales/en.d.ts.map +1 -1
  58. package/dist/i18n/locales/en.js +462 -226
  59. package/dist/i18n/locales/en.js.map +1 -1
  60. package/dist/i18n/locales/es.d.ts.map +1 -1
  61. package/dist/i18n/locales/es.js +460 -226
  62. package/dist/i18n/locales/es.js.map +1 -1
  63. package/dist/i18n/locales/fr.d.ts.map +1 -1
  64. package/dist/i18n/locales/fr.js +460 -226
  65. package/dist/i18n/locales/fr.js.map +1 -1
  66. package/dist/i18n/locales/hi.d.ts.map +1 -1
  67. package/dist/i18n/locales/hi.js +460 -226
  68. package/dist/i18n/locales/hi.js.map +1 -1
  69. package/dist/i18n/locales/id.d.ts.map +1 -1
  70. package/dist/i18n/locales/id.js +460 -226
  71. package/dist/i18n/locales/id.js.map +1 -1
  72. package/dist/i18n/locales/it.d.ts.map +1 -1
  73. package/dist/i18n/locales/it.js +460 -226
  74. package/dist/i18n/locales/it.js.map +1 -1
  75. package/dist/i18n/locales/ja.d.ts.map +1 -1
  76. package/dist/i18n/locales/ja.js +460 -226
  77. package/dist/i18n/locales/ja.js.map +1 -1
  78. package/dist/i18n/locales/ko.d.ts.map +1 -1
  79. package/dist/i18n/locales/ko.js +460 -226
  80. package/dist/i18n/locales/ko.js.map +1 -1
  81. package/dist/i18n/locales/nl.d.ts.map +1 -1
  82. package/dist/i18n/locales/nl.js +460 -226
  83. package/dist/i18n/locales/nl.js.map +1 -1
  84. package/dist/i18n/locales/pl.d.ts.map +1 -1
  85. package/dist/i18n/locales/pl.js +460 -226
  86. package/dist/i18n/locales/pl.js.map +1 -1
  87. package/dist/i18n/locales/pt.d.ts.map +1 -1
  88. package/dist/i18n/locales/pt.js +460 -226
  89. package/dist/i18n/locales/pt.js.map +1 -1
  90. package/dist/i18n/locales/ru.d.ts.map +1 -1
  91. package/dist/i18n/locales/ru.js +460 -226
  92. package/dist/i18n/locales/ru.js.map +1 -1
  93. package/dist/i18n/locales/th.d.ts.map +1 -1
  94. package/dist/i18n/locales/th.js +460 -226
  95. package/dist/i18n/locales/th.js.map +1 -1
  96. package/dist/i18n/locales/tr.d.ts.map +1 -1
  97. package/dist/i18n/locales/tr.js +460 -226
  98. package/dist/i18n/locales/tr.js.map +1 -1
  99. package/dist/i18n/locales/uk.d.ts.map +1 -1
  100. package/dist/i18n/locales/uk.js +460 -226
  101. package/dist/i18n/locales/uk.js.map +1 -1
  102. package/dist/i18n/locales/vi.d.ts.map +1 -1
  103. package/dist/i18n/locales/vi.js +460 -226
  104. package/dist/i18n/locales/vi.js.map +1 -1
  105. package/dist/i18n/locales/zh-CN.d.ts.map +1 -1
  106. package/dist/i18n/locales/zh-CN.js +460 -226
  107. package/dist/i18n/locales/zh-CN.js.map +1 -1
  108. package/dist/i18n/locales/zh-TW.d.ts.map +1 -1
  109. package/dist/i18n/locales/zh-TW.js +460 -226
  110. package/dist/i18n/locales/zh-TW.js.map +1 -1
  111. package/dist/index.d.ts +8 -1
  112. package/dist/index.d.ts.map +1 -1
  113. package/dist/index.js +4 -1
  114. package/dist/index.js.map +1 -1
  115. package/dist/tools/design-studio-tools.d.ts +1 -1
  116. package/dist/tools/design-studio-tools.d.ts.map +1 -1
  117. package/dist/tools/design-studio-tools.js +5 -3
  118. package/dist/tools/design-studio-tools.js.map +1 -1
  119. package/dist/tools/health-catalogue-search.d.ts.map +1 -1
  120. package/dist/tools/health-catalogue-search.js +47 -5
  121. package/dist/tools/health-catalogue-search.js.map +1 -1
  122. package/dist/tools/health-plan-create.d.ts +39 -1
  123. package/dist/tools/health-plan-create.d.ts.map +1 -1
  124. package/dist/tools/health-plan-create.js +77 -0
  125. package/dist/tools/health-plan-create.js.map +1 -1
  126. package/dist/tools/health-plan-update-day.d.ts.map +1 -1
  127. package/dist/tools/health-plan-update-day.js +6 -1
  128. package/dist/tools/health-plan-update-day.js.map +1 -1
  129. package/dist/tools/tool-registry.d.ts.map +1 -1
  130. package/dist/tools/tool-registry.js +24 -6
  131. package/dist/tools/tool-registry.js.map +1 -1
  132. package/dist/tools/tool-request-words.d.ts.map +1 -1
  133. package/dist/tools/tool-request-words.js +1 -0
  134. package/dist/tools/tool-request-words.js.map +1 -1
  135. package/dist/tools/types.d.ts +22 -1
  136. package/dist/tools/types.d.ts.map +1 -1
  137. package/dist/tools/write-recipe.d.ts +3 -0
  138. package/dist/tools/write-recipe.d.ts.map +1 -1
  139. package/dist/tools/write-recipe.js +17 -5
  140. package/dist/tools/write-recipe.js.map +1 -1
  141. package/package.json +6 -1
@@ -0,0 +1,16 @@
1
+ /**
2
+ * "Ask Ava" from the new-plan wizard (11 Nov 2026).
3
+ *
4
+ * The wizard lives on the health page, and Ask Ava hands the chosen plan type
5
+ * to the HEALTH ROOM — where Ava already has their profile and the catalogue.
6
+ * Both apps used to send the main chat's palette directive here, which tells
7
+ * her to call open_health_room: a room she was already in. So she was told
8
+ * to do something she could not, and improvised. This is the in-room version,
9
+ * shared by the extension host and the IDE so the two say the same words.
10
+ */
11
+ export type WizardPlanType = 'meal' | 'fitness' | 'combined';
12
+ export declare function healthRoomPlanDirective(type: WizardPlanType): {
13
+ label: string;
14
+ directive: string;
15
+ };
16
+ //# sourceMappingURL=room-directives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-directives.d.ts","sourceRoot":"","sources":["../../src/health/room-directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAE7D,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAmBlG"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * "Ask Ava" from the new-plan wizard (11 Nov 2026).
3
+ *
4
+ * The wizard lives on the health page, and Ask Ava hands the chosen plan type
5
+ * to the HEALTH ROOM — where Ava already has their profile and the catalogue.
6
+ * Both apps used to send the main chat's palette directive here, which tells
7
+ * her to call open_health_room: a room she was already in. So she was told
8
+ * to do something she could not, and improvised. This is the in-room version,
9
+ * shared by the extension host and the IDE so the two say the same words.
10
+ */
11
+ export function healthRoomPlanDirective(type) {
12
+ const label = type === 'meal' ? 'Meal plan' : type === 'fitness' ? 'Fitness plan' : 'Combined plan';
13
+ const needs = type === 'meal'
14
+ ? 'allergies, diet, dislikes, cooking time and level, household'
15
+ : type === 'fitness'
16
+ ? 'goal, experience, which days they train, kit, injuries'
17
+ : 'goal, experience, training days, kit, injuries, allergies, diet, dislikes, cooking time';
18
+ return {
19
+ label,
20
+ directive: `[Plan wizard] The user chose "Ask Ava" in the new-plan wizard for a ${type} plan. ` +
21
+ `Their intent is confirmed — do NOT ask whether they want a plan, and do NOT ask the type ` +
22
+ `(${type} is locked in). You are already in the health room, with their profile and the catalogue.\n` +
23
+ `1. Check their profile for what a ${type} plan needs (${needs}). Ask for anything missing with ` +
24
+ `health_profile_ask, one at a time — never plan around a gap that matters for safety.\n` +
25
+ `2. Then build it with them: plans are 1, 3 or 7 days; ask how long and when it starts, a title, and ` +
26
+ `whether to start it now or keep it as a draft, then save it with health_plan_create.\n` +
27
+ `Open with one short, warm line — no long narration.`,
28
+ };
29
+ }
30
+ //# sourceMappingURL=room-directives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-directives.js","sourceRoot":"","sources":["../../src/health/room-directives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,UAAU,uBAAuB,CAAC,IAAoB;IAC1D,MAAM,KAAK,GAAG,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,eAAe,CAAC;IACpG,MAAM,KAAK,GAAG,IAAI,KAAK,MAAM;QAC3B,CAAC,CAAC,8DAA8D;QAChE,CAAC,CAAC,IAAI,KAAK,SAAS;YAClB,CAAC,CAAC,wDAAwD;YAC1D,CAAC,CAAC,yFAAyF,CAAC;IAChG,OAAO;QACL,KAAK;QACL,SAAS,EACP,uEAAuE,IAAI,SAAS;YACpF,2FAA2F;YAC3F,IAAI,IAAI,6FAA6F;YACrG,qCAAqC,IAAI,gBAAgB,KAAK,mCAAmC;YACjG,wFAAwF;YACxF,sGAAsG;YACtG,wFAAwF;YACxF,qDAAqD;KACxD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * Health safety — the ONE set of rules every route into a plan uses
3
+ * (Health & Nutrition, Part 1, 11 Nov 2026).
4
+ *
5
+ * Until now these rules lived only in the web generate route
6
+ * (web/src/lib/health/plan-pools.ts). A nut allergy was a guarantee when the
7
+ * server generated a plan, and a polite request everywhere else: when Ava
8
+ * built a plan in the health room, when someone built one by hand, when a
9
+ * ready-made plan was started, and in the recipe search. Same person, same
10
+ * allergy, four different levels of safety depending on which button they
11
+ * pressed. That is the bug this file exists to end.
12
+ *
13
+ * Behaviour is carried over EXACTLY from plan-pools.ts (and, before it, the
14
+ * companion's health-safety service), because every rule below was learned
15
+ * the hard way on the live library:
16
+ *
17
+ * - Allergens match a closed vocabulary EXACTLY, with real synonyms.
18
+ * "Shellfish" contains "fish" and they are different allergens.
19
+ * - A recipe is blocked if its ingredient-derived allergen tags name one of
20
+ * theirs (what the dish CONTAINS).
21
+ * - It must ALSO positively assert it is free from each allergen a flag can
22
+ * prove ("nut_free" …). No flag is UNKNOWN, and unknown is unsafe: it is
23
+ * blocked, with that reason, not waved through.
24
+ * - Allergens the library has no flag for (fish, sesame, mustard …) are
25
+ * checked on the ingredient tags only and NAMED as unverified — a plan is
26
+ * never called clear when it is only unchecked.
27
+ * - Diets must all be satisfied (a vegan plan with chicken is useless).
28
+ * - Injuries: an 'avoid' contraindication blocks; 'caution' / 'modify'
29
+ * WARN — they are things to do differently, not never, and removing them
30
+ * would quietly shrink a programme for a manageable condition.
31
+ * Injury matching over-matches on purpose: a warning costs a tap, a miss
32
+ * costs an injury.
33
+ * - Kit: exact equipment slugs (canPerformWithEquipment). An empty profile
34
+ * list means "not stated", never "owns nothing".
35
+ *
36
+ * Likes and dislikes are NOT here. They are preferences: they steer, they
37
+ * never block.
38
+ *
39
+ * PRIVACY: this runs on the person's computer against their local profile.
40
+ * Facts about recipes and exercises are fetched by slug; the profile is never
41
+ * sent anywhere to be checked.
42
+ */
43
+ import type { HealthPlanDay } from './types.js';
44
+ export interface SafetyProfile {
45
+ allergens?: string[];
46
+ dietary?: string[];
47
+ injuries?: string[];
48
+ equipment_available?: string[];
49
+ }
50
+ /** Pull the hard-rule fields out of a stored health profile (any shape tolerated). */
51
+ export declare function safetyProfileFrom(raw: unknown): SafetyProfile;
52
+ export declare const hasHardRules: (p: SafetyProfile) => boolean;
53
+ /** True when two allergen names mean the same allergen. Exact, not fuzzy. */
54
+ export declare function sameAllergen(a0: string, b0: string): boolean;
55
+ /** The flag that positively proves this allergen absent, or null when the library has none. */
56
+ export declare function freeFromFlagFor(allergen: string): string | null;
57
+ /** Injuries and diets. Over-matches on purpose: a warning costs a tap, a miss costs an injury. */
58
+ export declare function refersToSame(a0: string, b0: string): boolean;
59
+ export interface RecipeFacts {
60
+ slug: string;
61
+ name?: string;
62
+ /** Ingredient-derived allergen tags: what the dish CONTAINS. */
63
+ allergens: string[];
64
+ /** Free-from flags on the version being checked: positive assertions of absence. */
65
+ flags: string[];
66
+ /** Diets the version satisfies. */
67
+ diets: string[];
68
+ }
69
+ export interface ExerciseFacts {
70
+ slug: string;
71
+ name?: string;
72
+ contraindications: Array<{
73
+ name: string;
74
+ severity: string;
75
+ note?: string | null;
76
+ }>;
77
+ equipment: string[];
78
+ /** Easier versions, for "try this instead". */
79
+ regressions?: Array<{
80
+ slug: string;
81
+ name: string;
82
+ }>;
83
+ }
84
+ export type SafetyVerdict = 'ok' | 'warn' | 'blocked';
85
+ export interface SafetyResult {
86
+ slug: string;
87
+ name?: string;
88
+ verdict: SafetyVerdict;
89
+ /** Plain-English reasons, one per rule broken or caution raised. */
90
+ reasons: string[];
91
+ /** Allergens the library cannot speak to for this item — never reported as clear. */
92
+ unverified: string[];
93
+ /** For an exercise warning: easier versions to offer. */
94
+ alternatives?: Array<{
95
+ slug: string;
96
+ name: string;
97
+ }>;
98
+ }
99
+ /**
100
+ * Profile choices the library records as free-from FLAGS, not diets
101
+ * (read from the live `dietary_flags` table, 11 Nov 2026). The diets table
102
+ * holds only Omnivore, Vegetarian, Vegan, Pescatarian, Keto, Paleo,
103
+ * Mediterranean, Low Carb and Whole30.
104
+ */
105
+ export declare const DIET_FLAGS: ReadonlySet<string>;
106
+ export declare function checkRecipe(facts: RecipeFacts, profile: SafetyProfile): SafetyResult;
107
+ export declare function checkExercise(facts: ExerciseFacts, profile: SafetyProfile): SafetyResult;
108
+ export interface SafetyFacts {
109
+ recipes: Record<string, RecipeFacts>;
110
+ exercises: Record<string, ExerciseFacts>;
111
+ }
112
+ /**
113
+ * Facts for the given slugs. `level` picks which recipe version's flags and
114
+ * diets to read (their cooking level), as the generate route does.
115
+ * Throws when the facts cannot be fetched: callers must treat that as
116
+ * "could not check", never as "safe".
117
+ */
118
+ export declare function fetchSafetyFacts(slugs: {
119
+ recipes?: string[];
120
+ exercises?: string[];
121
+ level?: string | null;
122
+ }, fetchImpl?: typeof fetch): Promise<SafetyFacts>;
123
+ export interface PlanSafetyReport {
124
+ blocked: SafetyResult[];
125
+ warnings: SafetyResult[];
126
+ /** Allergens no recipe in the plan could be checked for. */
127
+ unverified: string[];
128
+ /** Slugs the library knew nothing about (not checked, said so). */
129
+ unknown: string[];
130
+ }
131
+ /** Check every recipe and exercise a set of plan days refers to. */
132
+ export declare function checkPlanItems(refs: {
133
+ recipes: string[];
134
+ exercises: string[];
135
+ }, facts: SafetyFacts, profile: SafetyProfile): PlanSafetyReport;
136
+ /** Their hard rules and cooking level, from the profile both apps share. */
137
+ export declare function loadSafetyProfile(): Promise<{
138
+ profile: SafetyProfile;
139
+ level: string | null;
140
+ }>;
141
+ export interface PlanScreen {
142
+ /** False: nothing may be saved; `message` says why, item by item. */
143
+ ok: boolean;
144
+ /** For the tool to hand back: refusal reasons, or cautions to tell them about. */
145
+ message: string;
146
+ report?: PlanSafetyReport;
147
+ }
148
+ /**
149
+ * Check plan days against their hard rules before anything is saved.
150
+ *
151
+ * - Anything breaking a hard rule refuses the WHOLE save, naming each item
152
+ * and why, so Ava swaps it and tries again. A plan with one unsafe meal is
153
+ * not "mostly fine".
154
+ * - Cautions save, with a note telling Ava to say so and offer the easier
155
+ * version.
156
+ * - If they have hard rules and the facts cannot be fetched, nothing is saved:
157
+ * "could not check" is never treated as "safe".
158
+ * - Free-text items (no library ref) cannot be checked; they are NAMED, so
159
+ * she can tell the person rather than imply they were.
160
+ */
161
+ export declare function screenPlanDays(days: HealthPlanDay[], opts?: {
162
+ fetchImpl?: typeof fetch;
163
+ profile?: SafetyProfile;
164
+ level?: string | null;
165
+ }): Promise<PlanScreen>;
166
+ //# sourceMappingURL=safety.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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AE,MAAM,GAAG,IAAI,CAAA;CAAE,EAC1E,SAAS,GAAE,OAAO,KAAa,GAC9B,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,4DAA4D;IAC5D,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,mEAAmE;IACnE,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,EAAE,CAAA;CAAE,EAChD,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,aAAa,GACrB,gBAAgB,CAmBlB;AAMD,4EAA4E;AAC5E,wBAAsB,iBAAiB,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,CAQnG;AAED,MAAM,WAAW,UAAU;IACzB,qEAAqE;IACrE,EAAE,EAAE,OAAO,CAAC;IACZ,kFAAkF;IAClF,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,aAAa,EAAE,EACrB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IAAC,OAAO,CAAC,EAAE,aAAa,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,GACtF,OAAO,CAAC,UAAU,CAAC,CAkDrB"}
@@ -0,0 +1,336 @@
1
+ /**
2
+ * Health safety — the ONE set of rules every route into a plan uses
3
+ * (Health & Nutrition, Part 1, 11 Nov 2026).
4
+ *
5
+ * Until now these rules lived only in the web generate route
6
+ * (web/src/lib/health/plan-pools.ts). A nut allergy was a guarantee when the
7
+ * server generated a plan, and a polite request everywhere else: when Ava
8
+ * built a plan in the health room, when someone built one by hand, when a
9
+ * ready-made plan was started, and in the recipe search. Same person, same
10
+ * allergy, four different levels of safety depending on which button they
11
+ * pressed. That is the bug this file exists to end.
12
+ *
13
+ * Behaviour is carried over EXACTLY from plan-pools.ts (and, before it, the
14
+ * companion's health-safety service), because every rule below was learned
15
+ * the hard way on the live library:
16
+ *
17
+ * - Allergens match a closed vocabulary EXACTLY, with real synonyms.
18
+ * "Shellfish" contains "fish" and they are different allergens.
19
+ * - A recipe is blocked if its ingredient-derived allergen tags name one of
20
+ * theirs (what the dish CONTAINS).
21
+ * - It must ALSO positively assert it is free from each allergen a flag can
22
+ * prove ("nut_free" …). No flag is UNKNOWN, and unknown is unsafe: it is
23
+ * blocked, with that reason, not waved through.
24
+ * - Allergens the library has no flag for (fish, sesame, mustard …) are
25
+ * checked on the ingredient tags only and NAMED as unverified — a plan is
26
+ * never called clear when it is only unchecked.
27
+ * - Diets must all be satisfied (a vegan plan with chicken is useless).
28
+ * - Injuries: an 'avoid' contraindication blocks; 'caution' / 'modify'
29
+ * WARN — they are things to do differently, not never, and removing them
30
+ * would quietly shrink a programme for a manageable condition.
31
+ * Injury matching over-matches on purpose: a warning costs a tap, a miss
32
+ * costs an injury.
33
+ * - Kit: exact equipment slugs (canPerformWithEquipment). An empty profile
34
+ * list means "not stated", never "owns nothing".
35
+ *
36
+ * Likes and dislikes are NOT here. They are preferences: they steer, they
37
+ * never block.
38
+ *
39
+ * PRIVACY: this runs on the person's computer against their local profile.
40
+ * Facts about recipes and exercises are fetched by slug; the profile is never
41
+ * sent anywhere to be checked.
42
+ */
43
+ import { readFile } from 'node:fs/promises';
44
+ import { join } from 'node:path';
45
+ import { canPerformWithEquipment } from './equipment.js';
46
+ import { AVA_HOME } from '../core/constants.js';
47
+ /** Pull the hard-rule fields out of a stored health profile (any shape tolerated). */
48
+ export function safetyProfileFrom(raw) {
49
+ const p = (raw && typeof raw === 'object' ? raw : {});
50
+ const c = (p.constraints && typeof p.constraints === 'object' ? p.constraints : {});
51
+ const arr = (v) => (Array.isArray(v) ? v.filter((x) => typeof x === 'string' && x.trim().length > 0) : []);
52
+ return {
53
+ allergens: arr(c.allergens),
54
+ dietary: arr(c.dietary),
55
+ injuries: arr(c.injuries),
56
+ equipment_available: arr(c.equipment_available),
57
+ };
58
+ }
59
+ export const hasHardRules = (p) => !!(p.allergens?.length || p.dietary?.length || p.injuries?.length || p.equipment_available?.length);
60
+ // ── Matching ─────────────────────────────────────────────────────────────────
61
+ /** Allergen names with their real synonyms, matched EXACTLY. */
62
+ const ALLERGEN_SYNONYMS = [
63
+ { names: ['peanut', 'peanuts', 'groundnut', 'groundnuts', 'arachis'], flag: 'nut_free' },
64
+ { names: ['tree nut', 'tree nuts', 'treenut', 'treenuts', 'tree_nuts', 'tree_nut', 'nuts', 'nut'], flag: 'nut_free' },
65
+ { names: ['gluten', 'wheat'], flag: 'gluten_free' },
66
+ { names: ['dairy', 'milk', 'lactose'], flag: 'dairy_free' },
67
+ { names: ['egg', 'eggs'], flag: 'egg_free' },
68
+ { names: ['soy', 'soya', 'soybean', 'soybeans'], flag: 'soy_free' },
69
+ { names: ['shellfish', 'crustacean', 'crustaceans', 'prawn', 'prawns', 'shrimp', 'crab'], flag: 'shellfish_free' },
70
+ // No free-from flag exists for these: checked on the ingredient tags only.
71
+ { names: ['fish'], flag: null },
72
+ { names: ['sesame'], flag: null },
73
+ { names: ['sulphite', 'sulphites', 'sulfite', 'sulfites'], flag: null },
74
+ { names: ['celery', 'celeriac'], flag: null },
75
+ { names: ['mustard'], flag: null },
76
+ { names: ['lupin', 'lupins', 'lupine'], flag: null },
77
+ { names: ['mollusc', 'molluscs', 'mollusk', 'mollusks'], flag: null },
78
+ ];
79
+ const norm = (s) => s.trim().toLowerCase().replace(/_/g, ' ');
80
+ /** True when two allergen names mean the same allergen. Exact, not fuzzy. */
81
+ export function sameAllergen(a0, b0) {
82
+ const a = norm(a0), b = norm(b0);
83
+ if (!a || !b)
84
+ return false;
85
+ if (a === b)
86
+ return true;
87
+ return ALLERGEN_SYNONYMS.some((g) => g.names.map(norm).includes(a) && g.names.map(norm).includes(b));
88
+ }
89
+ /** The flag that positively proves this allergen absent, or null when the library has none. */
90
+ export function freeFromFlagFor(allergen) {
91
+ const a = norm(allergen);
92
+ return ALLERGEN_SYNONYMS.find((g) => g.names.map(norm).includes(a))?.flag ?? null;
93
+ }
94
+ const NOISE = new Set([
95
+ 'left', 'right', 'both', 'my', 'a', 'an', 'the', 'and', 'or', 'of', 'in', 'on',
96
+ 'acute', 'chronic', 'old', 'bad', 'dodgy', 'sore', 'weak', 'injury', 'injured',
97
+ 'pain', 'painful', 'problem', 'problems', 'issue', 'issues', 'condition',
98
+ 'history', 'post', 'op', 'surgery', 'recovering', 'from', 'mild', 'slight',
99
+ ]);
100
+ function tokens(s) {
101
+ return new Set(s.toLowerCase().replace(/[^a-z0-9\s-]/g, ' ').split(/[\s-]+/).filter((w) => w.length > 2 && !NOISE.has(w)));
102
+ }
103
+ /** Injuries and diets. Over-matches on purpose: a warning costs a tap, a miss costs an injury. */
104
+ export function refersToSame(a0, b0) {
105
+ const a = a0.trim().toLowerCase().replace(/_/g, ' ');
106
+ const b = b0.trim().toLowerCase().replace(/_/g, ' ');
107
+ if (!a || !b)
108
+ return false;
109
+ if (a === b || b.includes(a) || a.includes(b))
110
+ return true;
111
+ const ta = tokens(a), tb = tokens(b);
112
+ for (const w of ta)
113
+ if (tb.has(w))
114
+ return true;
115
+ // Same word, different ending ("pregnant" / "pregnancy"); short body-part
116
+ // words still need an exact match, so this cannot collapse everything.
117
+ for (const w of ta) {
118
+ if (w.length < 5)
119
+ continue;
120
+ for (const v of tb)
121
+ if (v.length >= 5 && w.slice(0, 5) === v.slice(0, 5))
122
+ return true;
123
+ }
124
+ return false;
125
+ }
126
+ /**
127
+ * Profile choices the library records as free-from FLAGS, not diets
128
+ * (read from the live `dietary_flags` table, 11 Nov 2026). The diets table
129
+ * holds only Omnivore, Vegetarian, Vegan, Pescatarian, Keto, Paleo,
130
+ * Mediterranean, Low Carb and Whole30.
131
+ */
132
+ export const DIET_FLAGS = new Set([
133
+ 'gluten_free', 'dairy_free', 'halal', 'kosher', 'low_fodmap', 'low_sodium', 'no_added_sugar',
134
+ 'hindu_vegetarian', 'jain_friendly', 'no_pork', 'no_beef', 'no_alcohol', 'lenten_friendly',
135
+ ]);
136
+ // ── The checks ───────────────────────────────────────────────────────────────
137
+ export function checkRecipe(facts, profile) {
138
+ const reasons = [];
139
+ const unverified = [];
140
+ const allergens = profile.allergens ?? [];
141
+ for (const a of allergens) {
142
+ if (facts.allergens.some((h) => sameAllergen(a, h))) {
143
+ reasons.push(`contains ${a}`);
144
+ continue;
145
+ }
146
+ const flag = freeFromFlagFor(a);
147
+ if (flag) {
148
+ if (!facts.flags.includes(flag))
149
+ reasons.push(`not confirmed free from ${a}`);
150
+ }
151
+ else {
152
+ unverified.push(a);
153
+ }
154
+ }
155
+ for (const d of profile.dietary ?? []) {
156
+ // Some choices on the profile are DIETS in the library (vegan, keto…), and
157
+ // some are free-from FLAGS (gluten_free, dairy_free, halal, kosher,
158
+ // low_fodmap…). Checking a flag against the diet list found nothing, so
159
+ // until 11 Nov 2026 the generator threw out EVERY recipe for anyone who
160
+ // ticked gluten-free or halal. A flag is a positive assertion: missing
161
+ // means not confirmed, and not confirmed does not go in a plan.
162
+ const asFlag = d.trim().toLowerCase().replace(/[\s-]+/g, '_');
163
+ if (DIET_FLAGS.has(asFlag)) {
164
+ if (!facts.flags.includes(asFlag))
165
+ reasons.push(`not confirmed ${d.replace(/_/g, ' ')}`);
166
+ }
167
+ else if (!facts.diets.some((rd) => refersToSame(d, rd))) {
168
+ reasons.push(`not ${d.replace(/_/g, ' ')}`);
169
+ }
170
+ }
171
+ return { slug: facts.slug, name: facts.name, verdict: reasons.length ? 'blocked' : 'ok', reasons, unverified };
172
+ }
173
+ export function checkExercise(facts, profile) {
174
+ const reasons = [];
175
+ let worst = 'ok';
176
+ for (const inj of profile.injuries ?? []) {
177
+ for (const c of facts.contraindications) {
178
+ if (!c.name || !refersToSame(inj, c.name))
179
+ continue;
180
+ if (c.severity === 'avoid') {
181
+ worst = 'blocked';
182
+ reasons.push(`avoid with ${inj}`);
183
+ }
184
+ else {
185
+ if (worst === 'ok')
186
+ worst = 'warn';
187
+ reasons.push(`take care with ${inj}${c.note ? `: ${c.note}` : ''}`);
188
+ }
189
+ }
190
+ }
191
+ if (!canPerformWithEquipment(facts.equipment, profile.equipment_available ?? [])) {
192
+ worst = 'blocked';
193
+ reasons.push(`needs kit you have not listed (${facts.equipment.join(', ')})`);
194
+ }
195
+ return {
196
+ slug: facts.slug, name: facts.name, verdict: worst, reasons: [...new Set(reasons)], unverified: [],
197
+ ...(worst !== 'ok' && facts.regressions?.length ? { alternatives: facts.regressions } : {}),
198
+ };
199
+ }
200
+ const FACTS_URL = () => (process.env.AVA_PLATFORM_URL || 'https://avasupernova.com') + '/api/health/safety-facts';
201
+ /**
202
+ * Facts for the given slugs. `level` picks which recipe version's flags and
203
+ * diets to read (their cooking level), as the generate route does.
204
+ * Throws when the facts cannot be fetched: callers must treat that as
205
+ * "could not check", never as "safe".
206
+ */
207
+ export async function fetchSafetyFacts(slugs, fetchImpl = fetch) {
208
+ const recipes = [...new Set(slugs.recipes ?? [])].filter(Boolean);
209
+ const exercises = [...new Set(slugs.exercises ?? [])].filter(Boolean);
210
+ if (!recipes.length && !exercises.length)
211
+ return { recipes: {}, exercises: {} };
212
+ const res = await fetchImpl(FACTS_URL(), {
213
+ method: 'POST',
214
+ headers: { 'Content-Type': 'application/json' },
215
+ body: JSON.stringify({ recipes, exercises, level: slugs.level ?? null }),
216
+ });
217
+ if (!res.ok)
218
+ throw new Error(`safety facts: HTTP ${res.status}`);
219
+ const j = await res.json();
220
+ return { recipes: j.recipes ?? {}, exercises: j.exercises ?? {} };
221
+ }
222
+ /** Check every recipe and exercise a set of plan days refers to. */
223
+ export function checkPlanItems(refs, facts, profile) {
224
+ const report = { blocked: [], warnings: [], unverified: [], unknown: [] };
225
+ const unv = new Set();
226
+ for (const slug of new Set(refs.recipes)) {
227
+ const f = facts.recipes[slug];
228
+ if (!f) {
229
+ report.unknown.push(slug);
230
+ continue;
231
+ }
232
+ const r = checkRecipe(f, profile);
233
+ r.unverified.forEach((a) => unv.add(a));
234
+ if (r.verdict === 'blocked')
235
+ report.blocked.push(r);
236
+ }
237
+ for (const slug of new Set(refs.exercises)) {
238
+ const f = facts.exercises[slug];
239
+ if (!f) {
240
+ report.unknown.push(slug);
241
+ continue;
242
+ }
243
+ const r = checkExercise(f, profile);
244
+ if (r.verdict === 'blocked')
245
+ report.blocked.push(r);
246
+ else if (r.verdict === 'warn')
247
+ report.warnings.push(r);
248
+ }
249
+ report.unverified = [...unv];
250
+ return report;
251
+ }
252
+ // ── Screening a plan before it is saved (the room tools) ─────────────────────
253
+ const PROFILE_FILE = () => join(process.env.AVA_HEALTH_DIR || join(AVA_HOME, 'health'), 'profile.json');
254
+ /** Their hard rules and cooking level, from the profile both apps share. */
255
+ export async function loadSafetyProfile() {
256
+ try {
257
+ const raw = JSON.parse(await readFile(PROFILE_FILE(), 'utf-8'));
258
+ const kitchen = (raw.kitchen && typeof raw.kitchen === 'object' ? raw.kitchen : {});
259
+ return { profile: safetyProfileFrom(raw), level: typeof kitchen.level === 'string' ? kitchen.level : null };
260
+ }
261
+ catch {
262
+ return { profile: {}, level: null };
263
+ }
264
+ }
265
+ /**
266
+ * Check plan days against their hard rules before anything is saved.
267
+ *
268
+ * - Anything breaking a hard rule refuses the WHOLE save, naming each item
269
+ * and why, so Ava swaps it and tries again. A plan with one unsafe meal is
270
+ * not "mostly fine".
271
+ * - Cautions save, with a note telling Ava to say so and offer the easier
272
+ * version.
273
+ * - If they have hard rules and the facts cannot be fetched, nothing is saved:
274
+ * "could not check" is never treated as "safe".
275
+ * - Free-text items (no library ref) cannot be checked; they are NAMED, so
276
+ * she can tell the person rather than imply they were.
277
+ */
278
+ export async function screenPlanDays(days, opts = {}) {
279
+ const loaded = opts.profile ? { profile: opts.profile, level: opts.level ?? null } : await loadSafetyProfile();
280
+ const profile = loaded.profile;
281
+ if (!hasHardRules(profile))
282
+ return { ok: true, message: '' };
283
+ const recipes = [], exercises = [], freeText = [];
284
+ for (const d of days) {
285
+ for (const m of d.meals ?? []) {
286
+ if (m.ref?.slug)
287
+ recipes.push(m.ref.slug);
288
+ else if (profile.allergens?.length || profile.dietary?.length)
289
+ freeText.push(m.name);
290
+ }
291
+ for (const e of d.training ?? []) {
292
+ if (e.ref?.slug)
293
+ exercises.push(e.ref.slug);
294
+ else if (profile.injuries?.length || profile.equipment_available?.length)
295
+ freeText.push(e.name);
296
+ }
297
+ }
298
+ let facts;
299
+ try {
300
+ facts = await fetchSafetyFacts({ recipes, exercises, level: loaded.level }, opts.fetchImpl);
301
+ }
302
+ catch (err) {
303
+ if (!recipes.length && !exercises.length)
304
+ facts = { recipes: {}, exercises: {} };
305
+ else
306
+ return {
307
+ ok: false,
308
+ message: `Nothing was saved: I could not check this plan against their allergies, diet, injuries and kit (${err instanceof Error ? err.message : String(err)}). An unchecked plan is not a safe one. Try again in a moment, and tell them if it keeps failing.`,
309
+ };
310
+ }
311
+ const report = checkPlanItems({ recipes, exercises }, facts, profile);
312
+ const label = (r) => r.name ?? r.slug;
313
+ if (report.blocked.length) {
314
+ return {
315
+ ok: false,
316
+ report,
317
+ message: [
318
+ 'Nothing was saved. These break their hard rules:',
319
+ ...report.blocked.map((r) => `- ${label(r)} (${r.slug}): ${r.reasons.join('; ')}${r.alternatives?.length ? `. Easier or swap: ${r.alternatives.map((a) => `${a.name} (${a.slug})`).join(', ')}` : ''}`),
320
+ 'Swap each one for something that fits (health_catalogue_search), then save again. Never tell them a plan is safe for an allergy it has not been checked for.',
321
+ ].join('\n'),
322
+ };
323
+ }
324
+ const notes = [];
325
+ if (report.warnings.length) {
326
+ notes.push('Take care — tell them about these, and offer the easier version:', ...report.warnings.map((r) => `- ${label(r)}: ${r.reasons.join('; ')}${r.alternatives?.length ? `. Easier: ${r.alternatives.map((a) => a.name).join(', ')}` : ''}`));
327
+ }
328
+ if (report.unverified.length)
329
+ notes.push(`Not checkable for ${report.unverified.join(', ')}: the library cannot confirm a dish is free from ${report.unverified.length === 1 ? 'it' : 'them'}. Say so plainly; never call the plan clear for ${report.unverified.length === 1 ? 'it' : 'them'}.`);
330
+ if (report.unknown.length)
331
+ notes.push(`Not found in the library, so not checked: ${report.unknown.join(', ')}.`);
332
+ if (freeText.length)
333
+ notes.push(`Written in without a library entry, so not checked against their rules: ${[...new Set(freeText)].join(', ')}. Prefer library items; if you keep these, tell them they were not checked.`);
334
+ return { ok: true, report, message: notes.join('\n') };
335
+ }
336
+ //# sourceMappingURL=safety.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safety.js","sourceRoot":"","sources":["../../src/health/safety.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAYhD,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAA4B,CAAC;IACjF,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAA4B,CAAC;IAC/G,MAAM,GA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,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;IAC3N,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,28 @@
1
+ export declare const LIST_URL = "https://avasupernova.com/list";
2
+ /** What the phone needs to draw the list — names and amounts, grouped by aisle
3
+ * in walking order. Labels arrive already in the sender's language. */
4
+ export interface SharedList {
5
+ v: 1;
6
+ /** "Mon 17 – Sun 23 Nov", or a plan's title. */
7
+ title: string;
8
+ /** When it was made (ISO date) — orders the phone's saved lists. */
9
+ made: string;
10
+ groups: Array<{
11
+ aisle: string;
12
+ items: Array<{
13
+ n: string;
14
+ q: string;
15
+ }>;
16
+ }>;
17
+ }
18
+ /** The part after `#`: "1." + deflated, base64url JSON. */
19
+ export declare function encodeSharedList(list: SharedList): Promise<string>;
20
+ export declare function decodeSharedList(hash: string): Promise<SharedList | null>;
21
+ export declare function sharedListUrl(list: SharedList): Promise<string>;
22
+ /** The list as plain text — for Copy, and for the WhatsApp message, where it
23
+ * must read properly even if nobody opens the link. */
24
+ export declare function sharedListText(list: SharedList, url?: string, openLabel?: string): string;
25
+ /** wa.me opens WhatsApp (app, desktop or web) with the message filled in;
26
+ * the person picks the chat. It goes through WhatsApp, never through us. */
27
+ export declare function whatsAppLink(text: string): string;
28
+ //# sourceMappingURL=share-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share-list.d.ts","sourceRoot":"","sources":["../../src/health/share-list.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,QAAQ,kCAAkC,CAAC;AAExD;wEACwE;AACxE,MAAM,WAAW,UAAU;IACzB,CAAC,EAAE,CAAC,CAAC;IACL,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAC;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC,CAAC;CAC1E;AA2BD,2DAA2D;AAC3D,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAGxE;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAU/E;AAED,wBAAsB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAErE;AAED;wDACwD;AACxD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,SAAyB,GAAG,MAAM,CAQzG;AAED;6EAC6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD"}