@murphai/murph 1.3.0 → 1.3.2

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 (2451) hide show
  1. package/CHANGELOG.md +3885 -0
  2. package/config.schema.json +731 -60
  3. package/dist/bin.js +6 -4
  4. package/dist/bin.js.map +1 -1
  5. package/dist/cli-entry.d.ts +8 -1
  6. package/dist/cli-entry.d.ts.map +1 -1
  7. package/dist/cli-entry.js +80 -4
  8. package/dist/cli-entry.js.map +1 -1
  9. package/dist/commands/audit-command-helpers.d.ts.map +1 -1
  10. package/dist/commands/audit-command-helpers.js +7 -5
  11. package/dist/commands/audit-command-helpers.js.map +1 -1
  12. package/dist/commands/automation.d.ts +143 -104
  13. package/dist/commands/automation.d.ts.map +1 -1
  14. package/dist/commands/automation.js +71 -13
  15. package/dist/commands/automation.js.map +1 -1
  16. package/dist/commands/batch.d.ts +7 -4
  17. package/dist/commands/batch.d.ts.map +1 -1
  18. package/dist/commands/batch.js +16 -62
  19. package/dist/commands/batch.js.map +1 -1
  20. package/dist/commands/clinical-imports.d.ts +103 -103
  21. package/dist/commands/command-factory-primitives.d.ts +1 -1
  22. package/dist/commands/command-factory-primitives.d.ts.map +1 -1
  23. package/dist/commands/command-factory-primitives.js +1 -1
  24. package/dist/commands/command-factory-primitives.js.map +1 -1
  25. package/dist/commands/commons.d.ts +59 -0
  26. package/dist/commands/commons.d.ts.map +1 -1
  27. package/dist/commands/commons.js +83 -5
  28. package/dist/commands/commons.js.map +1 -1
  29. package/dist/commands/document.d.ts.map +1 -1
  30. package/dist/commands/document.js +31 -1
  31. package/dist/commands/document.js.map +1 -1
  32. package/dist/commands/encounter.d.ts +128 -128
  33. package/dist/commands/event.d.ts.map +1 -1
  34. package/dist/commands/event.js +7 -1
  35. package/dist/commands/event.js.map +1 -1
  36. package/dist/commands/exercise.d.ts.map +1 -1
  37. package/dist/commands/exercise.js +16 -3
  38. package/dist/commands/exercise.js.map +1 -1
  39. package/dist/commands/experiment-progress-card-image.d.ts.map +1 -1
  40. package/dist/commands/experiment-progress-card-image.js +76 -16
  41. package/dist/commands/experiment-progress-card-image.js.map +1 -1
  42. package/dist/commands/experiment.d.ts.map +1 -1
  43. package/dist/commands/experiment.js +51 -5
  44. package/dist/commands/experiment.js.map +1 -1
  45. package/dist/commands/export-intake-read-helpers.d.ts.map +1 -1
  46. package/dist/commands/export-intake-read-helpers.js +9 -6
  47. package/dist/commands/export-intake-read-helpers.js.map +1 -1
  48. package/dist/commands/food.d.ts.map +1 -1
  49. package/dist/commands/food.js +13 -11
  50. package/dist/commands/food.js.map +1 -1
  51. package/dist/commands/habitat.d.ts.map +1 -1
  52. package/dist/commands/habitat.js +120 -9
  53. package/dist/commands/habitat.js.map +1 -1
  54. package/dist/commands/health-blood-test-save.d.ts.map +1 -1
  55. package/dist/commands/health-blood-test-save.js +42 -8
  56. package/dist/commands/health-blood-test-save.js.map +1 -1
  57. package/dist/commands/meal.d.ts.map +1 -1
  58. package/dist/commands/meal.js +58 -4
  59. package/dist/commands/meal.js.map +1 -1
  60. package/dist/commands/measurement.d.ts +1 -0
  61. package/dist/commands/measurement.d.ts.map +1 -1
  62. package/dist/commands/measurement.js +51 -2
  63. package/dist/commands/measurement.js.map +1 -1
  64. package/dist/commands/medication.d.ts +6 -6
  65. package/dist/commands/model.js +7 -11
  66. package/dist/commands/model.js.map +1 -1
  67. package/dist/commands/murph-age.d.ts +9 -1
  68. package/dist/commands/murph-age.d.ts.map +1 -1
  69. package/dist/commands/murph-age.js +132 -7
  70. package/dist/commands/murph-age.js.map +1 -1
  71. package/dist/commands/occurred-at-option.d.ts.map +1 -1
  72. package/dist/commands/occurred-at-option.js +7 -41
  73. package/dist/commands/occurred-at-option.js.map +1 -1
  74. package/dist/commands/payload-schema-command.d.ts +2 -2
  75. package/dist/commands/payload-schema-command.d.ts.map +1 -1
  76. package/dist/commands/payload-schema-command.js +1 -1
  77. package/dist/commands/payload-schema-command.js.map +1 -1
  78. package/dist/commands/public-validation-issue.d.ts +7 -0
  79. package/dist/commands/public-validation-issue.d.ts.map +1 -0
  80. package/dist/commands/public-validation-issue.js +7 -0
  81. package/dist/commands/public-validation-issue.js.map +1 -0
  82. package/dist/commands/research.d.ts.map +1 -1
  83. package/dist/commands/research.js +26 -28
  84. package/dist/commands/research.js.map +1 -1
  85. package/dist/commands/route.d.ts.map +1 -1
  86. package/dist/commands/route.js +45 -1
  87. package/dist/commands/route.js.map +1 -1
  88. package/dist/commands/scheduled-log.d.ts +142 -124
  89. package/dist/commands/scheduled-log.d.ts.map +1 -1
  90. package/dist/commands/scheduled-log.js +456 -106
  91. package/dist/commands/scheduled-log.js.map +1 -1
  92. package/dist/commands/wearables.d.ts +1520 -145
  93. package/dist/commands/wearables.d.ts.map +1 -1
  94. package/dist/commands/wearables.js +135 -3
  95. package/dist/commands/wearables.js.map +1 -1
  96. package/dist/commands/workout-live.d.ts +3 -0
  97. package/dist/commands/workout-live.d.ts.map +1 -0
  98. package/dist/commands/workout-live.js +372 -0
  99. package/dist/commands/workout-live.js.map +1 -0
  100. package/dist/commands/workout-typed-options.d.ts +38 -0
  101. package/dist/commands/workout-typed-options.d.ts.map +1 -0
  102. package/dist/commands/workout-typed-options.js +90 -0
  103. package/dist/commands/workout-typed-options.js.map +1 -0
  104. package/dist/commands/workout.d.ts.map +1 -1
  105. package/dist/commands/workout.js +115 -84
  106. package/dist/commands/workout.js.map +1 -1
  107. package/dist/food-labels.d.ts +549 -277
  108. package/dist/food-labels.d.ts.map +1 -1
  109. package/dist/food-labels.js +19 -3
  110. package/dist/food-labels.js.map +1 -1
  111. package/dist/foreground-terminal-logging.js +0 -2
  112. package/dist/foreground-terminal-logging.js.map +1 -1
  113. package/dist/hosted-data-api-labels.d.ts +1683 -871
  114. package/dist/hosted-data-api-labels.d.ts.map +1 -1
  115. package/dist/hosted-data-api-labels.js +224 -31
  116. package/dist/hosted-data-api-labels.js.map +1 -1
  117. package/dist/incur-error-bridge.d.ts.map +1 -1
  118. package/dist/incur-error-bridge.js +7 -15
  119. package/dist/incur-error-bridge.js.map +1 -1
  120. package/dist/incur.generated.d.ts +158 -3
  121. package/dist/incur.generated.d.ts.map +1 -1
  122. package/dist/mapbox-address.d.ts +41 -0
  123. package/dist/mapbox-address.d.ts.map +1 -0
  124. package/dist/mapbox-address.js +469 -0
  125. package/dist/mapbox-address.js.map +1 -0
  126. package/dist/mapbox-route-client.d.ts +2 -2
  127. package/dist/mapbox-route-client.d.ts.map +1 -1
  128. package/dist/mapbox-route-client.js +49 -12
  129. package/dist/mapbox-route-client.js.map +1 -1
  130. package/dist/mapbox-route-contracts.d.ts +60 -60
  131. package/dist/mapbox-route-contracts.d.ts.map +1 -1
  132. package/dist/mapbox-route-contracts.js +1 -1
  133. package/dist/mapbox-route-contracts.js.map +1 -1
  134. package/dist/mapbox-route-directions.d.ts.map +1 -1
  135. package/dist/mapbox-route-directions.js +1 -2
  136. package/dist/mapbox-route-directions.js.map +1 -1
  137. package/dist/mapbox-route-elevation.js +0 -1
  138. package/dist/mapbox-route-elevation.js.map +1 -1
  139. package/dist/mapbox-route-points.js +0 -2
  140. package/dist/mapbox-route-points.js.map +1 -1
  141. package/dist/mapbox-route.d.ts.map +1 -1
  142. package/dist/mapbox-route.js +1 -1
  143. package/dist/mapbox-route.js.map +1 -1
  144. package/dist/research-scout-client.d.ts +3 -2
  145. package/dist/research-scout-client.d.ts.map +1 -1
  146. package/dist/research-scout-client.js +166 -37
  147. package/dist/research-scout-client.js.map +1 -1
  148. package/dist/research-scout.d.ts +1 -1
  149. package/dist/research-scout.d.ts.map +1 -1
  150. package/dist/research-scout.js +1 -1
  151. package/dist/research-scout.js.map +1 -1
  152. package/dist/supplement-labels.d.ts +545 -275
  153. package/dist/supplement-labels.d.ts.map +1 -1
  154. package/dist/supplement-labels.js +0 -1
  155. package/dist/supplement-labels.js.map +1 -1
  156. package/dist/vault-cli-command-manifest.d.ts +2472 -700
  157. package/dist/vault-cli-command-manifest.d.ts.map +1 -1
  158. package/dist/vault-cli-command-manifest.js +35 -10
  159. package/dist/vault-cli-command-manifest.js.map +1 -1
  160. package/dist/vault-cli-skill-hash.generated.d.ts +1 -1
  161. package/dist/vault-cli-skill-hash.generated.js +1 -1
  162. package/dist/vault-cli-vault-context.js +0 -1
  163. package/dist/vault-cli-vault-context.js.map +1 -1
  164. package/node_modules/@murphai/assistant-cli/dist/assistant/service.d.ts +9 -0
  165. package/node_modules/@murphai/assistant-cli/dist/assistant/service.d.ts.map +1 -1
  166. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/chat-controller-models.d.ts.map +1 -1
  167. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/chat-controller-models.js +0 -1
  168. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/chat-controller-models.js.map +1 -1
  169. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink.d.ts.map +1 -1
  170. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink.js +10 -8
  171. package/node_modules/@murphai/assistant-cli/dist/assistant/ui/ink.js.map +1 -1
  172. package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.d.ts.map +1 -1
  173. package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.js +19 -9
  174. package/node_modules/@murphai/assistant-cli/dist/assistant-daemon-client.js.map +1 -1
  175. package/node_modules/@murphai/assistant-cli/dist/commands/assistant.d.ts.map +1 -1
  176. package/node_modules/@murphai/assistant-cli/dist/commands/assistant.js +20 -56
  177. package/node_modules/@murphai/assistant-cli/dist/commands/assistant.js.map +1 -1
  178. package/node_modules/@murphai/assistant-engine/README.md +73 -16
  179. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.d.ts +21 -4
  180. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.d.ts.map +1 -1
  181. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.js +173 -43
  182. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-controller.js.map +1 -1
  183. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.d.ts +75 -70
  184. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.d.ts.map +1 -1
  185. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.js +44 -19
  186. package/node_modules/@murphai/assistant-engine/dist/assistant/active-turn-input-journal.js.map +1 -1
  187. package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.d.ts +3 -1
  188. package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.d.ts.map +1 -1
  189. package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.js +28 -7
  190. package/node_modules/@murphai/assistant-engine/dist/assistant/ask-continuation.js.map +1 -1
  191. package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.d.ts.map +1 -1
  192. package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.js +4 -1
  193. package/node_modules/@murphai/assistant-engine/dist/assistant/attachment-evidence-model.js.map +1 -1
  194. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/cross-session-route-state.d.ts +77 -0
  195. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/cross-session-route-state.d.ts.map +1 -0
  196. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/cross-session-route-state.js +777 -0
  197. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/cross-session-route-state.js.map +1 -0
  198. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.d.ts +1 -0
  199. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.d.ts.map +1 -1
  200. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.js +36 -4
  201. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/grouping.js.map +1 -1
  202. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.d.ts.map +1 -1
  203. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.js +3 -1
  204. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/input-summary.js.map +1 -1
  205. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.d.ts +3 -1
  206. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/operation-scope.d.ts.map +1 -1
  207. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.d.ts +10 -2
  208. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.d.ts.map +1 -1
  209. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.js +33 -13
  210. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/prompt-builder.js.map +1 -1
  211. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.d.ts +12 -1
  212. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.d.ts.map +1 -1
  213. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.js +851 -171
  214. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/reply.js.map +1 -1
  215. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.d.ts +2 -0
  216. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.d.ts.map +1 -1
  217. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.js +51 -18
  218. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/run-loop.js.map +1 -1
  219. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.d.ts +2 -0
  220. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.d.ts.map +1 -1
  221. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.js +59 -30
  222. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/scanner.js.map +1 -1
  223. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.d.ts +3 -1
  224. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.d.ts.map +1 -1
  225. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.js +3 -0
  226. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/shared.js.map +1 -1
  227. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.d.ts +10 -1
  228. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.d.ts.map +1 -1
  229. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.js +62 -1
  230. package/node_modules/@murphai/assistant-engine/dist/assistant/automation/target-override.js.map +1 -1
  231. package/node_modules/@murphai/assistant-engine/dist/assistant/automation.d.ts +1 -1
  232. package/node_modules/@murphai/assistant-engine/dist/assistant/automation.d.ts.map +1 -1
  233. package/node_modules/@murphai/assistant-engine/dist/assistant/automation.js +1 -1
  234. package/node_modules/@murphai/assistant-engine/dist/assistant/automation.js.map +1 -1
  235. package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.d.ts +1 -1
  236. package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.d.ts.map +1 -1
  237. package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.js +1 -1
  238. package/node_modules/@murphai/assistant-engine/dist/assistant/channel-adapters.js.map +1 -1
  239. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.d.ts.map +1 -1
  240. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.js +107 -44
  241. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/descriptors.js.map +1 -1
  242. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.d.ts +3 -1
  243. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.d.ts.map +1 -1
  244. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.js +34 -3
  245. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/helpers.js.map +1 -1
  246. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.d.ts +22 -14
  247. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.d.ts.map +1 -1
  248. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.js +352 -78
  249. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/runtime.js.map +1 -1
  250. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.d.ts +43 -8
  251. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.d.ts.map +1 -1
  252. package/node_modules/@murphai/assistant-engine/dist/assistant/channels/types.js.map +1 -1
  253. package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.d.ts +1 -0
  254. package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.d.ts.map +1 -1
  255. package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.js +6 -5
  256. package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-bootstrap.js.map +1 -1
  257. package/node_modules/@murphai/assistant-engine/dist/assistant/cli-surface-contract.generated.json +1 -1
  258. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-base-instructions.d.ts +1 -1
  259. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-base-instructions.d.ts.map +1 -1
  260. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-base-instructions.js +14 -7
  261. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-base-instructions.js.map +1 -1
  262. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-runtime.d.ts +17 -0
  263. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-runtime.d.ts.map +1 -1
  264. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-runtime.js +25 -19
  265. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-runtime.js.map +1 -1
  266. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.d.ts.map +1 -1
  267. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.js +9 -9
  268. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-thread-route.js.map +1 -1
  269. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.d.ts +4 -8
  270. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.d.ts.map +1 -1
  271. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.js +284 -59
  272. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn/planning.js.map +1 -1
  273. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.d.ts +5 -3
  274. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.d.ts.map +1 -1
  275. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.js +152 -24
  276. package/node_modules/@murphai/assistant-engine/dist/assistant/codex-turn-runner.js.map +1 -1
  277. package/node_modules/@murphai/assistant-engine/dist/assistant/content-types.d.ts +2 -0
  278. package/node_modules/@murphai/assistant-engine/dist/assistant/content-types.d.ts.map +1 -1
  279. package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.d.ts +4 -1
  280. package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.d.ts.map +1 -1
  281. package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.js +76 -24
  282. package/node_modules/@murphai/assistant-engine/dist/assistant/context-snapshot.js.map +1 -1
  283. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-persistence.d.ts +1 -1
  284. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-persistence.d.ts.map +1 -1
  285. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-persistence.js +0 -1
  286. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-persistence.js.map +1 -1
  287. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.d.ts +1 -0
  288. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.d.ts.map +1 -1
  289. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.js +2 -0
  290. package/node_modules/@murphai/assistant-engine/dist/assistant/conversation-ref.js.map +1 -1
  291. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/authoring.d.ts +5 -1
  292. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/authoring.d.ts.map +1 -1
  293. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/authoring.js +178 -31
  294. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/authoring.js.map +1 -1
  295. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.d.ts +32 -1
  296. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.d.ts.map +1 -1
  297. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.js +147 -31
  298. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/canonical-jobs.js.map +1 -1
  299. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.d.ts +8 -0
  300. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.d.ts.map +1 -1
  301. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.js +73 -15
  302. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/delivery-reconciliation.js.map +1 -1
  303. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.d.ts +8 -1
  304. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.d.ts.map +1 -1
  305. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.js +438 -116
  306. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/execution.js.map +1 -1
  307. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/mutations.d.ts.map +1 -1
  308. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/mutations.js +2 -0
  309. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/mutations.js.map +1 -1
  310. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/output-history.d.ts +11 -0
  311. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/output-history.d.ts.map +1 -0
  312. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/output-history.js +153 -0
  313. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/output-history.js.map +1 -0
  314. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/runtime-state.d.ts +47 -47
  315. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/runtime-state.d.ts.map +1 -1
  316. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/runtime-state.js +1 -1
  317. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/runtime-state.js.map +1 -1
  318. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.d.ts +10 -0
  319. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.d.ts.map +1 -1
  320. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.js +28 -0
  321. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/schedule.js.map +1 -1
  322. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.d.ts +49 -39
  323. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.d.ts.map +1 -1
  324. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.js +19 -1
  325. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/store.js.map +1 -1
  326. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.d.ts.map +1 -1
  327. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.js +1 -3
  328. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/targets.js.map +1 -1
  329. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/timing-verification.d.ts +2 -0
  330. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/timing-verification.d.ts.map +1 -0
  331. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/timing-verification.js +2 -0
  332. package/node_modules/@murphai/assistant-engine/dist/assistant/cron/timing-verification.js.map +1 -0
  333. package/node_modules/@murphai/assistant-engine/dist/assistant/cron.d.ts +9 -0
  334. package/node_modules/@murphai/assistant-engine/dist/assistant/cron.d.ts.map +1 -1
  335. package/node_modules/@murphai/assistant-engine/dist/assistant/cron.js +31 -2
  336. package/node_modules/@murphai/assistant-engine/dist/assistant/cron.js.map +1 -1
  337. package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.d.ts +8 -0
  338. package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.d.ts.map +1 -1
  339. package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.js +38 -8
  340. package/node_modules/@murphai/assistant-engine/dist/assistant/delivery-service.js.map +1 -1
  341. package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.d.ts +2 -1
  342. package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.d.ts.map +1 -1
  343. package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.js +8 -0
  344. package/node_modules/@murphai/assistant-engine/dist/assistant/device-activity-cron-tags.js.map +1 -1
  345. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.d.ts +123 -13
  346. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.d.ts.map +1 -1
  347. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.js +57 -11
  348. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-context.js.map +1 -1
  349. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-plan.d.ts.map +1 -1
  350. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-plan.js +2 -8
  351. package/node_modules/@murphai/assistant-engine/dist/assistant/execution-plan.js.map +1 -1
  352. package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.d.ts.map +1 -1
  353. package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.js +10 -0
  354. package/node_modules/@murphai/assistant-engine/dist/assistant/experiment-support-automations.js.map +1 -1
  355. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card-schema.d.ts +115 -0
  356. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card-schema.d.ts.map +1 -0
  357. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card-schema.js +162 -0
  358. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card-schema.js.map +1 -0
  359. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card.d.ts +3 -0
  360. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card.d.ts.map +1 -0
  361. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card.js +118 -0
  362. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-response-card.js.map +1 -0
  363. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard-schema.d.ts +83 -1
  364. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard-schema.d.ts.map +1 -1
  365. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard-schema.js +27 -22
  366. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard-schema.js.map +1 -1
  367. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard.js +8 -0
  368. package/node_modules/@murphai/assistant-engine/dist/assistant/group-challenge-scorecard.js.map +1 -1
  369. package/node_modules/@murphai/assistant-engine/dist/assistant/group-email-outbox.d.ts +20 -0
  370. package/node_modules/@murphai/assistant-engine/dist/assistant/group-email-outbox.d.ts.map +1 -0
  371. package/node_modules/@murphai/assistant-engine/dist/assistant/{newsletter-outbox.js → group-email-outbox.js} +65 -36
  372. package/node_modules/@murphai/assistant-engine/dist/assistant/group-email-outbox.js.map +1 -0
  373. package/node_modules/@murphai/assistant-engine/dist/assistant/group-newsletter-automation.d.ts +2 -48
  374. package/node_modules/@murphai/assistant-engine/dist/assistant/group-newsletter-automation.d.ts.map +1 -1
  375. package/node_modules/@murphai/assistant-engine/dist/assistant/group-newsletter-automation.js +14 -98
  376. package/node_modules/@murphai/assistant-engine/dist/assistant/group-newsletter-automation.js.map +1 -1
  377. package/node_modules/@murphai/assistant-engine/dist/assistant/group-room-model.d.ts +22 -3
  378. package/node_modules/@murphai/assistant-engine/dist/assistant/group-room-model.d.ts.map +1 -1
  379. package/node_modules/@murphai/assistant-engine/dist/assistant/group-room-model.js +87 -28
  380. package/node_modules/@murphai/assistant-engine/dist/assistant/group-room-model.js.map +1 -1
  381. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-freshness.d.ts +2 -0
  382. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-freshness.d.ts.map +1 -0
  383. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-freshness.js +5 -0
  384. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-freshness.js.map +1 -0
  385. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-read-limits.d.ts +3 -2
  386. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-read-limits.d.ts.map +1 -1
  387. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-read-limits.js +21 -2
  388. package/node_modules/@murphai/assistant-engine/dist/assistant/group-shared-read-limits.js.map +1 -1
  389. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-image-completion.d.ts +31 -0
  390. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-image-completion.d.ts.map +1 -0
  391. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-image-completion.js +164 -0
  392. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-image-completion.js.map +1 -0
  393. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.d.ts +80 -24
  394. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.d.ts.map +1 -1
  395. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.js +191 -62
  396. package/node_modules/@murphai/assistant-engine/dist/assistant/hosted-tool-context.js.map +1 -1
  397. package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.d.ts +1 -0
  398. package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.d.ts.map +1 -1
  399. package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.js +2 -1
  400. package/node_modules/@murphai/assistant-engine/dist/assistant/input-source.js.map +1 -1
  401. package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.d.ts +273 -269
  402. package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.d.ts.map +1 -1
  403. package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.js +6 -1
  404. package/node_modules/@murphai/assistant-engine/dist/assistant/input-store.js.map +1 -1
  405. package/node_modules/@murphai/assistant-engine/dist/assistant/issue-reporting.d.ts +3 -0
  406. package/node_modules/@murphai/assistant-engine/dist/assistant/issue-reporting.d.ts.map +1 -1
  407. package/node_modules/@murphai/assistant-engine/dist/assistant/issue-reporting.js +26 -1
  408. package/node_modules/@murphai/assistant-engine/dist/assistant/issue-reporting.js.map +1 -1
  409. package/node_modules/@murphai/assistant-engine/dist/assistant/linq-delivery-posture.d.ts +3 -0
  410. package/node_modules/@murphai/assistant-engine/dist/assistant/linq-delivery-posture.d.ts.map +1 -0
  411. package/node_modules/@murphai/assistant-engine/dist/assistant/linq-delivery-posture.js +20 -0
  412. package/node_modules/@murphai/assistant-engine/dist/assistant/linq-delivery-posture.js.map +1 -0
  413. package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.d.ts.map +1 -1
  414. package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.js +886 -436
  415. package/node_modules/@murphai/assistant-engine/dist/assistant/local-service.js.map +1 -1
  416. package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.d.ts +3 -3
  417. package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.d.ts.map +1 -1
  418. package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.js +245 -6
  419. package/node_modules/@murphai/assistant-engine/dist/assistant/maintenance-evidence.js.map +1 -1
  420. package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.d.ts +22 -1
  421. package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.d.ts.map +1 -1
  422. package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.js +338 -47
  423. package/node_modules/@murphai/assistant-engine/dist/assistant/managed-automations.js.map +1 -1
  424. package/node_modules/@murphai/assistant-engine/dist/assistant/message-target-selection.d.ts +13 -22
  425. package/node_modules/@murphai/assistant-engine/dist/assistant/message-target-selection.d.ts.map +1 -1
  426. package/node_modules/@murphai/assistant-engine/dist/assistant/message-target-selection.js +8 -3
  427. package/node_modules/@murphai/assistant-engine/dist/assistant/message-target-selection.js.map +1 -1
  428. package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.d.ts +2 -0
  429. package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.d.ts.map +1 -1
  430. package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.js +43 -9
  431. package/node_modules/@murphai/assistant-engine/dist/assistant/model-behavior.js.map +1 -1
  432. package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.d.ts +16 -14
  433. package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.d.ts.map +1 -1
  434. package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.js +339 -62
  435. package/node_modules/@murphai/assistant-engine/dist/assistant/notification-turn.js.map +1 -1
  436. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-first-personal-read-automation.d.ts +14 -0
  437. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-first-personal-read-automation.d.ts.map +1 -0
  438. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-first-personal-read-automation.js +94 -0
  439. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-first-personal-read-automation.js.map +1 -0
  440. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.d.ts +22 -3
  441. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.d.ts.map +1 -1
  442. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.js +81 -7
  443. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-automation.js.map +1 -1
  444. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-seed.d.ts +25 -0
  445. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-seed.d.ts.map +1 -0
  446. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-seed.js +72 -0
  447. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-followup-seed.js.map +1 -0
  448. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-goal-checkin-automation.d.ts +1 -0
  449. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-goal-checkin-automation.d.ts.map +1 -1
  450. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-goal-checkin-automation.js +184 -83
  451. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-goal-checkin-automation.js.map +1 -1
  452. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-state.d.ts +4 -0
  453. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-state.d.ts.map +1 -1
  454. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-state.js +15 -1
  455. package/node_modules/@murphai/assistant-engine/dist/assistant/onboarding-state.js.map +1 -1
  456. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/automation-authority.d.ts.map +1 -1
  457. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/automation-authority.js +24 -1
  458. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/automation-authority.js.map +1 -1
  459. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.d.ts +15 -3
  460. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.d.ts.map +1 -1
  461. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.js +314 -53
  462. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/dispatch-state.js.map +1 -1
  463. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/intents.d.ts +2 -0
  464. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/intents.d.ts.map +1 -1
  465. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/intents.js +1 -0
  466. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/intents.js.map +1 -1
  467. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/receipt-repair.d.ts.map +1 -1
  468. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/receipt-repair.js +5 -0
  469. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/receipt-repair.js.map +1 -1
  470. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.d.ts +4 -1
  471. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.d.ts.map +1 -1
  472. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.js +33 -8
  473. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/retry-policy.js.map +1 -1
  474. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.d.ts +38 -4
  475. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.d.ts.map +1 -1
  476. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.js +1034 -41
  477. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/store.js.map +1 -1
  478. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/summary.d.ts.map +1 -1
  479. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/summary.js +7 -0
  480. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox/summary.js.map +1 -1
  481. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.d.ts +65 -8
  482. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.d.ts.map +1 -1
  483. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.js +569 -67
  484. package/node_modules/@murphai/assistant-engine/dist/assistant/outbox.js.map +1 -1
  485. package/node_modules/@murphai/assistant-engine/dist/assistant/private-completion-continuity.d.ts +23 -0
  486. package/node_modules/@murphai/assistant-engine/dist/assistant/private-completion-continuity.d.ts.map +1 -0
  487. package/node_modules/@murphai/assistant-engine/dist/assistant/private-completion-continuity.js +294 -0
  488. package/node_modules/@murphai/assistant-engine/dist/assistant/private-completion-continuity.js.map +1 -0
  489. package/node_modules/@murphai/assistant-engine/dist/assistant/prompt-time.d.ts +12 -0
  490. package/node_modules/@murphai/assistant-engine/dist/assistant/prompt-time.d.ts.map +1 -0
  491. package/node_modules/@murphai/assistant-engine/dist/assistant/prompt-time.js +38 -0
  492. package/node_modules/@murphai/assistant-engine/dist/assistant/prompt-time.js.map +1 -0
  493. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-catalog.d.ts.map +1 -1
  494. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-catalog.js +2 -2
  495. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-catalog.js.map +1 -1
  496. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-start-critical-path.d.ts +48 -0
  497. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-start-critical-path.d.ts.map +1 -0
  498. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-start-critical-path.js +101 -0
  499. package/node_modules/@murphai/assistant-engine/dist/assistant/provider-start-critical-path.js.map +1 -0
  500. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.d.ts +6 -0
  501. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.d.ts.map +1 -1
  502. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.js +86 -97
  503. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/codex-cli.js.map +1 -1
  504. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.d.ts +16 -5
  505. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.d.ts.map +1 -1
  506. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.js +379 -644
  507. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/helpers.js.map +1 -1
  508. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.d.ts +40 -1
  509. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.d.ts.map +1 -1
  510. package/node_modules/@murphai/assistant-engine/dist/assistant/providers/types.js.map +1 -1
  511. package/node_modules/@murphai/assistant-engine/dist/assistant/redaction.d.ts +2 -1
  512. package/node_modules/@murphai/assistant-engine/dist/assistant/redaction.d.ts.map +1 -1
  513. package/node_modules/@murphai/assistant-engine/dist/assistant/redaction.js +6 -1
  514. package/node_modules/@murphai/assistant-engine/dist/assistant/redaction.js.map +1 -1
  515. package/node_modules/@murphai/assistant-engine/dist/assistant/reminder-availability-maintenance.d.ts +17 -0
  516. package/node_modules/@murphai/assistant-engine/dist/assistant/reminder-availability-maintenance.d.ts.map +1 -0
  517. package/node_modules/@murphai/assistant-engine/dist/assistant/reminder-availability-maintenance.js +287 -0
  518. package/node_modules/@murphai/assistant-engine/dist/assistant/reminder-availability-maintenance.js.map +1 -0
  519. package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.d.ts +1 -1
  520. package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.d.ts.map +1 -1
  521. package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.js +10 -0
  522. package/node_modules/@murphai/assistant-engine/dist/assistant/reply-delivery-context.js.map +1 -1
  523. package/node_modules/@murphai/assistant-engine/dist/assistant/response-media.d.ts +33 -1
  524. package/node_modules/@murphai/assistant-engine/dist/assistant/response-media.d.ts.map +1 -1
  525. package/node_modules/@murphai/assistant-engine/dist/assistant/response-media.js +173 -3
  526. package/node_modules/@murphai/assistant-engine/dist/assistant/response-media.js.map +1 -1
  527. package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.d.ts +25 -4
  528. package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.d.ts.map +1 -1
  529. package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.js +137 -69
  530. package/node_modules/@murphai/assistant-engine/dist/assistant/runtime-residue.js.map +1 -1
  531. package/node_modules/@murphai/assistant-engine/dist/assistant/service-contracts.d.ts +20 -4
  532. package/node_modules/@murphai/assistant-engine/dist/assistant/service-contracts.d.ts.map +1 -1
  533. package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.d.ts +1 -1
  534. package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.d.ts.map +1 -1
  535. package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.js +18 -8
  536. package/node_modules/@murphai/assistant-engine/dist/assistant/service-turn-routes.js.map +1 -1
  537. package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.d.ts +5 -2
  538. package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.d.ts.map +1 -1
  539. package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.js +31 -11
  540. package/node_modules/@murphai/assistant-engine/dist/assistant/service-usage.js.map +1 -1
  541. package/node_modules/@murphai/assistant-engine/dist/assistant/service.d.ts +12 -2
  542. package/node_modules/@murphai/assistant-engine/dist/assistant/service.d.ts.map +1 -1
  543. package/node_modules/@murphai/assistant-engine/dist/assistant/service.js +5 -3
  544. package/node_modules/@murphai/assistant-engine/dist/assistant/service.js.map +1 -1
  545. package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.d.ts.map +1 -1
  546. package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.js +71 -16
  547. package/node_modules/@murphai/assistant-engine/dist/assistant/session-resolution.js.map +1 -1
  548. package/node_modules/@murphai/assistant-engine/dist/assistant/shared.d.ts +1 -0
  549. package/node_modules/@murphai/assistant-engine/dist/assistant/shared.d.ts.map +1 -1
  550. package/node_modules/@murphai/assistant-engine/dist/assistant/shared.js +1 -0
  551. package/node_modules/@murphai/assistant-engine/dist/assistant/shared.js.map +1 -1
  552. package/node_modules/@murphai/assistant-engine/dist/assistant/state-secrets.d.ts +1 -1
  553. package/node_modules/@murphai/assistant-engine/dist/assistant/state-secrets.d.ts.map +1 -1
  554. package/node_modules/@murphai/assistant-engine/dist/assistant/state-secrets.js +0 -1
  555. package/node_modules/@murphai/assistant-engine/dist/assistant/state-secrets.js.map +1 -1
  556. package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.d.ts +11 -3
  557. package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.d.ts.map +1 -1
  558. package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.js +410 -139
  559. package/node_modules/@murphai/assistant-engine/dist/assistant/store/persistence.js.map +1 -1
  560. package/node_modules/@murphai/assistant-engine/dist/assistant/store/types.d.ts +3 -0
  561. package/node_modules/@murphai/assistant-engine/dist/assistant/store/types.d.ts.map +1 -1
  562. package/node_modules/@murphai/assistant-engine/dist/assistant/store.d.ts.map +1 -1
  563. package/node_modules/@murphai/assistant-engine/dist/assistant/store.js +54 -13
  564. package/node_modules/@murphai/assistant-engine/dist/assistant/store.js.map +1 -1
  565. package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.d.ts +7 -0
  566. package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.d.ts.map +1 -1
  567. package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.js +312 -138
  568. package/node_modules/@murphai/assistant-engine/dist/assistant/system-prompt.js.map +1 -1
  569. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-digest.d.ts +10 -0
  570. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-digest.d.ts.map +1 -1
  571. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-digest.js +150 -10
  572. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-digest.js.map +1 -1
  573. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-feedback.d.ts +8 -0
  574. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-feedback.d.ts.map +1 -0
  575. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-feedback.js +74 -0
  576. package/node_modules/@murphai/assistant-engine/dist/assistant/tool-validation-feedback.js.map +1 -0
  577. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.d.ts +1 -0
  578. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.d.ts.map +1 -1
  579. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.js +115 -16
  580. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-finalizer.js.map +1 -1
  581. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.d.ts +3 -2
  582. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.d.ts.map +1 -1
  583. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-input.js.map +1 -1
  584. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.d.ts +9 -2
  585. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.d.ts.map +1 -1
  586. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.js +49 -6
  587. package/node_modules/@murphai/assistant-engine/dist/assistant/turn-progress.js.map +1 -1
  588. package/node_modules/@murphai/assistant-engine/dist/assistant/turns.d.ts +1 -0
  589. package/node_modules/@murphai/assistant-engine/dist/assistant/turns.d.ts.map +1 -1
  590. package/node_modules/@murphai/assistant-engine/dist/assistant/turns.js +62 -22
  591. package/node_modules/@murphai/assistant-engine/dist/assistant/turns.js.map +1 -1
  592. package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.d.ts +1 -1
  593. package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.d.ts.map +1 -1
  594. package/node_modules/@murphai/assistant-engine/dist/assistant/usage-attribution.js.map +1 -1
  595. package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.d.ts +7 -0
  596. package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.d.ts.map +1 -1
  597. package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.js +47 -1
  598. package/node_modules/@murphai/assistant-engine/dist/assistant/vault-file-send.js.map +1 -1
  599. package/node_modules/@murphai/assistant-engine/dist/assistant-ask.d.ts +4 -1
  600. package/node_modules/@murphai/assistant-engine/dist/assistant-ask.d.ts.map +1 -1
  601. package/node_modules/@murphai/assistant-engine/dist/assistant-ask.js +57 -23
  602. package/node_modules/@murphai/assistant-engine/dist/assistant-ask.js.map +1 -1
  603. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.d.ts +1 -1
  604. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.d.ts.map +1 -1
  605. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.js +1 -1
  606. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-adapters.js.map +1 -1
  607. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.d.ts +1 -1
  608. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.d.ts.map +1 -1
  609. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.js +1 -1
  610. package/node_modules/@murphai/assistant-engine/dist/assistant-channel-runtime.js.map +1 -1
  611. package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.d.ts.map +1 -1
  612. package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.js +13 -1
  613. package/node_modules/@murphai/assistant-engine/dist/assistant-cli-access.js.map +1 -1
  614. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-diagnostics.d.ts +8 -4
  615. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-diagnostics.d.ts.map +1 -1
  616. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-diagnostics.js +136 -19
  617. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-diagnostics.js.map +1 -1
  618. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-outcome.d.ts +5 -0
  619. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-outcome.d.ts.map +1 -0
  620. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-outcome.js +36 -0
  621. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/action-outcome.js.map +1 -0
  622. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/analyze-video-tool.d.ts +49 -0
  623. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/analyze-video-tool.d.ts.map +1 -0
  624. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/analyze-video-tool.js +387 -0
  625. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/analyze-video-tool.js.map +1 -0
  626. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-protocol.d.ts +59 -0
  627. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-protocol.d.ts.map +1 -0
  628. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-protocol.js +180 -0
  629. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-protocol.js.map +1 -0
  630. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.d.ts +6 -3
  631. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.d.ts.map +1 -1
  632. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.js +35 -10
  633. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-requests.js.map +1 -1
  634. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.d.ts +3 -4
  635. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.d.ts.map +1 -1
  636. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.js +9 -15
  637. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/app-server-rpc.js.map +1 -1
  638. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/ask-grok-tool.d.ts.map +1 -1
  639. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/ask-grok-tool.js +77 -11
  640. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/ask-grok-tool.js.map +1 -1
  641. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/command-family.d.ts +21 -0
  642. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/command-family.d.ts.map +1 -0
  643. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/command-family.js +213 -0
  644. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/command-family.js.map +1 -0
  645. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tool-catalog.d.ts +3320 -0
  646. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tool-catalog.d.ts.map +1 -0
  647. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tool-catalog.js +1403 -0
  648. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tool-catalog.js.map +1 -0
  649. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/analyze-video.d.ts +50 -0
  650. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/analyze-video.d.ts.map +1 -0
  651. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/analyze-video.js +79 -0
  652. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/analyze-video.js.map +1 -0
  653. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/ask-grok.d.ts +1 -1
  654. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/ask-grok.d.ts.map +1 -1
  655. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/ask-grok.js +2 -2
  656. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/ask-grok.js.map +1 -1
  657. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.d.ts +15 -32
  658. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.d.ts.map +1 -1
  659. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.js +11 -7
  660. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/assistant-style.js.map +1 -1
  661. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation-model-input-schema.d.ts +4 -0
  662. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation-model-input-schema.d.ts.map +1 -0
  663. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation-model-input-schema.js +153 -0
  664. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation-model-input-schema.js.map +1 -0
  665. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation.d.ts +29 -150
  666. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation.d.ts.map +1 -1
  667. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation.js +537 -109
  668. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/automation.js.map +1 -1
  669. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/clinical-records.js +4 -4
  670. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/clinical-records.js.map +1 -1
  671. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.d.ts +10 -54
  672. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.d.ts.map +1 -1
  673. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.js +134 -109
  674. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/connected-apps.js.map +1 -1
  675. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/device.d.ts +6 -13
  676. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/device.d.ts.map +1 -1
  677. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/device.js +44 -10
  678. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/device.js.map +1 -1
  679. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/dynamic-tool-wrapper.d.ts +8 -1
  680. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/dynamic-tool-wrapper.d.ts.map +1 -1
  681. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/dynamic-tool-wrapper.js +2 -1
  682. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/dynamic-tool-wrapper.js.map +1 -1
  683. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.d.ts +9 -2
  684. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.d.ts.map +1 -1
  685. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.js +31 -3
  686. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-song.js.map +1 -1
  687. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.d.ts +7 -6
  688. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.d.ts.map +1 -1
  689. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.js +12 -8
  690. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/generate-voice-memo.js.map +1 -1
  691. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/group-room-model.d.ts +10 -19
  692. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/group-room-model.d.ts.map +1 -1
  693. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/group-room-model.js +19 -7
  694. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/group-room-model.js.map +1 -1
  695. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/labs.d.ts +2 -16
  696. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/labs.d.ts.map +1 -1
  697. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/labs.js +1 -1
  698. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/labs.js.map +1 -1
  699. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/member-memory.d.ts +60 -0
  700. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/member-memory.d.ts.map +1 -0
  701. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/member-memory.js +91 -0
  702. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/member-memory.js.map +1 -0
  703. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/pending-vault-files.d.ts +65 -0
  704. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/pending-vault-files.d.ts.map +1 -0
  705. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/pending-vault-files.js +214 -0
  706. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/pending-vault-files.js.map +1 -0
  707. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.d.ts +24 -16
  708. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.d.ts.map +1 -1
  709. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.js +78 -7
  710. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/phone-calls.js.map +1 -1
  711. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/physical-notes.d.ts +131 -0
  712. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/physical-notes.d.ts.map +1 -0
  713. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/physical-notes.js +275 -0
  714. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools/physical-notes.js.map +1 -0
  715. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.d.ts +131 -2427
  716. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.d.ts.map +1 -1
  717. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.js +2505 -1575
  718. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/dynamic-tools.js.map +1 -1
  719. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.d.ts.map +1 -1
  720. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.js +39 -95
  721. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/failures.js.map +1 -1
  722. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.d.ts +5 -2
  723. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.d.ts.map +1 -1
  724. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.js +88 -101
  725. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-image-tool.js.map +1 -1
  726. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.d.ts +58 -13
  727. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.d.ts.map +1 -1
  728. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.js +85 -122
  729. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/generate-voice-memo-tool.js.map +1 -1
  730. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.d.ts.map +1 -1
  731. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.js +5 -3
  732. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/image-reference-resolver.js.map +1 -1
  733. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/images.d.ts +15 -2
  734. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/images.d.ts.map +1 -1
  735. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/images.js +99 -8
  736. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/images.js.map +1 -1
  737. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/managed-voice-memo-runtime.d.ts +17 -0
  738. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/managed-voice-memo-runtime.d.ts.map +1 -0
  739. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/managed-voice-memo-runtime.js +12 -0
  740. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/managed-voice-memo-runtime.js.map +1 -0
  741. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.d.ts +7 -11
  742. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.d.ts.map +1 -1
  743. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.js +237 -52
  744. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/openai-image-generation.js.map +1 -1
  745. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/response-card-validation-feedback.d.ts +3 -0
  746. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/response-card-validation-feedback.d.ts.map +1 -0
  747. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/response-card-validation-feedback.js +5 -0
  748. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/response-card-validation-feedback.js.map +1 -0
  749. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/workout-delivery-context.d.ts +19 -0
  750. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/workout-delivery-context.d.ts.map +1 -0
  751. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/workout-delivery-context.js +203 -0
  752. package/node_modules/@murphai/assistant-engine/dist/assistant-codex/workout-delivery-context.js.map +1 -0
  753. package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.d.ts.map +1 -1
  754. package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.js +189 -486
  755. package/node_modules/@murphai/assistant-engine/dist/assistant-codex-events.js.map +1 -1
  756. package/node_modules/@murphai/assistant-engine/dist/assistant-codex.d.ts +42 -6
  757. package/node_modules/@murphai/assistant-engine/dist/assistant-codex.d.ts.map +1 -1
  758. package/node_modules/@murphai/assistant-engine/dist/assistant-codex.js +1196 -339
  759. package/node_modules/@murphai/assistant-engine/dist/assistant-codex.js.map +1 -1
  760. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime-residue.d.ts +1 -1
  761. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime-residue.d.ts.map +1 -1
  762. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime-residue.js +1 -1
  763. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime-residue.js.map +1 -1
  764. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime.d.ts +2 -0
  765. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime.d.ts.map +1 -1
  766. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime.js +1 -0
  767. package/node_modules/@murphai/assistant-engine/dist/assistant-runtime.js.map +1 -1
  768. package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.d.ts +24 -24
  769. package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.d.ts.map +1 -1
  770. package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.js +27 -27
  771. package/node_modules/@murphai/assistant-engine/dist/assistant-skill-assets.js.map +1 -1
  772. package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.d.ts +27 -27
  773. package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.d.ts.map +1 -1
  774. package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.js +1 -1
  775. package/node_modules/@murphai/assistant-engine/dist/attachment-prompt-contracts.js.map +1 -1
  776. package/node_modules/@murphai/assistant-engine/dist/index.d.ts +9 -3
  777. package/node_modules/@murphai/assistant-engine/dist/index.d.ts.map +1 -1
  778. package/node_modules/@murphai/assistant-engine/dist/index.js +7 -1
  779. package/node_modules/@murphai/assistant-engine/dist/index.js.map +1 -1
  780. package/node_modules/@murphai/assistant-engine/dist/knowledge/documents.d.ts +1 -1
  781. package/node_modules/@murphai/assistant-engine/dist/knowledge/documents.d.ts.map +1 -1
  782. package/node_modules/@murphai/assistant-engine/dist/knowledge/documents.js +5 -1
  783. package/node_modules/@murphai/assistant-engine/dist/knowledge/documents.js.map +1 -1
  784. package/node_modules/@murphai/assistant-engine/dist/knowledge/service.d.ts +1 -0
  785. package/node_modules/@murphai/assistant-engine/dist/knowledge/service.d.ts.map +1 -1
  786. package/node_modules/@murphai/assistant-engine/dist/knowledge/service.js +16 -2
  787. package/node_modules/@murphai/assistant-engine/dist/knowledge/service.js.map +1 -1
  788. package/node_modules/@murphai/assistant-engine/dist/outbound-channel.d.ts +5 -2
  789. package/node_modules/@murphai/assistant-engine/dist/outbound-channel.d.ts.map +1 -1
  790. package/node_modules/@murphai/assistant-engine/dist/outbound-channel.js +4 -2
  791. package/node_modules/@murphai/assistant-engine/dist/outbound-channel.js.map +1 -1
  792. package/node_modules/@murphai/assistant-engine/skills/README.md +29 -0
  793. package/node_modules/@murphai/assistant-engine/skills/appointment-scheduling/SKILL.md +23 -0
  794. package/node_modules/@murphai/assistant-engine/skills/automatic-meal-capture/SKILL.md +180 -12
  795. package/node_modules/@murphai/assistant-engine/skills/behavior-followthrough/SKILL.md +155 -116
  796. package/node_modules/@murphai/assistant-engine/skills/body-composition/SKILL.md +137 -27
  797. package/node_modules/@murphai/assistant-engine/skills/body-composition/references/evidence.md +150 -0
  798. package/node_modules/@murphai/assistant-engine/skills/body-composition/references/fat-loss.md +132 -0
  799. package/node_modules/@murphai/assistant-engine/skills/body-composition/references/muscle-gain.md +135 -0
  800. package/node_modules/@murphai/assistant-engine/skills/body-composition/references/safety.md +171 -0
  801. package/node_modules/@murphai/assistant-engine/skills/body-composition/references/tracking-and-adjustment.md +193 -0
  802. package/node_modules/@murphai/assistant-engine/skills/cardiometabolic-health/SKILL.md +10 -1
  803. package/node_modules/@murphai/assistant-engine/skills/computer-use/SKILL.md +0 -4
  804. package/node_modules/@murphai/assistant-engine/skills/connected-apps/SKILL.md +86 -12
  805. package/node_modules/@murphai/assistant-engine/skills/connected-apps/references/provider-data-exports.md +209 -0
  806. package/node_modules/@murphai/assistant-engine/skills/daily-activity/SKILL.md +27 -4
  807. package/node_modules/@murphai/assistant-engine/skills/experiment-onboarding/SKILL.md +22 -9
  808. package/node_modules/@murphai/assistant-engine/skills/food-journal/SKILL.md +200 -14
  809. package/node_modules/@murphai/assistant-engine/skills/group-challenge/SKILL.md +17 -737
  810. package/node_modules/@murphai/assistant-engine/skills/group-challenge-scorecards/SKILL.md +17 -328
  811. package/node_modules/@murphai/assistant-engine/skills/group-chat/SKILL.md +18 -912
  812. package/node_modules/@murphai/assistant-engine/skills/group-newsletter/SKILL.md +16 -237
  813. package/node_modules/@murphai/assistant-engine/skills/groupchat-comedy/SKILL.md +19 -351
  814. package/node_modules/@murphai/assistant-engine/skills/hosted-low-usage/SKILL.md +310 -118
  815. package/node_modules/@murphai/assistant-engine/skills/micronutrients-supplements/SKILL.md +30 -8
  816. package/node_modules/@murphai/assistant-engine/skills/mobility-posture/SKILL.md +1 -1
  817. package/node_modules/@murphai/assistant-engine/skills/murph-family/SKILL.md +91 -26
  818. package/node_modules/@murphai/assistant-engine/skills/murph-onboarding/SKILL.md +75 -751
  819. package/node_modules/@murphai/assistant-engine/skills/murph-onboarding/references/aspiration-foundation-delegation.md +443 -0
  820. package/node_modules/@murphai/assistant-engine/skills/murph-onboarding/references/persistence-recovery-follow-up.md +155 -0
  821. package/node_modules/@murphai/assistant-engine/skills/murph-onboarding/references/return-launch-completion.md +246 -0
  822. package/node_modules/@murphai/assistant-engine/skills/music-generation/SKILL.md +31 -163
  823. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/SKILL.md +84 -7
  824. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/daily-nutrition-card-goals.md +313 -0
  825. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/carnivore-animal-based.md +145 -0
  826. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/dash.md +183 -0
  827. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/intermittent-fasting.md +153 -0
  828. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/ketogenic.md +149 -0
  829. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/low-carbohydrate.md +167 -0
  830. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/mediterranean.md +141 -0
  831. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/vegan-plant-based.md +175 -0
  832. package/node_modules/@murphai/assistant-engine/skills/nutrition-strategy/references/named-diets/vegetarian-spectrum.md +131 -0
  833. package/node_modules/@murphai/assistant-engine/skills/phone-calls/SKILL.md +47 -67
  834. package/node_modules/@murphai/assistant-engine/skills/physical-notes/SKILL.md +167 -0
  835. package/node_modules/@murphai/assistant-engine/skills/physical-therapy/SKILL.md +4 -2
  836. package/node_modules/@murphai/assistant-engine/skills/self-management-experiments/SKILL.md +19 -3
  837. package/node_modules/@murphai/assistant-engine/skills/shared/exercise-catalog-runtime.md +36 -19
  838. package/node_modules/@murphai/assistant-engine/skills/signup-link/SKILL.md +30 -0
  839. package/node_modules/@murphai/assistant-engine/skills/strength-training/SKILL.md +17 -1
  840. package/node_modules/@murphai/assistant-engine/skills/tracked-table/SKILL.md +292 -0
  841. package/node_modules/@murphai/assistant-engine/skills/workout-csv-import/SKILL.md +129 -0
  842. package/node_modules/@murphai/assistantd/dist/client.d.ts +2 -0
  843. package/node_modules/@murphai/assistantd/dist/client.d.ts.map +1 -1
  844. package/node_modules/@murphai/assistantd/dist/client.js +33 -0
  845. package/node_modules/@murphai/assistantd/dist/client.js.map +1 -1
  846. package/node_modules/@murphai/assistantd/dist/http-protocol.d.ts.map +1 -1
  847. package/node_modules/@murphai/assistantd/dist/http-protocol.js +25 -1
  848. package/node_modules/@murphai/assistantd/dist/http-protocol.js.map +1 -1
  849. package/node_modules/@murphai/clinical-records/dist/index.d.ts +660 -660
  850. package/node_modules/@murphai/clinical-records/dist/index.d.ts.map +1 -1
  851. package/node_modules/@murphai/clinical-records/dist/index.js +1 -1
  852. package/node_modules/@murphai/clinical-records/dist/index.js.map +1 -1
  853. package/node_modules/@murphai/core/dist/automation-availability.d.ts +51 -0
  854. package/node_modules/@murphai/core/dist/automation-availability.d.ts.map +1 -0
  855. package/node_modules/@murphai/core/dist/automation-availability.js +226 -0
  856. package/node_modules/@murphai/core/dist/automation-availability.js.map +1 -0
  857. package/node_modules/@murphai/core/dist/automation.d.ts +9 -2
  858. package/node_modules/@murphai/core/dist/automation.d.ts.map +1 -1
  859. package/node_modules/@murphai/core/dist/automation.js +121 -19
  860. package/node_modules/@murphai/core/dist/automation.js.map +1 -1
  861. package/node_modules/@murphai/core/dist/bank/habitat.d.ts +2 -0
  862. package/node_modules/@murphai/core/dist/bank/habitat.d.ts.map +1 -1
  863. package/node_modules/@murphai/core/dist/bank/habitat.js +35 -1
  864. package/node_modules/@murphai/core/dist/bank/habitat.js.map +1 -1
  865. package/node_modules/@murphai/core/dist/bank/regimens.js +1 -1
  866. package/node_modules/@murphai/core/dist/bank/regimens.js.map +1 -1
  867. package/node_modules/@murphai/core/dist/domains/events/attachment-backed.d.ts.map +1 -1
  868. package/node_modules/@murphai/core/dist/domains/events/attachment-backed.js +9 -123
  869. package/node_modules/@murphai/core/dist/domains/events/attachment-backed.js.map +1 -1
  870. package/node_modules/@murphai/core/dist/domains/events/capture-lookup.d.ts +33 -0
  871. package/node_modules/@murphai/core/dist/domains/events/capture-lookup.d.ts.map +1 -1
  872. package/node_modules/@murphai/core/dist/domains/events/capture-lookup.js +119 -0
  873. package/node_modules/@murphai/core/dist/domains/events/capture-lookup.js.map +1 -1
  874. package/node_modules/@murphai/core/dist/domains/events/generated-image-capture-retention.d.ts +24 -0
  875. package/node_modules/@murphai/core/dist/domains/events/generated-image-capture-retention.d.ts.map +1 -0
  876. package/node_modules/@murphai/core/dist/domains/events/generated-image-capture-retention.js +409 -0
  877. package/node_modules/@murphai/core/dist/domains/events/generated-image-capture-retention.js.map +1 -0
  878. package/node_modules/@murphai/core/dist/domains/events/ledger.d.ts +34 -0
  879. package/node_modules/@murphai/core/dist/domains/events/ledger.d.ts.map +1 -1
  880. package/node_modules/@murphai/core/dist/domains/events/ledger.js +188 -15
  881. package/node_modules/@murphai/core/dist/domains/events/ledger.js.map +1 -1
  882. package/node_modules/@murphai/core/dist/domains/events.d.ts +6 -2
  883. package/node_modules/@murphai/core/dist/domains/events.d.ts.map +1 -1
  884. package/node_modules/@murphai/core/dist/domains/events.js +3 -1
  885. package/node_modules/@murphai/core/dist/domains/events.js.map +1 -1
  886. package/node_modules/@murphai/core/dist/domains/experiments.d.ts.map +1 -1
  887. package/node_modules/@murphai/core/dist/domains/experiments.js +5 -1
  888. package/node_modules/@murphai/core/dist/domains/experiments.js.map +1 -1
  889. package/node_modules/@murphai/core/dist/history/api.d.ts +8 -5
  890. package/node_modules/@murphai/core/dist/history/api.d.ts.map +1 -1
  891. package/node_modules/@murphai/core/dist/history/api.js +268 -20
  892. package/node_modules/@murphai/core/dist/history/api.js.map +1 -1
  893. package/node_modules/@murphai/core/dist/index.d.ts +11 -6
  894. package/node_modules/@murphai/core/dist/index.d.ts.map +1 -1
  895. package/node_modules/@murphai/core/dist/index.js +8 -4
  896. package/node_modules/@murphai/core/dist/index.js.map +1 -1
  897. package/node_modules/@murphai/core/dist/memory.d.ts.map +1 -1
  898. package/node_modules/@murphai/core/dist/memory.js +1 -0
  899. package/node_modules/@murphai/core/dist/memory.js.map +1 -1
  900. package/node_modules/@murphai/core/dist/mutations.d.ts +45 -4
  901. package/node_modules/@murphai/core/dist/mutations.d.ts.map +1 -1
  902. package/node_modules/@murphai/core/dist/mutations.js +2204 -97
  903. package/node_modules/@murphai/core/dist/mutations.js.map +1 -1
  904. package/node_modules/@murphai/core/dist/operations/index.d.ts +1 -1
  905. package/node_modules/@murphai/core/dist/operations/index.d.ts.map +1 -1
  906. package/node_modules/@murphai/core/dist/operations/index.js +1 -1
  907. package/node_modules/@murphai/core/dist/operations/index.js.map +1 -1
  908. package/node_modules/@murphai/core/dist/operations/write-batch.d.ts +5 -0
  909. package/node_modules/@murphai/core/dist/operations/write-batch.d.ts.map +1 -1
  910. package/node_modules/@murphai/core/dist/operations/write-batch.js +40 -2
  911. package/node_modules/@murphai/core/dist/operations/write-batch.js.map +1 -1
  912. package/node_modules/@murphai/core/dist/protocols.d.ts.map +1 -1
  913. package/node_modules/@murphai/core/dist/protocols.js +52 -9
  914. package/node_modules/@murphai/core/dist/protocols.js.map +1 -1
  915. package/node_modules/@murphai/core/dist/public-mutations.d.ts +3 -2
  916. package/node_modules/@murphai/core/dist/public-mutations.d.ts.map +1 -1
  917. package/node_modules/@murphai/core/dist/public-mutations.js +9 -4
  918. package/node_modules/@murphai/core/dist/public-mutations.js.map +1 -1
  919. package/node_modules/@murphai/core/dist/scheduled-logs.d.ts +3 -0
  920. package/node_modules/@murphai/core/dist/scheduled-logs.d.ts.map +1 -1
  921. package/node_modules/@murphai/core/dist/scheduled-logs.js +65 -29
  922. package/node_modules/@murphai/core/dist/scheduled-logs.js.map +1 -1
  923. package/node_modules/@murphai/device-syncd/README.md +237 -0
  924. package/node_modules/@murphai/device-syncd/dist/client.d.ts +15 -0
  925. package/node_modules/@murphai/device-syncd/dist/client.d.ts.map +1 -1
  926. package/node_modules/@murphai/device-syncd/dist/client.js.map +1 -1
  927. package/node_modules/@murphai/device-syncd/dist/config/connect-routes.d.ts +29 -1
  928. package/node_modules/@murphai/device-syncd/dist/config/connect-routes.d.ts.map +1 -1
  929. package/node_modules/@murphai/device-syncd/dist/config/connect-routes.js +78 -2
  930. package/node_modules/@murphai/device-syncd/dist/config/connect-routes.js.map +1 -1
  931. package/node_modules/@murphai/device-syncd/dist/config/connect-targets.js +1 -1
  932. package/node_modules/@murphai/device-syncd/dist/config/connect-targets.js.map +1 -1
  933. package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.d.ts +2 -1
  934. package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.d.ts.map +1 -1
  935. package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.js +2 -1
  936. package/node_modules/@murphai/device-syncd/dist/config/junction-client-config.js.map +1 -1
  937. package/node_modules/@murphai/device-syncd/dist/config/junction-config.d.ts +1 -0
  938. package/node_modules/@murphai/device-syncd/dist/config/junction-config.d.ts.map +1 -1
  939. package/node_modules/@murphai/device-syncd/dist/config/junction-config.js +9 -1
  940. package/node_modules/@murphai/device-syncd/dist/config/junction-config.js.map +1 -1
  941. package/node_modules/@murphai/device-syncd/dist/config/junction-connect-sources.js +2 -2
  942. package/node_modules/@murphai/device-syncd/dist/config/junction-connect-sources.js.map +1 -1
  943. package/node_modules/@murphai/device-syncd/dist/config/provider-configs.d.ts +2 -2
  944. package/node_modules/@murphai/device-syncd/dist/config/provider-configs.d.ts.map +1 -1
  945. package/node_modules/@murphai/device-syncd/dist/config/provider-configs.js +2 -2
  946. package/node_modules/@murphai/device-syncd/dist/config/provider-configs.js.map +1 -1
  947. package/node_modules/@murphai/device-syncd/dist/config/provider-env.d.ts +4 -2
  948. package/node_modules/@murphai/device-syncd/dist/config/provider-env.d.ts.map +1 -1
  949. package/node_modules/@murphai/device-syncd/dist/config/provider-env.js +6 -0
  950. package/node_modules/@murphai/device-syncd/dist/config/provider-env.js.map +1 -1
  951. package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.d.ts +614 -0
  952. package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.d.ts.map +1 -1
  953. package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.js +216 -148
  954. package/node_modules/@murphai/device-syncd/dist/config/provider-manifests.js.map +1 -1
  955. package/node_modules/@murphai/device-syncd/dist/config/provider-types.d.ts +11 -0
  956. package/node_modules/@murphai/device-syncd/dist/config/provider-types.d.ts.map +1 -1
  957. package/node_modules/@murphai/device-syncd/dist/config/runtime-config.d.ts.map +1 -1
  958. package/node_modules/@murphai/device-syncd/dist/config/runtime-config.js +2 -2
  959. package/node_modules/@murphai/device-syncd/dist/config/runtime-config.js.map +1 -1
  960. package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.d.ts.map +1 -1
  961. package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.js +2 -0
  962. package/node_modules/@murphai/device-syncd/dist/config/serializable-provider-configs.js.map +1 -1
  963. package/node_modules/@murphai/device-syncd/dist/config.d.ts +1 -1
  964. package/node_modules/@murphai/device-syncd/dist/config.d.ts.map +1 -1
  965. package/node_modules/@murphai/device-syncd/dist/config.js +1 -1
  966. package/node_modules/@murphai/device-syncd/dist/config.js.map +1 -1
  967. package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.d.ts +1 -1
  968. package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.d.ts.map +1 -1
  969. package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.js +1 -1
  970. package/node_modules/@murphai/device-syncd/dist/configured-provider-runtime-descriptors.js.map +1 -1
  971. package/node_modules/@murphai/device-syncd/dist/connect-config.d.ts +1 -1
  972. package/node_modules/@murphai/device-syncd/dist/connect-config.d.ts.map +1 -1
  973. package/node_modules/@murphai/device-syncd/dist/connect-config.js +1 -1
  974. package/node_modules/@murphai/device-syncd/dist/connect-config.js.map +1 -1
  975. package/node_modules/@murphai/device-syncd/dist/fitbit-migration.d.ts +57 -0
  976. package/node_modules/@murphai/device-syncd/dist/fitbit-migration.d.ts.map +1 -0
  977. package/node_modules/@murphai/device-syncd/dist/fitbit-migration.js +166 -0
  978. package/node_modules/@murphai/device-syncd/dist/fitbit-migration.js.map +1 -0
  979. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts +87 -0
  980. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts.map +1 -1
  981. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js +296 -6
  982. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js.map +1 -1
  983. package/node_modules/@murphai/device-syncd/dist/index.d.ts +1 -1
  984. package/node_modules/@murphai/device-syncd/dist/index.d.ts.map +1 -1
  985. package/node_modules/@murphai/device-syncd/dist/index.js +1 -1
  986. package/node_modules/@murphai/device-syncd/dist/index.js.map +1 -1
  987. package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.d.ts +27 -0
  988. package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.d.ts.map +1 -1
  989. package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.js +464 -9
  990. package/node_modules/@murphai/device-syncd/dist/junction-historical-backfill-progress.js.map +1 -1
  991. package/node_modules/@murphai/device-syncd/dist/junction-inline-authority.d.ts +17 -2
  992. package/node_modules/@murphai/device-syncd/dist/junction-inline-authority.d.ts.map +1 -1
  993. package/node_modules/@murphai/device-syncd/dist/junction-inline-authority.js +99 -40
  994. package/node_modules/@murphai/device-syncd/dist/junction-inline-authority.js.map +1 -1
  995. package/node_modules/@murphai/device-syncd/dist/junction-resources.d.ts +16 -0
  996. package/node_modules/@murphai/device-syncd/dist/junction-resources.d.ts.map +1 -1
  997. package/node_modules/@murphai/device-syncd/dist/junction-resources.js +32 -0
  998. package/node_modules/@murphai/device-syncd/dist/junction-resources.js.map +1 -1
  999. package/node_modules/@murphai/device-syncd/dist/junction-source-reconnect.d.ts +17 -0
  1000. package/node_modules/@murphai/device-syncd/dist/junction-source-reconnect.d.ts.map +1 -0
  1001. package/node_modules/@murphai/device-syncd/dist/junction-source-reconnect.js +45 -0
  1002. package/node_modules/@murphai/device-syncd/dist/junction-source-reconnect.js.map +1 -0
  1003. package/node_modules/@murphai/device-syncd/dist/junction-timeseries-progress.d.ts +15 -0
  1004. package/node_modules/@murphai/device-syncd/dist/junction-timeseries-progress.d.ts.map +1 -0
  1005. package/node_modules/@murphai/device-syncd/dist/junction-timeseries-progress.js +24 -0
  1006. package/node_modules/@murphai/device-syncd/dist/junction-timeseries-progress.js.map +1 -0
  1007. package/node_modules/@murphai/device-syncd/dist/prepared-webhook.d.ts +29 -0
  1008. package/node_modules/@murphai/device-syncd/dist/prepared-webhook.d.ts.map +1 -0
  1009. package/node_modules/@murphai/device-syncd/dist/prepared-webhook.js +263 -0
  1010. package/node_modules/@murphai/device-syncd/dist/prepared-webhook.js.map +1 -0
  1011. package/node_modules/@murphai/device-syncd/dist/provider-configs.d.ts +1 -1
  1012. package/node_modules/@murphai/device-syncd/dist/provider-configs.d.ts.map +1 -1
  1013. package/node_modules/@murphai/device-syncd/dist/provider-configs.js +1 -1
  1014. package/node_modules/@murphai/device-syncd/dist/provider-configs.js.map +1 -1
  1015. package/node_modules/@murphai/device-syncd/dist/provider-label.d.ts +1 -0
  1016. package/node_modules/@murphai/device-syncd/dist/provider-label.d.ts.map +1 -1
  1017. package/node_modules/@murphai/device-syncd/dist/provider-label.js +4 -2
  1018. package/node_modules/@murphai/device-syncd/dist/provider-label.js.map +1 -1
  1019. package/node_modules/@murphai/device-syncd/dist/providers/junction-client.d.ts +30 -1
  1020. package/node_modules/@murphai/device-syncd/dist/providers/junction-client.d.ts.map +1 -1
  1021. package/node_modules/@murphai/device-syncd/dist/providers/junction-client.js +1005 -193
  1022. package/node_modules/@murphai/device-syncd/dist/providers/junction-client.js.map +1 -1
  1023. package/node_modules/@murphai/device-syncd/dist/providers/junction.d.ts +11 -2
  1024. package/node_modules/@murphai/device-syncd/dist/providers/junction.d.ts.map +1 -1
  1025. package/node_modules/@murphai/device-syncd/dist/providers/junction.js +5033 -310
  1026. package/node_modules/@murphai/device-syncd/dist/providers/junction.js.map +1 -1
  1027. package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts.map +1 -1
  1028. package/node_modules/@murphai/device-syncd/dist/providers/oura.js +2 -1
  1029. package/node_modules/@murphai/device-syncd/dist/providers/oura.js.map +1 -1
  1030. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts +12 -3
  1031. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts.map +1 -1
  1032. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js +50 -12
  1033. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js.map +1 -1
  1034. package/node_modules/@murphai/device-syncd/dist/providers/strava.d.ts +3 -1
  1035. package/node_modules/@murphai/device-syncd/dist/providers/strava.d.ts.map +1 -1
  1036. package/node_modules/@murphai/device-syncd/dist/providers/strava.js +51 -38
  1037. package/node_modules/@murphai/device-syncd/dist/providers/strava.js.map +1 -1
  1038. package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts.map +1 -1
  1039. package/node_modules/@murphai/device-syncd/dist/providers/whoop.js +11 -1
  1040. package/node_modules/@murphai/device-syncd/dist/providers/whoop.js.map +1 -1
  1041. package/node_modules/@murphai/device-syncd/dist/public-account.d.ts +54 -2
  1042. package/node_modules/@murphai/device-syncd/dist/public-account.d.ts.map +1 -1
  1043. package/node_modules/@murphai/device-syncd/dist/public-account.js +243 -1
  1044. package/node_modules/@murphai/device-syncd/dist/public-account.js.map +1 -1
  1045. package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts +9 -2
  1046. package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts.map +1 -1
  1047. package/node_modules/@murphai/device-syncd/dist/public-ingress.js +634 -199
  1048. package/node_modules/@murphai/device-syncd/dist/public-ingress.js.map +1 -1
  1049. package/node_modules/@murphai/device-syncd/dist/service.d.ts +21 -4
  1050. package/node_modules/@murphai/device-syncd/dist/service.d.ts.map +1 -1
  1051. package/node_modules/@murphai/device-syncd/dist/service.js +728 -68
  1052. package/node_modules/@murphai/device-syncd/dist/service.js.map +1 -1
  1053. package/node_modules/@murphai/device-syncd/dist/source-staleness.d.ts +15 -0
  1054. package/node_modules/@murphai/device-syncd/dist/source-staleness.d.ts.map +1 -1
  1055. package/node_modules/@murphai/device-syncd/dist/source-staleness.js +25 -1
  1056. package/node_modules/@murphai/device-syncd/dist/source-staleness.js.map +1 -1
  1057. package/node_modules/@murphai/device-syncd/dist/store/accounts.d.ts +3 -1
  1058. package/node_modules/@murphai/device-syncd/dist/store/accounts.d.ts.map +1 -1
  1059. package/node_modules/@murphai/device-syncd/dist/store/accounts.js +25 -2
  1060. package/node_modules/@murphai/device-syncd/dist/store/accounts.js.map +1 -1
  1061. package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.d.ts.map +1 -1
  1062. package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.js +7 -1
  1063. package/node_modules/@murphai/device-syncd/dist/store/hosted-account-hydration.js.map +1 -1
  1064. package/node_modules/@murphai/device-syncd/dist/store/jobs.d.ts +22 -3
  1065. package/node_modules/@murphai/device-syncd/dist/store/jobs.d.ts.map +1 -1
  1066. package/node_modules/@murphai/device-syncd/dist/store/jobs.js +266 -21
  1067. package/node_modules/@murphai/device-syncd/dist/store/jobs.js.map +1 -1
  1068. package/node_modules/@murphai/device-syncd/dist/store/oauth-states.d.ts +3 -1
  1069. package/node_modules/@murphai/device-syncd/dist/store/oauth-states.d.ts.map +1 -1
  1070. package/node_modules/@murphai/device-syncd/dist/store/oauth-states.js +62 -4
  1071. package/node_modules/@murphai/device-syncd/dist/store/oauth-states.js.map +1 -1
  1072. package/node_modules/@murphai/device-syncd/dist/store/schema.d.ts +1 -1
  1073. package/node_modules/@murphai/device-syncd/dist/store/schema.d.ts.map +1 -1
  1074. package/node_modules/@murphai/device-syncd/dist/store/schema.js +25 -3
  1075. package/node_modules/@murphai/device-syncd/dist/store/schema.js.map +1 -1
  1076. package/node_modules/@murphai/device-syncd/dist/store/sources.d.ts +25 -2
  1077. package/node_modules/@murphai/device-syncd/dist/store/sources.d.ts.map +1 -1
  1078. package/node_modules/@murphai/device-syncd/dist/store/sources.js +268 -58
  1079. package/node_modules/@murphai/device-syncd/dist/store/sources.js.map +1 -1
  1080. package/node_modules/@murphai/device-syncd/dist/store/sync-state.d.ts +7 -2
  1081. package/node_modules/@murphai/device-syncd/dist/store/sync-state.d.ts.map +1 -1
  1082. package/node_modules/@murphai/device-syncd/dist/store/sync-state.js +82 -28
  1083. package/node_modules/@murphai/device-syncd/dist/store/sync-state.js.map +1 -1
  1084. package/node_modules/@murphai/device-syncd/dist/store/webhook-traces.js +2 -2
  1085. package/node_modules/@murphai/device-syncd/dist/store/webhook-traces.js.map +1 -1
  1086. package/node_modules/@murphai/device-syncd/dist/store.d.ts +30 -5
  1087. package/node_modules/@murphai/device-syncd/dist/store.d.ts.map +1 -1
  1088. package/node_modules/@murphai/device-syncd/dist/store.js +146 -13
  1089. package/node_modules/@murphai/device-syncd/dist/store.js.map +1 -1
  1090. package/node_modules/@murphai/device-syncd/dist/types.d.ts +260 -8
  1091. package/node_modules/@murphai/device-syncd/dist/types.d.ts.map +1 -1
  1092. package/node_modules/@murphai/device-syncd/dist/types.js +7 -0
  1093. package/node_modules/@murphai/device-syncd/dist/types.js.map +1 -1
  1094. package/node_modules/@murphai/device-syncd/package.json +16 -0
  1095. package/node_modules/@murphai/health-commons/content/biomarkers/bilirubin.md +18 -0
  1096. package/node_modules/@murphai/health-commons/content/biomarkers/carbon-dioxide.md +18 -0
  1097. package/node_modules/@murphai/health-commons/content/biomarkers/potassium.md +18 -0
  1098. package/node_modules/@murphai/health-commons/content/biomarkers/sodium.md +18 -0
  1099. package/node_modules/@murphai/health-commons/content/families/general-eye-health.md +190 -0
  1100. package/node_modules/@murphai/health-commons/content/families/photobiomodulation.md +97 -0
  1101. package/node_modules/@murphai/health-commons/content/families/recovery-modalities.md +73 -0
  1102. package/node_modules/@murphai/health-commons/content/protocols/whole-body-photobiomodulation/whole-body-red-and-near-infrared-light-exposure.md +1 -1
  1103. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/cdc-contact-lens-infection-symptoms.md +20 -0
  1104. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/cdc-contact-lens-prevention.md +20 -0
  1105. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/cdc-stroke-signs.md +20 -0
  1106. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/cochrane-blue-light-filtering-lenses.md +21 -0
  1107. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/fda-buying-contact-lenses.md +20 -0
  1108. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/fda-eye-drops.md +20 -0
  1109. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/imi-myopia-interventions.md +20 -0
  1110. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/medlineplus-eye-emergencies.md +20 -0
  1111. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/medlineplus-eye-pain.md +20 -0
  1112. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-angle-closure-glaucoma.md +20 -0
  1113. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-areds2-faq.md +20 -0
  1114. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-contact-lenses.md +20 -0
  1115. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-dry-eye.md +20 -0
  1116. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-healthy-vision.md +21 -0
  1117. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-myopia.md +20 -0
  1118. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nei-retinal-detachment.md +20 -0
  1119. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/nih-dream-omega3-dry-eye.md +21 -0
  1120. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/osha-computer-monitors.md +20 -0
  1121. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/pmc-9840372.md +22 -0
  1122. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/pmid-35597519.md +21 -0
  1123. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/pmid-36473088.md +21 -0
  1124. package/node_modules/@murphai/health-commons/content/sources/general-eye-health/pmid-37062428.md +21 -0
  1125. package/node_modules/@murphai/health-commons/content/sources/whole-body-photobiomodulation/clinicaltrials-gov-nct07047248-2026-04-23.md +0 -1
  1126. package/node_modules/@murphai/health-commons/dist/biomarker-fallback-ranges.d.ts +3 -0
  1127. package/node_modules/@murphai/health-commons/dist/biomarker-fallback-ranges.d.ts.map +1 -0
  1128. package/node_modules/@murphai/health-commons/dist/biomarker-fallback-ranges.js +2 -0
  1129. package/node_modules/@murphai/health-commons/dist/biomarker-fallback-ranges.js.map +1 -0
  1130. package/node_modules/@murphai/health-commons/dist/biomarker-runtime-artifacts.d.ts +17 -0
  1131. package/node_modules/@murphai/health-commons/dist/biomarker-runtime-artifacts.d.ts.map +1 -0
  1132. package/node_modules/@murphai/health-commons/dist/biomarker-runtime-artifacts.js +16 -0
  1133. package/node_modules/@murphai/health-commons/dist/biomarker-runtime-artifacts.js.map +1 -0
  1134. package/node_modules/@murphai/health-commons/dist/build.d.ts.map +1 -1
  1135. package/node_modules/@murphai/health-commons/dist/build.js +41 -7
  1136. package/node_modules/@murphai/health-commons/dist/build.js.map +1 -1
  1137. package/node_modules/@murphai/health-commons/dist/index.d.ts +1 -0
  1138. package/node_modules/@murphai/health-commons/dist/index.d.ts.map +1 -1
  1139. package/node_modules/@murphai/health-commons/dist/index.js +1 -0
  1140. package/node_modules/@murphai/health-commons/dist/index.js.map +1 -1
  1141. package/node_modules/@murphai/health-commons/dist/knowledge-index.d.ts +44 -0
  1142. package/node_modules/@murphai/health-commons/dist/knowledge-index.d.ts.map +1 -0
  1143. package/node_modules/@murphai/health-commons/dist/knowledge-index.js +540 -0
  1144. package/node_modules/@murphai/health-commons/dist/knowledge-index.js.map +1 -0
  1145. package/node_modules/@murphai/health-commons/dist/runtime.d.ts +17 -1
  1146. package/node_modules/@murphai/health-commons/dist/runtime.d.ts.map +1 -1
  1147. package/node_modules/@murphai/health-commons/dist/runtime.js +58 -4
  1148. package/node_modules/@murphai/health-commons/dist/runtime.js.map +1 -1
  1149. package/node_modules/@murphai/health-commons/generated/biomarker-desired-directions.json +410 -0
  1150. package/node_modules/@murphai/health-commons/generated/catalog.hash +1 -1
  1151. package/node_modules/@murphai/health-commons/generated/knowledge.sqlite +0 -0
  1152. package/node_modules/@murphai/health-commons/generated/protocol-family-graph.json +187 -46
  1153. package/node_modules/@murphai/health-commons/generated/protocol-index.json +47 -47
  1154. package/node_modules/@murphai/health-commons/generated/protocol-run-specs.json +967 -967
  1155. package/node_modules/@murphai/health-commons/generated/source-artifact-index.json +1 -1
  1156. package/node_modules/@murphai/health-commons/generated/source-identities.ndjson +28 -0
  1157. package/node_modules/@murphai/health-commons/generated/source-index.json +694 -2
  1158. package/node_modules/@murphai/health-commons/generated/web/browse/biomarkers.json +77 -9
  1159. package/node_modules/@murphai/health-commons/generated/web/browse/experiments.json +37 -37
  1160. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-basophils.json +1 -1
  1161. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-eosinophils.json +1 -1
  1162. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-immature-granulocytes.json +1 -1
  1163. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-lymphocytes.json +1 -1
  1164. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-monocytes.json +1 -1
  1165. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/absolute-neutrophils.json +1 -1
  1166. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/added-sugar-intake.json +1 -1
  1167. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/adherence.json +1 -1
  1168. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/adjusted-calcium.json +1 -1
  1169. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/adverse-symptoms.json +1 -1
  1170. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alanine-aminotransferase.json +1 -1
  1171. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/albumin-globulin-ratio.json +1 -1
  1172. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/albumin.json +1 -1
  1173. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-craving.json +1 -1
  1174. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-free-days.json +1 -1
  1175. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-intake.json +1 -1
  1176. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alcohol-withdrawal-symptoms.json +1 -1
  1177. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/alkaline-phosphatase.json +1 -1
  1178. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ana-screen.json +1 -1
  1179. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/anion-gap.json +1 -1
  1180. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ankle-knee-to-wall-distance.json +1 -1
  1181. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/apolipoprotein-b.json +1 -1
  1182. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/arachidonic-acid-epa-ratio.json +1 -1
  1183. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/arachidonic-acid.json +1 -1
  1184. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/aspartate-aminotransferase.json +1 -1
  1185. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/basophil-percentage.json +1 -1
  1186. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/bedtime-delay.json +1 -1
  1187. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/bilirubin.json +3 -3
  1188. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-glucose.json +1 -1
  1189. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-ketones-beta-hydroxybutyrate.json +1 -1
  1190. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-oxygen-spo2.json +1 -1
  1191. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-pressure.json +1 -1
  1192. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/blood-urea-nitrogen.json +1 -1
  1193. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/body-fat-percent.json +1 -1
  1194. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/body-weight.json +1 -1
  1195. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/bun-creatinine-ratio.json +1 -1
  1196. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/c-peptide.json +1 -1
  1197. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/calcium.json +1 -1
  1198. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/carbon-dioxide.json +3 -3
  1199. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/chloride.json +1 -1
  1200. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/cholesterol-hdl-ratio.json +1 -1
  1201. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/chosen-primary-outcome-score.json +1 -1
  1202. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/continuous-glucose.json +1 -1
  1203. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/cortisol.json +1 -1
  1204. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/creatine-kinase.json +1 -1
  1205. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-energy-intake-kcal.json +1 -1
  1206. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-protein-g-per-kg.json +1 -1
  1207. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-protein-grams.json +1 -1
  1208. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daily-step-count.json +1 -1
  1209. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/daytime-sleepiness.json +1 -1
  1210. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/deep-sleep-minutes.json +4 -4
  1211. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/dha.json +1 -1
  1212. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/dhea-sulfate.json +1 -1
  1213. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/dietary-fiber-g-day.json +1 -1
  1214. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/digestive-comfort.json +1 -1
  1215. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/dpa.json +1 -1
  1216. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/egfr-ckd-epi.json +1 -1
  1217. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/egfr.json +1 -1
  1218. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/eosinophil-percentage.json +1 -1
  1219. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/epa.json +1 -1
  1220. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/estimated-gfr.json +1 -1
  1221. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/estimated-vo2max.json +1 -1
  1222. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/estradiol.json +1 -1
  1223. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/fasting-triglycerides.json +1 -1
  1224. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ferritin.json +1 -1
  1225. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/fib4.json +1 -1
  1226. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/follicle-stimulating-hormone.json +1 -1
  1227. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/free-t3.json +1 -1
  1228. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/free-t4.json +1 -1
  1229. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/free-testosterone.json +1 -1
  1230. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gfr-mdrd-af-amer.json +1 -1
  1231. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gfr-mdrd-non-af-amer.json +1 -1
  1232. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ggt.json +1 -1
  1233. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gi-symptom-score.json +1 -1
  1234. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/gi-tolerance.json +1 -1
  1235. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hba1c.json +1 -1
  1236. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hbot-session-tolerability.json +1 -1
  1237. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hdl-c.json +1 -1
  1238. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hematocrit.json +1 -1
  1239. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hemoglobin.json +1 -1
  1240. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/homocysteine.json +1 -1
  1241. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hrv-rmssd.json +4 -4
  1242. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/hs-crp.json +1 -1
  1243. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/immature-granulocyte-percentage.json +1 -1
  1244. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/insulin.json +1 -1
  1245. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/iron-saturation.json +1 -1
  1246. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/iron.json +1 -1
  1247. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lateral-knee-pain.json +1 -1
  1248. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldh.json +1 -1
  1249. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-c.json +1 -1
  1250. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-calculated.json +1 -1
  1251. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-chol-calc-nih.json +1 -1
  1252. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-cholesterol.json +1 -1
  1253. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-large-particles.json +1 -1
  1254. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-medium-particles.json +1 -1
  1255. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-particle-number.json +1 -1
  1256. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-pattern.json +1 -1
  1257. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-peak-size.json +1 -1
  1258. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/ldl-small-particles.json +1 -1
  1259. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lead.json +1 -1
  1260. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lean-body-mass.json +1 -1
  1261. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lean-mass.json +1 -1
  1262. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/leg-heaviness-score.json +1 -1
  1263. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/linoleic-acid.json +1 -1
  1264. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lipoprotein-a.json +1 -1
  1265. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/liver-enzyme-panel.json +1 -1
  1266. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/luteinizing-hormone.json +1 -1
  1267. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/lymphocyte-percentage.json +1 -1
  1268. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/macular-health-safety.json +1 -1
  1269. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/magnesium-rbc.json +1 -1
  1270. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mean-corpuscular-hemoglobin-concentration.json +1 -1
  1271. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mean-corpuscular-hemoglobin.json +1 -1
  1272. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mean-corpuscular-volume.json +1 -1
  1273. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mean-platelet-volume.json +1 -1
  1274. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mercury.json +1 -1
  1275. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/methylmalonic-acid.json +1 -1
  1276. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/moderate-to-vigorous-activity-minutes.json +1 -1
  1277. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/monocyte-percentage.json +1 -1
  1278. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/mood-affect.json +1 -1
  1279. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/morning-blood-pressure.json +1 -1
  1280. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/muscle-soreness-score.json +1 -1
  1281. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/musculoskeletal-pain.json +1 -1
  1282. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/neutrophil-percentage.json +1 -1
  1283. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/non-hdl-c.json +1 -1
  1284. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/non-hdl-cholesterol.json +1 -1
  1285. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omega-3-index.json +1 -1
  1286. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omega-3-total-omegacheck.json +1 -1
  1287. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omega-6-3-ratio.json +1 -1
  1288. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omega-6-total.json +1 -1
  1289. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/omegacheck-total.json +1 -1
  1290. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-recovery-score.json +1 -1
  1291. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-recovery.json +1 -1
  1292. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-stiffness.json +1 -1
  1293. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/perceived-stress.json +1 -1
  1294. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/periocular-wrinkle-score.json +1 -1
  1295. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/phosphate.json +1 -1
  1296. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/platelet-count.json +1 -1
  1297. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/poc-troponin-i.json +1 -1
  1298. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/postprandial-glucose-excursion.json +1 -1
  1299. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/potassium.json +3 -3
  1300. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/pre-sleep-arousal.json +1 -1
  1301. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/prolactin.json +1 -1
  1302. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/psa-free.json +1 -1
  1303. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/psa-percent-free.json +1 -1
  1304. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/psa-total.json +1 -1
  1305. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/red-blood-cell-count.json +1 -1
  1306. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/red-cell-distribution-width.json +1 -1
  1307. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/rem-sleep-minutes.json +1 -1
  1308. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/resting-heart-rate.json +4 -4
  1309. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/rheumatoid-factor.json +1 -1
  1310. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/running-tolerance.json +1 -1
  1311. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/saturated-fat-g-day.json +1 -1
  1312. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sedentary-time.json +1 -1
  1313. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/self-reported-mood.json +1 -1
  1314. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-25-hydroxyvitamin-d.json +1 -1
  1315. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-creatinine.json +1 -1
  1316. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/serum-uric-acid.json +1 -1
  1317. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sex-hormone-binding-globulin.json +1 -1
  1318. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/shoulder-reach-distance.json +1 -1
  1319. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sit-and-reach-distance.json +1 -1
  1320. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/skin-texture-roughness-score.json +1 -1
  1321. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/skin-tolerability-symptoms.json +1 -1
  1322. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-efficiency.json +4 -4
  1323. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-onset-latency.json +1 -1
  1324. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sleep-quality.json +1 -1
  1325. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/sodium.json +3 -3
  1326. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/standardized-skin-photo-score.json +1 -1
  1327. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/step-floor-days.json +1 -1
  1328. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-adherence-sessions.json +1 -1
  1329. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-session-burden.json +1 -1
  1330. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/stretching-symptoms.json +1 -1
  1331. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/subjective-eye-strain.json +1 -1
  1332. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/subjective-satiety.json +1 -1
  1333. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/supplement-adherence.json +1 -1
  1334. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/task-performance.json +1 -1
  1335. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/thyroglobulin-antibodies.json +1 -1
  1336. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/thyroid-peroxidase-antibodies.json +1 -1
  1337. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/thyroid-stimulating-hormone.json +1 -1
  1338. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/toe-touch-distance.json +1 -1
  1339. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-cholesterol.json +1 -1
  1340. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-globulin.json +1 -1
  1341. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-iron-binding-capacity.json +1 -1
  1342. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-protein.json +1 -1
  1343. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-sleep-time.json +1 -1
  1344. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/total-testosterone.json +1 -1
  1345. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/training-performance.json +1 -1
  1346. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/training-volume.json +1 -1
  1347. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/triglycerides.json +1 -1
  1348. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/urine-albumin-creatinine-ratio.json +1 -1
  1349. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/urine-albumin-random-without-creatinine.json +1 -1
  1350. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/urine-protein.json +1 -1
  1351. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/visual-fatigue.json +1 -1
  1352. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/visual-performance.json +1 -1
  1353. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/vldl-cholesterol-calculated.json +1 -1
  1354. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/waist-circumference.json +1 -1
  1355. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/wake-after-sleep-onset.json +1 -1
  1356. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/wake-time-variability.json +1 -1
  1357. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-bout-minutes.json +1 -1
  1358. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-cadence.json +1 -1
  1359. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/walking-safety-events.json +1 -1
  1360. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/white-blood-cell-count.json +1 -1
  1361. package/node_modules/@murphai/health-commons/generated/web/bundles/biomarker/zinc.json +1 -1
  1362. package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/clinic-imaging-upgrade.json +1 -1
  1363. package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/home-standardized-photo-roi-analysis.json +1 -1
  1364. package/node_modules/@murphai/health-commons/generated/web/bundles/measurement_method/standardized-photo-score-workflow.json +1 -1
  1365. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/bryan-johnson-blueprint.json +1 -1
  1366. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/cold-plunge.json +1 -1
  1367. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/consistent-wake-time.json +1 -1
  1368. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/daily-step-floor.json +1 -1
  1369. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/finnish-sauna.json +1 -1
  1370. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/five-minute-tomorrow-list.json +1 -1
  1371. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/hyperbaric-oxygen-therapy.json +1 -1
  1372. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/morning-outdoor-light-exposure.json +1 -1
  1373. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/no-added-sugar-diet.json +1 -1
  1374. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/norwegian-4x4.json +1 -1
  1375. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/pneumatic-compression-pants.json +1 -1
  1376. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/protein-floor-high-protein-intake.json +3 -3
  1377. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/tabata-20-10-interval-training.json +1 -1
  1378. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/time-restricted-eating-18-6.json +1 -1
  1379. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/walking-after-every-meal.json +1 -1
  1380. package/node_modules/@murphai/health-commons/generated/web/bundles/protocol_variant/whole-body-red-and-near-infrared-light-exposure.json +7 -8
  1381. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/blood-oxygen-spo2/overview.json +1 -1
  1382. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/blood-oxygen-spo2/research.json +1 -1
  1383. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/deep-sleep-minutes/overview.json +2 -2
  1384. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/deep-sleep-minutes/research.json +1 -1
  1385. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/estimated-vo2max/overview.json +1 -1
  1386. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/estimated-vo2max/research.json +1 -1
  1387. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/hrv-rmssd/overview.json +2 -2
  1388. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/hrv-rmssd/research.json +1 -1
  1389. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/rem-sleep-minutes/overview.json +1 -1
  1390. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/rem-sleep-minutes/research.json +1 -1
  1391. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/resting-heart-rate/overview.json +2 -2
  1392. package/node_modules/@murphai/health-commons/generated/web/pages/biomarkers/resting-heart-rate/research.json +1 -1
  1393. package/node_modules/@murphai/health-commons/generated/web/routes/index.json +1 -1
  1394. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/blood-oxygen-spo2.json +1 -1
  1395. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/deep-sleep-minutes.json +1 -1
  1396. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/estimated-vo2max.json +1 -1
  1397. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/hrv-rmssd.json +1 -1
  1398. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/rem-sleep-minutes.json +1 -1
  1399. package/node_modules/@murphai/health-commons/generated/web/shell/biomarkers/resting-heart-rate.json +1 -1
  1400. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/bryan-johnson-blueprint.json +1 -1
  1401. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/cold-plunge.json +1 -1
  1402. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/consistent-wake-time.json +1 -1
  1403. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/daily-step-floor.json +1 -1
  1404. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/finnish-sauna.json +1 -1
  1405. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/five-minute-tomorrow-list.json +1 -1
  1406. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/hyperbaric-oxygen-therapy.json +1 -1
  1407. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/morning-outdoor-light-exposure.json +1 -1
  1408. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/no-added-sugar-diet.json +1 -1
  1409. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/norwegian-4x4.json +1 -1
  1410. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/pneumatic-compression-pants.json +1 -1
  1411. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/protein-floor-high-protein-intake.json +1 -1
  1412. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/tabata-20-10-interval-training.json +1 -1
  1413. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/time-restricted-eating-18-6.json +1 -1
  1414. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/walking-after-every-meal.json +1 -1
  1415. package/node_modules/@murphai/health-commons/generated/web/shell/experiments/whole-body-red-and-near-infrared-light-exposure.json +3 -3
  1416. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/protocol.json +1 -1
  1417. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/research.json +1 -1
  1418. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/bryan-johnson-blueprint/results-public.json +2 -2
  1419. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/protocol.json +1 -1
  1420. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/research.json +1 -1
  1421. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/cold-plunge/results-public.json +2 -2
  1422. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/protocol.json +1 -1
  1423. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/research.json +1 -1
  1424. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/consistent-wake-time/results-public.json +2 -2
  1425. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/protocol.json +1 -1
  1426. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/research.json +1 -1
  1427. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/daily-step-floor/results-public.json +2 -2
  1428. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/protocol.json +1 -1
  1429. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/research.json +1 -1
  1430. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/finnish-sauna/results-public.json +2 -2
  1431. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/five-minute-tomorrow-list/protocol.json +1 -1
  1432. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/five-minute-tomorrow-list/research.json +1 -1
  1433. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/five-minute-tomorrow-list/results-public.json +2 -2
  1434. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/protocol.json +1 -1
  1435. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/research.json +1 -1
  1436. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/hyperbaric-oxygen-therapy/results-public.json +2 -2
  1437. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/protocol.json +1 -1
  1438. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/research.json +1 -1
  1439. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/morning-outdoor-light-exposure/results-public.json +2 -2
  1440. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/protocol.json +1 -1
  1441. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/research.json +1 -1
  1442. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/no-added-sugar-diet/results-public.json +2 -2
  1443. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/protocol.json +1 -1
  1444. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/research.json +1 -1
  1445. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/norwegian-4x4/results-public.json +2 -2
  1446. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/protocol.json +1 -1
  1447. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/research.json +1 -1
  1448. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/pneumatic-compression-pants/results-public.json +2 -2
  1449. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/protocol.json +1 -1
  1450. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/research.json +1 -1
  1451. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/protein-floor-high-protein-intake/results-public.json +2 -2
  1452. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/protocol.json +1 -1
  1453. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/research.json +1 -1
  1454. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/tabata-20-10-interval-training/results-public.json +2 -2
  1455. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/protocol.json +1 -1
  1456. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/research.json +1 -1
  1457. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/time-restricted-eating-18-6/results-public.json +2 -2
  1458. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/protocol.json +1 -1
  1459. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/research.json +1 -1
  1460. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/walking-after-every-meal/results-public.json +2 -2
  1461. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/protocol.json +3 -3
  1462. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/research.json +3 -3
  1463. package/node_modules/@murphai/health-commons/generated/web/tabs/experiments/whole-body-red-and-near-infrared-light-exposure/results-public.json +5 -5
  1464. package/node_modules/@murphai/health-commons/package.json +5 -0
  1465. package/node_modules/@murphai/health-metrics/dist/catalog.d.ts.map +1 -1
  1466. package/node_modules/@murphai/health-metrics/dist/catalog.js +22 -2
  1467. package/node_modules/@murphai/health-metrics/dist/catalog.js.map +1 -1
  1468. package/node_modules/@murphai/health-metrics/dist/definitions/activity.d.ts.map +1 -1
  1469. package/node_modules/@murphai/health-metrics/dist/definitions/activity.js +165 -0
  1470. package/node_modules/@murphai/health-metrics/dist/definitions/activity.js.map +1 -1
  1471. package/node_modules/@murphai/health-metrics/dist/definitions/body.d.ts.map +1 -1
  1472. package/node_modules/@murphai/health-metrics/dist/definitions/body.js +69 -2
  1473. package/node_modules/@murphai/health-metrics/dist/definitions/body.js.map +1 -1
  1474. package/node_modules/@murphai/health-metrics/dist/definitions/physiology.d.ts +55 -0
  1475. package/node_modules/@murphai/health-metrics/dist/definitions/physiology.d.ts.map +1 -0
  1476. package/node_modules/@murphai/health-metrics/dist/definitions/physiology.js +92 -0
  1477. package/node_modules/@murphai/health-metrics/dist/definitions/physiology.js.map +1 -0
  1478. package/node_modules/@murphai/health-metrics/dist/definitions/vitals.d.ts +1 -1
  1479. package/node_modules/@murphai/health-metrics/dist/index.d.ts +1 -0
  1480. package/node_modules/@murphai/health-metrics/dist/index.d.ts.map +1 -1
  1481. package/node_modules/@murphai/health-metrics/dist/index.js +1 -0
  1482. package/node_modules/@murphai/health-metrics/dist/index.js.map +1 -1
  1483. package/node_modules/@murphai/health-metrics/dist/lab-reference-ranges.d.ts +45 -0
  1484. package/node_modules/@murphai/health-metrics/dist/lab-reference-ranges.d.ts.map +1 -0
  1485. package/node_modules/@murphai/health-metrics/dist/lab-reference-ranges.js +502 -0
  1486. package/node_modules/@murphai/health-metrics/dist/lab-reference-ranges.js.map +1 -0
  1487. package/node_modules/@murphai/health-metrics/dist/normalize.d.ts.map +1 -1
  1488. package/node_modules/@murphai/health-metrics/dist/normalize.js +5 -0
  1489. package/node_modules/@murphai/health-metrics/dist/normalize.js.map +1 -1
  1490. package/node_modules/@murphai/health-metrics/dist/selectors.d.ts +3 -0
  1491. package/node_modules/@murphai/health-metrics/dist/selectors.d.ts.map +1 -1
  1492. package/node_modules/@murphai/health-metrics/dist/selectors.js +52 -6
  1493. package/node_modules/@murphai/health-metrics/dist/selectors.js.map +1 -1
  1494. package/node_modules/@murphai/health-metrics/dist/types.d.ts +1 -0
  1495. package/node_modules/@murphai/health-metrics/dist/types.d.ts.map +1 -1
  1496. package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.d.ts +12 -1
  1497. package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.d.ts.map +1 -1
  1498. package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.js +34 -1
  1499. package/node_modules/@murphai/health-metrics/dist/wearable-metric-catalog.js.map +1 -1
  1500. package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.d.ts +79 -0
  1501. package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.d.ts.map +1 -1
  1502. package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.js +19 -0
  1503. package/node_modules/@murphai/health-metrics/dist/wearable-provider-catalog.js.map +1 -1
  1504. package/node_modules/@murphai/importers/README.md +2 -0
  1505. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js +1 -1
  1506. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js.map +1 -1
  1507. package/node_modules/@murphai/importers/dist/core-port.d.ts +16 -1
  1508. package/node_modules/@murphai/importers/dist/core-port.d.ts.map +1 -1
  1509. package/node_modules/@murphai/importers/dist/core-port.js.map +1 -1
  1510. package/node_modules/@murphai/importers/dist/create-importers.d.ts +9 -1
  1511. package/node_modules/@murphai/importers/dist/create-importers.d.ts.map +1 -1
  1512. package/node_modules/@murphai/importers/dist/create-importers.js +12 -2
  1513. package/node_modules/@murphai/importers/dist/create-importers.js.map +1 -1
  1514. package/node_modules/@murphai/importers/dist/csv-sample-import-planner.d.ts +1 -0
  1515. package/node_modules/@murphai/importers/dist/csv-sample-import-planner.d.ts.map +1 -1
  1516. package/node_modules/@murphai/importers/dist/csv-sample-import-planner.js +1 -1
  1517. package/node_modules/@murphai/importers/dist/csv-sample-import-planner.js.map +1 -1
  1518. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts +17 -3
  1519. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts.map +1 -1
  1520. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js +103 -9
  1521. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js.map +1 -1
  1522. package/node_modules/@murphai/importers/dist/device-providers/index.d.ts +5 -4
  1523. package/node_modules/@murphai/importers/dist/device-providers/index.d.ts.map +1 -1
  1524. package/node_modules/@murphai/importers/dist/device-providers/index.js +4 -3
  1525. package/node_modules/@murphai/importers/dist/device-providers/index.js.map +1 -1
  1526. package/node_modules/@murphai/importers/dist/device-providers/junction-bounded-features.d.ts +37 -0
  1527. package/node_modules/@murphai/importers/dist/device-providers/junction-bounded-features.d.ts.map +1 -0
  1528. package/node_modules/@murphai/importers/dist/device-providers/junction-bounded-features.js +796 -0
  1529. package/node_modules/@murphai/importers/dist/device-providers/junction-bounded-features.js.map +1 -0
  1530. package/node_modules/@murphai/importers/dist/device-providers/junction-origin.d.ts +1 -0
  1531. package/node_modules/@murphai/importers/dist/device-providers/junction-origin.d.ts.map +1 -1
  1532. package/node_modules/@murphai/importers/dist/device-providers/junction-origin.js +7 -2
  1533. package/node_modules/@murphai/importers/dist/device-providers/junction-origin.js.map +1 -1
  1534. package/node_modules/@murphai/importers/dist/device-providers/junction-resources.d.ts +7 -12
  1535. package/node_modules/@murphai/importers/dist/device-providers/junction-resources.d.ts.map +1 -1
  1536. package/node_modules/@murphai/importers/dist/device-providers/junction-resources.js +55 -103
  1537. package/node_modules/@murphai/importers/dist/device-providers/junction-resources.js.map +1 -1
  1538. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-features.d.ts +79 -0
  1539. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-features.d.ts.map +1 -0
  1540. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-features.js +356 -0
  1541. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-features.js.map +1 -0
  1542. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-fidelity.d.ts +285 -0
  1543. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-fidelity.d.ts.map +1 -0
  1544. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-fidelity.js +870 -0
  1545. package/node_modules/@murphai/importers/dist/device-providers/junction-timeseries-fidelity.js.map +1 -0
  1546. package/node_modules/@murphai/importers/dist/device-providers/junction.d.ts +111 -0
  1547. package/node_modules/@murphai/importers/dist/device-providers/junction.d.ts.map +1 -1
  1548. package/node_modules/@murphai/importers/dist/device-providers/junction.js +4058 -306
  1549. package/node_modules/@murphai/importers/dist/device-providers/junction.js.map +1 -1
  1550. package/node_modules/@murphai/importers/dist/device-providers/oura.js +1 -1
  1551. package/node_modules/@murphai/importers/dist/device-providers/oura.js.map +1 -1
  1552. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.d.ts.map +1 -1
  1553. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js +1 -0
  1554. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js.map +1 -1
  1555. package/node_modules/@murphai/importers/dist/device-providers/types.d.ts +9 -1
  1556. package/node_modules/@murphai/importers/dist/device-providers/types.d.ts.map +1 -1
  1557. package/node_modules/@murphai/importers/dist/device-providers/whoop.js +1 -1
  1558. package/node_modules/@murphai/importers/dist/device-providers/whoop.js.map +1 -1
  1559. package/node_modules/@murphai/importers/dist/document-importer.d.ts +1 -0
  1560. package/node_modules/@murphai/importers/dist/document-importer.d.ts.map +1 -1
  1561. package/node_modules/@murphai/importers/dist/document-importer.js +3 -1
  1562. package/node_modules/@murphai/importers/dist/document-importer.js.map +1 -1
  1563. package/node_modules/@murphai/importers/dist/index.d.ts +3 -2
  1564. package/node_modules/@murphai/importers/dist/index.d.ts.map +1 -1
  1565. package/node_modules/@murphai/importers/dist/index.js +2 -1
  1566. package/node_modules/@murphai/importers/dist/index.js.map +1 -1
  1567. package/node_modules/@murphai/importers/dist/meal-importer.d.ts.map +1 -1
  1568. package/node_modules/@murphai/importers/dist/meal-importer.js +2 -1
  1569. package/node_modules/@murphai/importers/dist/meal-importer.js.map +1 -1
  1570. package/node_modules/@murphai/importers/dist/preset-registry.js +1 -1
  1571. package/node_modules/@murphai/importers/dist/preset-registry.js.map +1 -1
  1572. package/node_modules/@murphai/importers/dist/shared.d.ts +1 -1
  1573. package/node_modules/@murphai/importers/dist/shared.d.ts.map +1 -1
  1574. package/node_modules/@murphai/importers/dist/shared.js +1 -1
  1575. package/node_modules/@murphai/importers/dist/shared.js.map +1 -1
  1576. package/node_modules/@murphai/importers/dist/workout-csv-planner.d.ts +49 -0
  1577. package/node_modules/@murphai/importers/dist/workout-csv-planner.d.ts.map +1 -0
  1578. package/node_modules/@murphai/importers/dist/workout-csv-planner.js +860 -0
  1579. package/node_modules/@murphai/importers/dist/workout-csv-planner.js.map +1 -0
  1580. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor-strategies.d.ts +2 -5
  1581. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor-strategies.d.ts.map +1 -1
  1582. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor-strategies.js +3 -50
  1583. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor-strategies.js.map +1 -1
  1584. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor.d.ts.map +1 -1
  1585. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor.js +9 -11
  1586. package/node_modules/@murphai/inbox-services/dist/inbox-app/bootstrap-doctor.js.map +1 -1
  1587. package/node_modules/@murphai/inbox-services/dist/inbox-app/environment.d.ts.map +1 -1
  1588. package/node_modules/@murphai/inbox-services/dist/inbox-app/environment.js +0 -160
  1589. package/node_modules/@murphai/inbox-services/dist/inbox-app/environment.js.map +1 -1
  1590. package/node_modules/@murphai/inbox-services/dist/inbox-app/runtime.d.ts.map +1 -1
  1591. package/node_modules/@murphai/inbox-services/dist/inbox-app/runtime.js +2 -4
  1592. package/node_modules/@murphai/inbox-services/dist/inbox-app/runtime.js.map +1 -1
  1593. package/node_modules/@murphai/inbox-services/dist/inbox-app/sources.d.ts +1 -1
  1594. package/node_modules/@murphai/inbox-services/dist/inbox-app/sources.d.ts.map +1 -1
  1595. package/node_modules/@murphai/inbox-services/dist/inbox-app/sources.js +2 -32
  1596. package/node_modules/@murphai/inbox-services/dist/inbox-app/sources.js.map +1 -1
  1597. package/node_modules/@murphai/inbox-services/dist/inbox-app/types.d.ts +2 -79
  1598. package/node_modules/@murphai/inbox-services/dist/inbox-app/types.d.ts.map +1 -1
  1599. package/node_modules/@murphai/inbox-services/dist/inbox-app/types.js +0 -1
  1600. package/node_modules/@murphai/inbox-services/dist/inbox-app/types.js.map +1 -1
  1601. package/node_modules/@murphai/inbox-services/dist/inbox-services/connectors.d.ts +1 -2
  1602. package/node_modules/@murphai/inbox-services/dist/inbox-services/connectors.d.ts.map +1 -1
  1603. package/node_modules/@murphai/inbox-services/dist/inbox-services/connectors.js +15 -37
  1604. package/node_modules/@murphai/inbox-services/dist/inbox-services/connectors.js.map +1 -1
  1605. package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.d.ts +21 -21
  1606. package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.d.ts.map +1 -1
  1607. package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.js +1 -1
  1608. package/node_modules/@murphai/inbox-services/dist/inbox-services/promotions.js.map +1 -1
  1609. package/node_modules/@murphai/inbox-services/dist/inbox-services/shared.d.ts +1 -1
  1610. package/node_modules/@murphai/inbox-services/dist/inbox-services/shared.d.ts.map +1 -1
  1611. package/node_modules/@murphai/inbox-services/dist/inbox-services/shared.js +0 -1
  1612. package/node_modules/@murphai/inbox-services/dist/inbox-services/shared.js.map +1 -1
  1613. package/node_modules/@murphai/inbox-services/dist/index.d.ts +1 -1
  1614. package/node_modules/@murphai/inbox-services/dist/index.d.ts.map +1 -1
  1615. package/node_modules/@murphai/inboxd/README.md +4 -4
  1616. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.d.ts.map +1 -1
  1617. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.js +56 -5
  1618. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize-parsed.js.map +1 -1
  1619. package/node_modules/@murphai/inboxd/dist/connectors/linq/normalize.js +8 -0
  1620. package/node_modules/@murphai/inboxd/dist/connectors/linq/normalize.js.map +1 -1
  1621. package/node_modules/@murphai/inboxd/dist/connectors/telegram/normalize.d.ts +1 -0
  1622. package/node_modules/@murphai/inboxd/dist/connectors/telegram/normalize.d.ts.map +1 -1
  1623. package/node_modules/@murphai/inboxd/dist/connectors/telegram/normalize.js +1 -0
  1624. package/node_modules/@murphai/inboxd/dist/connectors/telegram/normalize.js.map +1 -1
  1625. package/node_modules/@murphai/inboxd/dist/index.d.ts +0 -5
  1626. package/node_modules/@murphai/inboxd/dist/index.d.ts.map +1 -1
  1627. package/node_modules/@murphai/inboxd/dist/index.js +0 -2
  1628. package/node_modules/@murphai/inboxd/dist/index.js.map +1 -1
  1629. package/node_modules/@murphai/inboxd/dist/indexing/attachment-storage-normalizer.d.ts.map +1 -1
  1630. package/node_modules/@murphai/inboxd/dist/indexing/attachment-storage-normalizer.js +141 -4
  1631. package/node_modules/@murphai/inboxd/dist/indexing/attachment-storage-normalizer.js.map +1 -1
  1632. package/node_modules/@murphai/inboxd/dist/indexing/retention.d.ts +6 -0
  1633. package/node_modules/@murphai/inboxd/dist/indexing/retention.d.ts.map +1 -1
  1634. package/node_modules/@murphai/inboxd/dist/indexing/retention.js +64 -18
  1635. package/node_modules/@murphai/inboxd/dist/indexing/retention.js.map +1 -1
  1636. package/node_modules/@murphai/inboxd/dist/retention.d.ts +1 -1
  1637. package/node_modules/@murphai/inboxd/dist/retention.d.ts.map +1 -1
  1638. package/node_modules/@murphai/inboxd/dist/retention.js +1 -1
  1639. package/node_modules/@murphai/inboxd/dist/retention.js.map +1 -1
  1640. package/node_modules/@murphai/messaging-ingress/README.md +5 -1
  1641. package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.d.ts +27 -1
  1642. package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.d.ts.map +1 -1
  1643. package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.js +164 -17
  1644. package/node_modules/@murphai/messaging-ingress/dist/linq-webhook.js.map +1 -1
  1645. package/node_modules/@murphai/messaging-ingress/dist/telegram-webhook-payload.d.ts +1 -0
  1646. package/node_modules/@murphai/messaging-ingress/dist/telegram-webhook-payload.d.ts.map +1 -1
  1647. package/node_modules/@murphai/messaging-ingress/dist/telegram-webhook-payload.js +2 -0
  1648. package/node_modules/@murphai/messaging-ingress/dist/telegram-webhook-payload.js.map +1 -1
  1649. package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.d.ts +3 -3
  1650. package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.d.ts.map +1 -1
  1651. package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.js +1 -1
  1652. package/node_modules/@murphai/operator-config/dist/assistant/codex-resume-state.js.map +1 -1
  1653. package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.d.ts +1 -1
  1654. package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.d.ts.map +1 -1
  1655. package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.js +7 -19
  1656. package/node_modules/@murphai/operator-config/dist/assistant/current-delivery-route.js.map +1 -1
  1657. package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.d.ts +31 -33
  1658. package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.d.ts.map +1 -1
  1659. package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.js +5 -8
  1660. package/node_modules/@murphai/operator-config/dist/assistant/hosted-config.js.map +1 -1
  1661. package/node_modules/@murphai/operator-config/dist/assistant/provider-config.d.ts +1 -15
  1662. package/node_modules/@murphai/operator-config/dist/assistant/provider-config.d.ts.map +1 -1
  1663. package/node_modules/@murphai/operator-config/dist/assistant/provider-config.js +52 -84
  1664. package/node_modules/@murphai/operator-config/dist/assistant/provider-config.js.map +1 -1
  1665. package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.d.ts +31 -48
  1666. package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.d.ts.map +1 -1
  1667. package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.js +33 -56
  1668. package/node_modules/@murphai/operator-config/dist/assistant/target-runtime.js.map +1 -1
  1669. package/node_modules/@murphai/operator-config/dist/assistant-backend.d.ts +11 -11
  1670. package/node_modules/@murphai/operator-config/dist/assistant-backend.d.ts.map +1 -1
  1671. package/node_modules/@murphai/operator-config/dist/assistant-backend.js +33 -45
  1672. package/node_modules/@murphai/operator-config/dist/assistant-backend.js.map +1 -1
  1673. package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.d.ts +1714 -1566
  1674. package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.d.ts.map +1 -1
  1675. package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.js +198 -23
  1676. package/node_modules/@murphai/operator-config/dist/assistant-cli-contracts.js.map +1 -1
  1677. package/node_modules/@murphai/operator-config/dist/assistant-response-cards.d.ts +468 -0
  1678. package/node_modules/@murphai/operator-config/dist/assistant-response-cards.d.ts.map +1 -0
  1679. package/node_modules/@murphai/operator-config/dist/assistant-response-cards.js +1051 -0
  1680. package/node_modules/@murphai/operator-config/dist/assistant-response-cards.js.map +1 -0
  1681. package/node_modules/@murphai/operator-config/dist/command-helpers.d.ts +4 -2
  1682. package/node_modules/@murphai/operator-config/dist/command-helpers.d.ts.map +1 -1
  1683. package/node_modules/@murphai/operator-config/dist/command-helpers.js +36 -1
  1684. package/node_modules/@murphai/operator-config/dist/command-helpers.js.map +1 -1
  1685. package/node_modules/@murphai/operator-config/dist/device-cli-contracts.d.ts +181 -181
  1686. package/node_modules/@murphai/operator-config/dist/device-cli-contracts.d.ts.map +1 -1
  1687. package/node_modules/@murphai/operator-config/dist/device-cli-contracts.js +1 -1
  1688. package/node_modules/@murphai/operator-config/dist/device-cli-contracts.js.map +1 -1
  1689. package/node_modules/@murphai/operator-config/dist/device-sync-client.d.ts.map +1 -1
  1690. package/node_modules/@murphai/operator-config/dist/device-sync-client.js +2 -6
  1691. package/node_modules/@murphai/operator-config/dist/device-sync-client.js.map +1 -1
  1692. package/node_modules/@murphai/operator-config/dist/elevenlabs-runtime.d.ts +3 -0
  1693. package/node_modules/@murphai/operator-config/dist/elevenlabs-runtime.d.ts.map +1 -1
  1694. package/node_modules/@murphai/operator-config/dist/elevenlabs-runtime.js +301 -63
  1695. package/node_modules/@murphai/operator-config/dist/elevenlabs-runtime.js.map +1 -1
  1696. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.d.ts +3 -2
  1697. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.d.ts.map +1 -1
  1698. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.js +3 -0
  1699. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config-constants.js.map +1 -1
  1700. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config.d.ts.map +1 -1
  1701. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config.js +2 -6
  1702. package/node_modules/@murphai/operator-config/dist/hosted-assistant-config.js.map +1 -1
  1703. package/node_modules/@murphai/operator-config/dist/http-json-retry.d.ts +7 -2
  1704. package/node_modules/@murphai/operator-config/dist/http-json-retry.d.ts.map +1 -1
  1705. package/node_modules/@murphai/operator-config/dist/http-json-retry.js +33 -14
  1706. package/node_modules/@murphai/operator-config/dist/http-json-retry.js.map +1 -1
  1707. package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.d.ts +427 -462
  1708. package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.d.ts.map +1 -1
  1709. package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.js +2 -14
  1710. package/node_modules/@murphai/operator-config/dist/inbox-cli-contracts.js.map +1 -1
  1711. package/node_modules/@murphai/operator-config/dist/linq-runtime.d.ts +35 -1
  1712. package/node_modules/@murphai/operator-config/dist/linq-runtime.d.ts.map +1 -1
  1713. package/node_modules/@murphai/operator-config/dist/linq-runtime.js +1115 -180
  1714. package/node_modules/@murphai/operator-config/dist/linq-runtime.js.map +1 -1
  1715. package/node_modules/@murphai/operator-config/dist/message-formatting.d.ts +1 -0
  1716. package/node_modules/@murphai/operator-config/dist/message-formatting.d.ts.map +1 -1
  1717. package/node_modules/@murphai/operator-config/dist/message-formatting.js +3 -1
  1718. package/node_modules/@murphai/operator-config/dist/message-formatting.js.map +1 -1
  1719. package/node_modules/@murphai/operator-config/dist/message-table-fallback.d.ts +7 -0
  1720. package/node_modules/@murphai/operator-config/dist/message-table-fallback.d.ts.map +1 -0
  1721. package/node_modules/@murphai/operator-config/dist/message-table-fallback.js +109 -0
  1722. package/node_modules/@murphai/operator-config/dist/message-table-fallback.js.map +1 -0
  1723. package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.d.ts +12 -12
  1724. package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.d.ts.map +1 -1
  1725. package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.js +1 -1
  1726. package/node_modules/@murphai/operator-config/dist/operator-config/self-delivery-targets.js.map +1 -1
  1727. package/node_modules/@murphai/operator-config/dist/operator-config.d.ts +50 -53
  1728. package/node_modules/@murphai/operator-config/dist/operator-config.d.ts.map +1 -1
  1729. package/node_modules/@murphai/operator-config/dist/operator-config.js +4 -5
  1730. package/node_modules/@murphai/operator-config/dist/operator-config.js.map +1 -1
  1731. package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.d.ts +225 -226
  1732. package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.d.ts.map +1 -1
  1733. package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.js +2 -2
  1734. package/node_modules/@murphai/operator-config/dist/setup-cli-contracts.js.map +1 -1
  1735. package/node_modules/@murphai/operator-config/dist/setup-runtime-env.d.ts.map +1 -1
  1736. package/node_modules/@murphai/operator-config/dist/setup-runtime-env.js +0 -19
  1737. package/node_modules/@murphai/operator-config/dist/setup-runtime-env.js.map +1 -1
  1738. package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.d.ts +402 -294
  1739. package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.d.ts.map +1 -1
  1740. package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.js +94 -8
  1741. package/node_modules/@murphai/operator-config/dist/vault-cli-contracts.js.map +1 -1
  1742. package/node_modules/@murphai/operator-config/dist/vault-cli-error-projection.d.ts +24 -0
  1743. package/node_modules/@murphai/operator-config/dist/vault-cli-error-projection.d.ts.map +1 -0
  1744. package/node_modules/@murphai/operator-config/dist/vault-cli-error-projection.js +219 -0
  1745. package/node_modules/@murphai/operator-config/dist/vault-cli-error-projection.js.map +1 -0
  1746. package/node_modules/@murphai/operator-config/dist/vault-cli-errors.d.ts.map +1 -1
  1747. package/node_modules/@murphai/operator-config/dist/vault-cli-errors.js.map +1 -1
  1748. package/node_modules/@murphai/operator-config/dist/workout-action-binding.d.ts +14 -0
  1749. package/node_modules/@murphai/operator-config/dist/workout-action-binding.d.ts.map +1 -0
  1750. package/node_modules/@murphai/operator-config/dist/workout-action-binding.js +127 -0
  1751. package/node_modules/@murphai/operator-config/dist/workout-action-binding.js.map +1 -0
  1752. package/node_modules/@murphai/operator-config/package.json +15 -5
  1753. package/node_modules/@murphai/parsers/dist/adapters/ffmpeg.d.ts +2 -0
  1754. package/node_modules/@murphai/parsers/dist/adapters/ffmpeg.d.ts.map +1 -1
  1755. package/node_modules/@murphai/parsers/dist/adapters/ffmpeg.js +18 -0
  1756. package/node_modules/@murphai/parsers/dist/adapters/ffmpeg.js.map +1 -1
  1757. package/node_modules/@murphai/query/README.md +29 -5
  1758. package/node_modules/@murphai/query/dist/automation.d.ts +5 -2
  1759. package/node_modules/@murphai/query/dist/automation.d.ts.map +1 -1
  1760. package/node_modules/@murphai/query/dist/automation.js +33 -8
  1761. package/node_modules/@murphai/query/dist/automation.js.map +1 -1
  1762. package/node_modules/@murphai/query/dist/browser-biomarkers.d.ts +2 -2
  1763. package/node_modules/@murphai/query/dist/browser-biomarkers.d.ts.map +1 -1
  1764. package/node_modules/@murphai/query/dist/browser-biomarkers.js +1 -1
  1765. package/node_modules/@murphai/query/dist/browser-biomarkers.js.map +1 -1
  1766. package/node_modules/@murphai/query/dist/browser-experiments.d.ts +2 -2
  1767. package/node_modules/@murphai/query/dist/browser-experiments.d.ts.map +1 -1
  1768. package/node_modules/@murphai/query/dist/browser-experiments.js +1 -1
  1769. package/node_modules/@murphai/query/dist/browser-experiments.js.map +1 -1
  1770. package/node_modules/@murphai/query/dist/browser-murph-age.d.ts +1 -1
  1771. package/node_modules/@murphai/query/dist/browser-murph-age.d.ts.map +1 -1
  1772. package/node_modules/@murphai/query/dist/browser-overview.d.ts +2 -1
  1773. package/node_modules/@murphai/query/dist/browser-overview.d.ts.map +1 -1
  1774. package/node_modules/@murphai/query/dist/browser-replica/biomarker-panel.d.ts +2 -2
  1775. package/node_modules/@murphai/query/dist/browser-replica/biomarker-panel.d.ts.map +1 -1
  1776. package/node_modules/@murphai/query/dist/browser-replica/build.d.ts +1 -1
  1777. package/node_modules/@murphai/query/dist/browser-replica/build.d.ts.map +1 -1
  1778. package/node_modules/@murphai/query/dist/browser-replica/build.js +68 -41
  1779. package/node_modules/@murphai/query/dist/browser-replica/build.js.map +1 -1
  1780. package/node_modules/@murphai/query/dist/browser-replica/client-overview.d.ts +3 -3
  1781. package/node_modules/@murphai/query/dist/browser-replica/client-overview.d.ts.map +1 -1
  1782. package/node_modules/@murphai/query/dist/browser-replica/client-overview.js +3 -0
  1783. package/node_modules/@murphai/query/dist/browser-replica/client-overview.js.map +1 -1
  1784. package/node_modules/@murphai/query/dist/browser-replica/device-metrics.d.ts +2 -2
  1785. package/node_modules/@murphai/query/dist/browser-replica/device-metrics.d.ts.map +1 -1
  1786. package/node_modules/@murphai/query/dist/browser-replica/device-metrics.js.map +1 -1
  1787. package/node_modules/@murphai/query/dist/browser-replica/experiment-run-cards.d.ts +8 -0
  1788. package/node_modules/@murphai/query/dist/browser-replica/experiment-run-cards.d.ts.map +1 -0
  1789. package/node_modules/@murphai/query/dist/browser-replica/experiment-run-cards.js +548 -0
  1790. package/node_modules/@murphai/query/dist/browser-replica/experiment-run-cards.js.map +1 -0
  1791. package/node_modules/@murphai/query/dist/browser-replica/experiments.d.ts +22 -2
  1792. package/node_modules/@murphai/query/dist/browser-replica/experiments.d.ts.map +1 -1
  1793. package/node_modules/@murphai/query/dist/browser-replica/experiments.js +209 -63
  1794. package/node_modules/@murphai/query/dist/browser-replica/experiments.js.map +1 -1
  1795. package/node_modules/@murphai/query/dist/browser-replica/json.d.ts +6 -0
  1796. package/node_modules/@murphai/query/dist/browser-replica/json.d.ts.map +1 -0
  1797. package/node_modules/@murphai/query/dist/browser-replica/json.js +103 -0
  1798. package/node_modules/@murphai/query/dist/browser-replica/json.js.map +1 -0
  1799. package/node_modules/@murphai/query/dist/browser-replica/lab-result-status.d.ts +11 -0
  1800. package/node_modules/@murphai/query/dist/browser-replica/lab-result-status.d.ts.map +1 -0
  1801. package/node_modules/@murphai/query/dist/browser-replica/lab-result-status.js +233 -0
  1802. package/node_modules/@murphai/query/dist/browser-replica/lab-result-status.js.map +1 -0
  1803. package/node_modules/@murphai/query/dist/browser-replica/lab-results.d.ts +4 -3
  1804. package/node_modules/@murphai/query/dist/browser-replica/lab-results.d.ts.map +1 -1
  1805. package/node_modules/@murphai/query/dist/browser-replica/lab-results.js +24 -5
  1806. package/node_modules/@murphai/query/dist/browser-replica/lab-results.js.map +1 -1
  1807. package/node_modules/@murphai/query/dist/browser-replica/metric-buckets.d.ts +14 -0
  1808. package/node_modules/@murphai/query/dist/browser-replica/metric-buckets.d.ts.map +1 -0
  1809. package/node_modules/@murphai/query/dist/browser-replica/metric-buckets.js +25 -0
  1810. package/node_modules/@murphai/query/dist/browser-replica/metric-buckets.js.map +1 -0
  1811. package/node_modules/@murphai/query/dist/browser-replica/murph-age.d.ts +2 -2
  1812. package/node_modules/@murphai/query/dist/browser-replica/murph-age.d.ts.map +1 -1
  1813. package/node_modules/@murphai/query/dist/browser-replica/murph-age.js.map +1 -1
  1814. package/node_modules/@murphai/query/dist/browser-replica/parse.d.ts +8 -0
  1815. package/node_modules/@murphai/query/dist/browser-replica/parse.d.ts.map +1 -1
  1816. package/node_modules/@murphai/query/dist/browser-replica/parse.js +327 -7
  1817. package/node_modules/@murphai/query/dist/browser-replica/parse.js.map +1 -1
  1818. package/node_modules/@murphai/query/dist/browser-replica/query.d.ts +24 -1
  1819. package/node_modules/@murphai/query/dist/browser-replica/query.d.ts.map +1 -1
  1820. package/node_modules/@murphai/query/dist/browser-replica/query.js +246 -41
  1821. package/node_modules/@murphai/query/dist/browser-replica/query.js.map +1 -1
  1822. package/node_modules/@murphai/query/dist/browser-replica/search-row.d.ts +3 -0
  1823. package/node_modules/@murphai/query/dist/browser-replica/search-row.d.ts.map +1 -0
  1824. package/node_modules/@murphai/query/dist/browser-replica/search-row.js +16 -0
  1825. package/node_modules/@murphai/query/dist/browser-replica/search-row.js.map +1 -0
  1826. package/node_modules/@murphai/query/dist/browser-replica/shards.d.ts +76 -0
  1827. package/node_modules/@murphai/query/dist/browser-replica/shards.d.ts.map +1 -0
  1828. package/node_modules/@murphai/query/dist/browser-replica/shards.js +232 -0
  1829. package/node_modules/@murphai/query/dist/browser-replica/shards.js.map +1 -0
  1830. package/node_modules/@murphai/query/dist/browser-replica/shared.d.ts +144 -9
  1831. package/node_modules/@murphai/query/dist/browser-replica/shared.d.ts.map +1 -1
  1832. package/node_modules/@murphai/query/dist/browser-replica/shared.js +1 -0
  1833. package/node_modules/@murphai/query/dist/browser-replica/shared.js.map +1 -1
  1834. package/node_modules/@murphai/query/dist/browser-replica/source.d.ts +13 -0
  1835. package/node_modules/@murphai/query/dist/browser-replica/source.d.ts.map +1 -0
  1836. package/node_modules/@murphai/query/dist/browser-replica/source.js +45 -0
  1837. package/node_modules/@murphai/query/dist/browser-replica/source.js.map +1 -0
  1838. package/node_modules/@murphai/query/dist/browser-replica/tracked-experiments.d.ts +3 -3
  1839. package/node_modules/@murphai/query/dist/browser-replica/tracked-experiments.d.ts.map +1 -1
  1840. package/node_modules/@murphai/query/dist/browser-replica/tracked-experiments.js.map +1 -1
  1841. package/node_modules/@murphai/query/dist/browser-replica/training.d.ts +7 -0
  1842. package/node_modules/@murphai/query/dist/browser-replica/training.d.ts.map +1 -0
  1843. package/node_modules/@murphai/query/dist/browser-replica/training.js +241 -0
  1844. package/node_modules/@murphai/query/dist/browser-replica/training.js.map +1 -0
  1845. package/node_modules/@murphai/query/dist/browser-replica/views.d.ts +5 -5
  1846. package/node_modules/@murphai/query/dist/browser-replica/views.d.ts.map +1 -1
  1847. package/node_modules/@murphai/query/dist/browser-replica/views.js +3 -0
  1848. package/node_modules/@murphai/query/dist/browser-replica/views.js.map +1 -1
  1849. package/node_modules/@murphai/query/dist/browser-replica-client.d.ts +11 -4
  1850. package/node_modules/@murphai/query/dist/browser-replica-client.d.ts.map +1 -1
  1851. package/node_modules/@murphai/query/dist/browser-replica-client.js +7 -3
  1852. package/node_modules/@murphai/query/dist/browser-replica-client.js.map +1 -1
  1853. package/node_modules/@murphai/query/dist/browser-replica-server.d.ts +7 -0
  1854. package/node_modules/@murphai/query/dist/browser-replica-server.d.ts.map +1 -0
  1855. package/node_modules/@murphai/query/dist/browser-replica-server.js +7 -0
  1856. package/node_modules/@murphai/query/dist/browser-replica-server.js.map +1 -0
  1857. package/node_modules/@murphai/query/dist/browser-replica.d.ts +13 -5
  1858. package/node_modules/@murphai/query/dist/browser-replica.d.ts.map +1 -1
  1859. package/node_modules/@murphai/query/dist/browser-replica.js +9 -4
  1860. package/node_modules/@murphai/query/dist/browser-replica.js.map +1 -1
  1861. package/node_modules/@murphai/query/dist/browser.d.ts +2 -2
  1862. package/node_modules/@murphai/query/dist/browser.d.ts.map +1 -1
  1863. package/node_modules/@murphai/query/dist/browser.js +1 -1
  1864. package/node_modules/@murphai/query/dist/browser.js.map +1 -1
  1865. package/node_modules/@murphai/query/dist/canonical-observation-metrics.d.ts +16 -0
  1866. package/node_modules/@murphai/query/dist/canonical-observation-metrics.d.ts.map +1 -0
  1867. package/node_modules/@murphai/query/dist/canonical-observation-metrics.js +70 -0
  1868. package/node_modules/@murphai/query/dist/canonical-observation-metrics.js.map +1 -0
  1869. package/node_modules/@murphai/query/dist/experiment-adherence.d.ts +20 -0
  1870. package/node_modules/@murphai/query/dist/experiment-adherence.d.ts.map +1 -1
  1871. package/node_modules/@murphai/query/dist/experiment-adherence.js +175 -29
  1872. package/node_modules/@murphai/query/dist/experiment-adherence.js.map +1 -1
  1873. package/node_modules/@murphai/query/dist/experiment-progress-card.d.ts +1 -0
  1874. package/node_modules/@murphai/query/dist/experiment-progress-card.d.ts.map +1 -1
  1875. package/node_modules/@murphai/query/dist/experiment-progress-card.js +1 -0
  1876. package/node_modules/@murphai/query/dist/experiment-progress-card.js.map +1 -1
  1877. package/node_modules/@murphai/query/dist/experiments.d.ts.map +1 -1
  1878. package/node_modules/@murphai/query/dist/experiments.js +46 -22
  1879. package/node_modules/@murphai/query/dist/experiments.js.map +1 -1
  1880. package/node_modules/@murphai/query/dist/group-weekly.d.ts.map +1 -1
  1881. package/node_modules/@murphai/query/dist/group-weekly.js +52 -1
  1882. package/node_modules/@murphai/query/dist/group-weekly.js.map +1 -1
  1883. package/node_modules/@murphai/query/dist/health/blood-tests.d.ts.map +1 -1
  1884. package/node_modules/@murphai/query/dist/health/blood-tests.js +3 -2
  1885. package/node_modules/@murphai/query/dist/health/blood-tests.js.map +1 -1
  1886. package/node_modules/@murphai/query/dist/health/canonical-collector.d.ts +11 -1
  1887. package/node_modules/@murphai/query/dist/health/canonical-collector.d.ts.map +1 -1
  1888. package/node_modules/@murphai/query/dist/health/canonical-collector.js +39 -16
  1889. package/node_modules/@murphai/query/dist/health/canonical-collector.js.map +1 -1
  1890. package/node_modules/@murphai/query/dist/health/entity-slices.d.ts +9 -3
  1891. package/node_modules/@murphai/query/dist/health/entity-slices.d.ts.map +1 -1
  1892. package/node_modules/@murphai/query/dist/health/entity-slices.js +6 -6
  1893. package/node_modules/@murphai/query/dist/health/entity-slices.js.map +1 -1
  1894. package/node_modules/@murphai/query/dist/health/immunizations.d.ts.map +1 -1
  1895. package/node_modules/@murphai/query/dist/health/immunizations.js +14 -11
  1896. package/node_modules/@murphai/query/dist/health/immunizations.js.map +1 -1
  1897. package/node_modules/@murphai/query/dist/health/loaders.d.ts +21 -7
  1898. package/node_modules/@murphai/query/dist/health/loaders.d.ts.map +1 -1
  1899. package/node_modules/@murphai/query/dist/health/loaders.js +53 -15
  1900. package/node_modules/@murphai/query/dist/health/loaders.js.map +1 -1
  1901. package/node_modules/@murphai/query/dist/health/registries.d.ts +1 -0
  1902. package/node_modules/@murphai/query/dist/health/registries.d.ts.map +1 -1
  1903. package/node_modules/@murphai/query/dist/health/registries.js.map +1 -1
  1904. package/node_modules/@murphai/query/dist/health/shared.js +1 -1
  1905. package/node_modules/@murphai/query/dist/health/shared.js.map +1 -1
  1906. package/node_modules/@murphai/query/dist/index.d.ts +25 -7
  1907. package/node_modules/@murphai/query/dist/index.d.ts.map +1 -1
  1908. package/node_modules/@murphai/query/dist/index.js +18 -6
  1909. package/node_modules/@murphai/query/dist/index.js.map +1 -1
  1910. package/node_modules/@murphai/query/dist/knowledge-contracts.d.ts +78 -75
  1911. package/node_modules/@murphai/query/dist/knowledge-contracts.d.ts.map +1 -1
  1912. package/node_modules/@murphai/query/dist/knowledge-contracts.js +2 -1
  1913. package/node_modules/@murphai/query/dist/knowledge-contracts.js.map +1 -1
  1914. package/node_modules/@murphai/query/dist/knowledge-graph.d.ts +1 -0
  1915. package/node_modules/@murphai/query/dist/knowledge-graph.d.ts.map +1 -1
  1916. package/node_modules/@murphai/query/dist/knowledge-graph.js +17 -1
  1917. package/node_modules/@murphai/query/dist/knowledge-graph.js.map +1 -1
  1918. package/node_modules/@murphai/query/dist/meal-nutrition.d.ts +27 -1
  1919. package/node_modules/@murphai/query/dist/meal-nutrition.d.ts.map +1 -1
  1920. package/node_modules/@murphai/query/dist/meal-nutrition.js +120 -7
  1921. package/node_modules/@murphai/query/dist/meal-nutrition.js.map +1 -1
  1922. package/node_modules/@murphai/query/dist/metrics/index.d.ts.map +1 -1
  1923. package/node_modules/@murphai/query/dist/metrics/index.js +14 -1
  1924. package/node_modules/@murphai/query/dist/metrics/index.js.map +1 -1
  1925. package/node_modules/@murphai/query/dist/metrics/projection.d.ts.map +1 -1
  1926. package/node_modules/@murphai/query/dist/metrics/projection.js +123 -3
  1927. package/node_modules/@murphai/query/dist/metrics/projection.js.map +1 -1
  1928. package/node_modules/@murphai/query/dist/murph-age.d.ts +5 -1
  1929. package/node_modules/@murphai/query/dist/murph-age.d.ts.map +1 -1
  1930. package/node_modules/@murphai/query/dist/murph-age.js +22 -8
  1931. package/node_modules/@murphai/query/dist/murph-age.js.map +1 -1
  1932. package/node_modules/@murphai/query/dist/personal-patterns.d.ts +55 -0
  1933. package/node_modules/@murphai/query/dist/personal-patterns.d.ts.map +1 -0
  1934. package/node_modules/@murphai/query/dist/personal-patterns.js +401 -0
  1935. package/node_modules/@murphai/query/dist/personal-patterns.js.map +1 -0
  1936. package/node_modules/@murphai/query/dist/projection/entity-store.js +4 -4
  1937. package/node_modules/@murphai/query/dist/projection/entity-store.js.map +1 -1
  1938. package/node_modules/@murphai/query/dist/projection/schema.d.ts +1 -1
  1939. package/node_modules/@murphai/query/dist/projection/schema.d.ts.map +1 -1
  1940. package/node_modules/@murphai/query/dist/projection/schema.js +5 -1
  1941. package/node_modules/@murphai/query/dist/projection/schema.js.map +1 -1
  1942. package/node_modules/@murphai/query/dist/projection/wearable-summary-compose.js +8 -0
  1943. package/node_modules/@murphai/query/dist/projection/wearable-summary-compose.js.map +1 -1
  1944. package/node_modules/@murphai/query/dist/projection/wearable-summary-projector.d.ts.map +1 -1
  1945. package/node_modules/@murphai/query/dist/projection/wearable-summary-projector.js +6 -2
  1946. package/node_modules/@murphai/query/dist/projection/wearable-summary-projector.js.map +1 -1
  1947. package/node_modules/@murphai/query/dist/projection/wearable-summary-stored-codec.js +1 -1
  1948. package/node_modules/@murphai/query/dist/projection/wearable-summary-stored-codec.js.map +1 -1
  1949. package/node_modules/@murphai/query/dist/query-projection.d.ts +14 -0
  1950. package/node_modules/@murphai/query/dist/query-projection.d.ts.map +1 -1
  1951. package/node_modules/@murphai/query/dist/query-projection.js +31 -0
  1952. package/node_modules/@murphai/query/dist/query-projection.js.map +1 -1
  1953. package/node_modules/@murphai/query/dist/query-visibility.d.ts +5 -0
  1954. package/node_modules/@murphai/query/dist/query-visibility.d.ts.map +1 -1
  1955. package/node_modules/@murphai/query/dist/query-visibility.js +11 -5
  1956. package/node_modules/@murphai/query/dist/query-visibility.js.map +1 -1
  1957. package/node_modules/@murphai/query/dist/read-model.d.ts +8 -0
  1958. package/node_modules/@murphai/query/dist/read-model.d.ts.map +1 -1
  1959. package/node_modules/@murphai/query/dist/read-model.js +11 -1
  1960. package/node_modules/@murphai/query/dist/read-model.js.map +1 -1
  1961. package/node_modules/@murphai/query/dist/scheduled-logs.d.ts.map +1 -1
  1962. package/node_modules/@murphai/query/dist/scheduled-logs.js +55 -79
  1963. package/node_modules/@murphai/query/dist/scheduled-logs.js.map +1 -1
  1964. package/node_modules/@murphai/query/dist/vault-source.d.ts +22 -4
  1965. package/node_modules/@murphai/query/dist/vault-source.d.ts.map +1 -1
  1966. package/node_modules/@murphai/query/dist/vault-source.js +188 -59
  1967. package/node_modules/@murphai/query/dist/vault-source.js.map +1 -1
  1968. package/node_modules/@murphai/query/dist/wearables/candidates.d.ts.map +1 -1
  1969. package/node_modules/@murphai/query/dist/wearables/candidates.js +32 -15
  1970. package/node_modules/@murphai/query/dist/wearables/candidates.js.map +1 -1
  1971. package/node_modules/@murphai/query/dist/wearables/public-output.d.ts.map +1 -1
  1972. package/node_modules/@murphai/query/dist/wearables/public-output.js +43 -2
  1973. package/node_modules/@murphai/query/dist/wearables/public-output.js.map +1 -1
  1974. package/node_modules/@murphai/query/dist/wearables/sleep-pattern.d.ts +5 -1
  1975. package/node_modules/@murphai/query/dist/wearables/sleep-pattern.d.ts.map +1 -1
  1976. package/node_modules/@murphai/query/dist/wearables/sleep-pattern.js +16 -3
  1977. package/node_modules/@murphai/query/dist/wearables/sleep-pattern.js.map +1 -1
  1978. package/node_modules/@murphai/query/dist/wearables/source-health.d.ts.map +1 -1
  1979. package/node_modules/@murphai/query/dist/wearables/source-health.js +31 -4
  1980. package/node_modules/@murphai/query/dist/wearables/source-health.js.map +1 -1
  1981. package/node_modules/@murphai/query/dist/wearables/types.d.ts +54 -4
  1982. package/node_modules/@murphai/query/dist/wearables/types.d.ts.map +1 -1
  1983. package/node_modules/@murphai/query/dist/wearables/types.js +36 -0
  1984. package/node_modules/@murphai/query/dist/wearables/types.js.map +1 -1
  1985. package/node_modules/@murphai/query/dist/wearables/workout-features.d.ts +5 -0
  1986. package/node_modules/@murphai/query/dist/wearables/workout-features.d.ts.map +1 -0
  1987. package/node_modules/@murphai/query/dist/wearables/workout-features.js +179 -0
  1988. package/node_modules/@murphai/query/dist/wearables/workout-features.js.map +1 -0
  1989. package/node_modules/@murphai/query/dist/wearables.d.ts.map +1 -1
  1990. package/node_modules/@murphai/query/dist/wearables.js +74 -6
  1991. package/node_modules/@murphai/query/dist/wearables.js.map +1 -1
  1992. package/node_modules/@murphai/query/package.json +15 -0
  1993. package/node_modules/@murphai/runtime-state/README.md +3 -3
  1994. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.d.ts.map +1 -1
  1995. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js +15 -2
  1996. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js.map +1 -1
  1997. package/node_modules/@murphai/runtime-state/dist/assistant-runtime-issues.d.ts +4 -0
  1998. package/node_modules/@murphai/runtime-state/dist/assistant-runtime-issues.d.ts.map +1 -1
  1999. package/node_modules/@murphai/runtime-state/dist/assistant-runtime-issues.js +16 -3
  2000. package/node_modules/@murphai/runtime-state/dist/assistant-runtime-issues.js.map +1 -1
  2001. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts +2 -0
  2002. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts.map +1 -1
  2003. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js +76 -20
  2004. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js.map +1 -1
  2005. package/node_modules/@murphai/runtime-state/dist/hosted-crypto-keyrings.d.ts +32 -1
  2006. package/node_modules/@murphai/runtime-state/dist/hosted-crypto-keyrings.d.ts.map +1 -1
  2007. package/node_modules/@murphai/runtime-state/dist/hosted-crypto-keyrings.js +327 -0
  2008. package/node_modules/@murphai/runtime-state/dist/hosted-crypto-keyrings.js.map +1 -1
  2009. package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.d.ts +3 -1
  2010. package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.d.ts.map +1 -1
  2011. package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.js +23 -3
  2012. package/node_modules/@murphai/runtime-state/dist/hosted-domain-crypto.js.map +1 -1
  2013. package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts +5 -0
  2014. package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts.map +1 -1
  2015. package/node_modules/@murphai/runtime-state/dist/hosted-email.js +10 -0
  2016. package/node_modules/@murphai/runtime-state/dist/hosted-email.js.map +1 -1
  2017. package/node_modules/@murphai/runtime-state/dist/hosted-storage.d.ts +1 -1
  2018. package/node_modules/@murphai/runtime-state/dist/hosted-storage.d.ts.map +1 -1
  2019. package/node_modules/@murphai/runtime-state/dist/hosted-storage.js +1 -0
  2020. package/node_modules/@murphai/runtime-state/dist/hosted-storage.js.map +1 -1
  2021. package/node_modules/@murphai/runtime-state/dist/sqlite.d.ts.map +1 -1
  2022. package/node_modules/@murphai/runtime-state/dist/sqlite.js +22 -6
  2023. package/node_modules/@murphai/runtime-state/dist/sqlite.js.map +1 -1
  2024. package/node_modules/@murphai/setup-cli/README.md +1 -1
  2025. package/node_modules/@murphai/setup-cli/dist/incur-error-bridge.d.ts.map +1 -1
  2026. package/node_modules/@murphai/setup-cli/dist/incur-error-bridge.js +6 -15
  2027. package/node_modules/@murphai/setup-cli/dist/incur-error-bridge.js.map +1 -1
  2028. package/node_modules/@murphai/setup-cli/dist/index.d.ts +0 -1
  2029. package/node_modules/@murphai/setup-cli/dist/index.d.ts.map +1 -1
  2030. package/node_modules/@murphai/setup-cli/dist/index.js +0 -1
  2031. package/node_modules/@murphai/setup-cli/dist/index.js.map +1 -1
  2032. package/node_modules/@murphai/setup-cli/dist/setup-assistant-account.js +1 -1
  2033. package/node_modules/@murphai/setup-cli/dist/setup-assistant-account.js.map +1 -1
  2034. package/node_modules/@murphai/setup-cli/dist/setup-assistant-defaults.d.ts.map +1 -1
  2035. package/node_modules/@murphai/setup-cli/dist/setup-assistant-defaults.js +14 -24
  2036. package/node_modules/@murphai/setup-cli/dist/setup-assistant-defaults.js.map +1 -1
  2037. package/node_modules/@murphai/setup-cli/dist/setup-assistant.js +1 -1
  2038. package/node_modules/@murphai/setup-cli/dist/setup-assistant.js.map +1 -1
  2039. package/node_modules/@murphai/setup-cli/dist/setup-cli.d.ts +1 -2
  2040. package/node_modules/@murphai/setup-cli/dist/setup-cli.d.ts.map +1 -1
  2041. package/node_modules/@murphai/setup-cli/dist/setup-cli.js +2 -4
  2042. package/node_modules/@murphai/setup-cli/dist/setup-cli.js.map +1 -1
  2043. package/node_modules/@murphai/setup-cli/dist/setup-services/channels.d.ts +0 -4
  2044. package/node_modules/@murphai/setup-cli/dist/setup-services/channels.d.ts.map +1 -1
  2045. package/node_modules/@murphai/setup-cli/dist/setup-services/channels.js +126 -420
  2046. package/node_modules/@murphai/setup-cli/dist/setup-services/channels.js.map +1 -1
  2047. package/node_modules/@murphai/setup-cli/dist/setup-services.d.ts +0 -3
  2048. package/node_modules/@murphai/setup-cli/dist/setup-services.d.ts.map +1 -1
  2049. package/node_modules/@murphai/setup-cli/dist/setup-services.js +0 -7
  2050. package/node_modules/@murphai/setup-cli/dist/setup-services.js.map +1 -1
  2051. package/node_modules/@murphai/setup-cli/dist/setup-wizard-options.d.ts.map +1 -1
  2052. package/node_modules/@murphai/setup-cli/dist/setup-wizard-options.js +0 -7
  2053. package/node_modules/@murphai/setup-cli/dist/setup-wizard-options.js.map +1 -1
  2054. package/node_modules/@murphai/vault-usecases/README.md +9 -0
  2055. package/node_modules/@murphai/vault-usecases/dist/clinical-records.js +1 -1
  2056. package/node_modules/@murphai/vault-usecases/dist/clinical-records.js.map +1 -1
  2057. package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.d.ts +6 -0
  2058. package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.d.ts.map +1 -1
  2059. package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.js +49 -1
  2060. package/node_modules/@murphai/vault-usecases/dist/commands/query-record-command-helpers.js.map +1 -1
  2061. package/node_modules/@murphai/vault-usecases/dist/experiment-onboarding-options.d.ts +3 -3
  2062. package/node_modules/@murphai/vault-usecases/dist/experiment-onboarding-options.d.ts.map +1 -1
  2063. package/node_modules/@murphai/vault-usecases/dist/experiment-onboarding-options.js +1 -1
  2064. package/node_modules/@murphai/vault-usecases/dist/experiment-onboarding-options.js.map +1 -1
  2065. package/node_modules/@murphai/vault-usecases/dist/export-packs.d.ts +7 -0
  2066. package/node_modules/@murphai/vault-usecases/dist/export-packs.d.ts.map +1 -0
  2067. package/node_modules/@murphai/vault-usecases/dist/export-packs.js +45 -0
  2068. package/node_modules/@murphai/vault-usecases/dist/export-packs.js.map +1 -0
  2069. package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.d.ts +28 -28
  2070. package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.d.ts.map +1 -1
  2071. package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.js +1 -1
  2072. package/node_modules/@murphai/vault-usecases/dist/health-cli-descriptors.js.map +1 -1
  2073. package/node_modules/@murphai/vault-usecases/dist/json-input.d.ts +1 -1
  2074. package/node_modules/@murphai/vault-usecases/dist/json-input.d.ts.map +1 -1
  2075. package/node_modules/@murphai/vault-usecases/dist/json-input.js +1 -1
  2076. package/node_modules/@murphai/vault-usecases/dist/json-input.js.map +1 -1
  2077. package/node_modules/@murphai/vault-usecases/dist/query-runtime.d.ts +5 -1
  2078. package/node_modules/@murphai/vault-usecases/dist/query-runtime.d.ts.map +1 -1
  2079. package/node_modules/@murphai/vault-usecases/dist/query-runtime.js.map +1 -1
  2080. package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.d.ts +1 -1
  2081. package/node_modules/@murphai/vault-usecases/dist/testing/junction-wearable-fixture.d.ts.map +1 -1
  2082. package/node_modules/@murphai/vault-usecases/dist/usecases/capture.d.ts +21 -21
  2083. package/node_modules/@murphai/vault-usecases/dist/usecases/capture.d.ts.map +1 -1
  2084. package/node_modules/@murphai/vault-usecases/dist/usecases/capture.js +23 -13
  2085. package/node_modules/@murphai/vault-usecases/dist/usecases/capture.js.map +1 -1
  2086. package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.d.ts +193 -193
  2087. package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.d.ts.map +1 -1
  2088. package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.js +2 -4
  2089. package/node_modules/@murphai/vault-usecases/dist/usecases/clinical-imports.js.map +1 -1
  2090. package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.d.ts +12 -12
  2091. package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.d.ts.map +1 -1
  2092. package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.js +25 -19
  2093. package/node_modules/@murphai/vault-usecases/dist/usecases/document-meal-read.js.map +1 -1
  2094. package/node_modules/@murphai/vault-usecases/dist/usecases/encounter.d.ts +130 -130
  2095. package/node_modules/@murphai/vault-usecases/dist/usecases/encounter.d.ts.map +1 -1
  2096. package/node_modules/@murphai/vault-usecases/dist/usecases/encounter.js +2 -4
  2097. package/node_modules/@murphai/vault-usecases/dist/usecases/encounter.js.map +1 -1
  2098. package/node_modules/@murphai/vault-usecases/dist/usecases/event-record-mutations.d.ts +9 -0
  2099. package/node_modules/@murphai/vault-usecases/dist/usecases/event-record-mutations.d.ts.map +1 -1
  2100. package/node_modules/@murphai/vault-usecases/dist/usecases/event-record-mutations.js +78 -5
  2101. package/node_modules/@murphai/vault-usecases/dist/usecases/event-record-mutations.js.map +1 -1
  2102. package/node_modules/@murphai/vault-usecases/dist/usecases/exact-event-record.d.ts +20 -0
  2103. package/node_modules/@murphai/vault-usecases/dist/usecases/exact-event-record.d.ts.map +1 -0
  2104. package/node_modules/@murphai/vault-usecases/dist/usecases/exact-event-record.js +72 -0
  2105. package/node_modules/@murphai/vault-usecases/dist/usecases/exact-event-record.js.map +1 -0
  2106. package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.d.ts +29 -6
  2107. package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.d.ts.map +1 -1
  2108. package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.js +267 -46
  2109. package/node_modules/@murphai/vault-usecases/dist/usecases/experiment-journal-vault.js.map +1 -1
  2110. package/node_modules/@murphai/vault-usecases/dist/usecases/explicit-health-family-services.d.ts.map +1 -1
  2111. package/node_modules/@murphai/vault-usecases/dist/usecases/explicit-health-family-services.js +158 -24
  2112. package/node_modules/@murphai/vault-usecases/dist/usecases/explicit-health-family-services.js.map +1 -1
  2113. package/node_modules/@murphai/vault-usecases/dist/usecases/food-autolog.d.ts +1 -1
  2114. package/node_modules/@murphai/vault-usecases/dist/usecases/food-autolog.d.ts.map +1 -1
  2115. package/node_modules/@murphai/vault-usecases/dist/usecases/food-autolog.js +1 -1
  2116. package/node_modules/@murphai/vault-usecases/dist/usecases/food-autolog.js.map +1 -1
  2117. package/node_modules/@murphai/vault-usecases/dist/usecases/food.d.ts.map +1 -1
  2118. package/node_modules/@murphai/vault-usecases/dist/usecases/food.js +98 -6
  2119. package/node_modules/@murphai/vault-usecases/dist/usecases/food.js.map +1 -1
  2120. package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.d.ts.map +1 -1
  2121. package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.js +97 -13
  2122. package/node_modules/@murphai/vault-usecases/dist/usecases/integrated-services.js.map +1 -1
  2123. package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.d.ts.map +1 -1
  2124. package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.js +49 -24
  2125. package/node_modules/@murphai/vault-usecases/dist/usecases/intervention-experiment-link.js.map +1 -1
  2126. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.d.ts +95 -13
  2127. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.d.ts.map +1 -1
  2128. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.js +149 -14
  2129. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement-read.js.map +1 -1
  2130. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement.d.ts.map +1 -1
  2131. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement.js +3 -1
  2132. package/node_modules/@murphai/vault-usecases/dist/usecases/measurement.js.map +1 -1
  2133. package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.d.ts +4 -4
  2134. package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.d.ts.map +1 -1
  2135. package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.js +19 -12
  2136. package/node_modules/@murphai/vault-usecases/dist/usecases/provider-event.js.map +1 -1
  2137. package/node_modules/@murphai/vault-usecases/dist/usecases/recipe.d.ts +3 -3
  2138. package/node_modules/@murphai/vault-usecases/dist/usecases/recipe.d.ts.map +1 -1
  2139. package/node_modules/@murphai/vault-usecases/dist/usecases/recipe.js +44 -2
  2140. package/node_modules/@murphai/vault-usecases/dist/usecases/recipe.js.map +1 -1
  2141. package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.d.ts.map +1 -1
  2142. package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.js +2 -0
  2143. package/node_modules/@murphai/vault-usecases/dist/usecases/runtime.js.map +1 -1
  2144. package/node_modules/@murphai/vault-usecases/dist/usecases/shared.d.ts.map +1 -1
  2145. package/node_modules/@murphai/vault-usecases/dist/usecases/shared.js +1 -3
  2146. package/node_modules/@murphai/vault-usecases/dist/usecases/shared.js.map +1 -1
  2147. package/node_modules/@murphai/vault-usecases/dist/usecases/types.d.ts +44 -1
  2148. package/node_modules/@murphai/vault-usecases/dist/usecases/types.d.ts.map +1 -1
  2149. package/node_modules/@murphai/vault-usecases/dist/usecases/vault-usecase-helpers.d.ts +2 -0
  2150. package/node_modules/@murphai/vault-usecases/dist/usecases/vault-usecase-helpers.d.ts.map +1 -1
  2151. package/node_modules/@murphai/vault-usecases/dist/usecases/vault-usecase-helpers.js +24 -1
  2152. package/node_modules/@murphai/vault-usecases/dist/usecases/vault-usecase-helpers.js.map +1 -1
  2153. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-core.d.ts +7 -1
  2154. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-core.d.ts.map +1 -1
  2155. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-core.js.map +1 -1
  2156. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-format.d.ts +4 -0
  2157. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-format.d.ts.map +1 -1
  2158. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-import.d.ts +60 -7
  2159. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-import.d.ts.map +1 -1
  2160. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-import.js +1282 -494
  2161. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-import.js.map +1 -1
  2162. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-model.d.ts +116 -0
  2163. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-model.d.ts.map +1 -0
  2164. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-model.js +231 -0
  2165. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-model.js.map +1 -0
  2166. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-state.d.ts +36 -0
  2167. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-state.d.ts.map +1 -0
  2168. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-state.js +287 -0
  2169. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live-state.js.map +1 -0
  2170. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live.d.ts +134 -0
  2171. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live.d.ts.map +1 -0
  2172. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live.js +744 -0
  2173. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-live.js.map +1 -0
  2174. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-model.d.ts +1 -1
  2175. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-model.d.ts.map +1 -1
  2176. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-model.js +2 -0
  2177. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-model.js.map +1 -1
  2178. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.d.ts +13 -13
  2179. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.d.ts.map +1 -1
  2180. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.js +22 -19
  2181. package/node_modules/@murphai/vault-usecases/dist/usecases/workout-read.js.map +1 -1
  2182. package/node_modules/@murphai/vault-usecases/dist/usecases/workout.d.ts +39 -2
  2183. package/node_modules/@murphai/vault-usecases/dist/usecases/workout.d.ts.map +1 -1
  2184. package/node_modules/@murphai/vault-usecases/dist/usecases/workout.js +144 -4
  2185. package/node_modules/@murphai/vault-usecases/dist/usecases/workout.js.map +1 -1
  2186. package/node_modules/@murphai/vault-usecases/dist/vault-services.d.ts.map +1 -1
  2187. package/node_modules/@murphai/vault-usecases/dist/vault-services.js +3 -0
  2188. package/node_modules/@murphai/vault-usecases/dist/vault-services.js.map +1 -1
  2189. package/node_modules/@murphai/vault-usecases/dist/workouts.d.ts +1 -0
  2190. package/node_modules/@murphai/vault-usecases/dist/workouts.d.ts.map +1 -1
  2191. package/node_modules/@murphai/vault-usecases/dist/workouts.js +1 -0
  2192. package/node_modules/@murphai/vault-usecases/dist/workouts.js.map +1 -1
  2193. package/node_modules/@murphai/vault-usecases/package.json +4 -0
  2194. package/node_modules/incur/dist/Cli.js +7 -32
  2195. package/node_modules/incur/dist/Errors.d.ts +17 -0
  2196. package/node_modules/incur/dist/Errors.js +23 -0
  2197. package/node_modules/incur/dist/internal/command.d.ts +2 -0
  2198. package/node_modules/incur/dist/internal/command.js +2 -6
  2199. package/node_modules/incur/src/Cli.ts +11 -32
  2200. package/node_modules/incur/src/Errors.ts +36 -0
  2201. package/node_modules/incur/src/internal/command.ts +4 -6
  2202. package/node_modules/ink/build/ansi-tokenizer.d.ts +38 -0
  2203. package/node_modules/ink/build/ansi-tokenizer.js +316 -0
  2204. package/node_modules/ink/build/ansi-tokenizer.js.map +1 -0
  2205. package/node_modules/ink/build/apply-styles.js +175 -0
  2206. package/node_modules/ink/build/build-layout.js +77 -0
  2207. package/node_modules/ink/build/calculate-wrapped-text.js +53 -0
  2208. package/node_modules/ink/build/colorize.d.ts +3 -0
  2209. package/node_modules/ink/build/colorize.js +48 -0
  2210. package/node_modules/ink/build/colorize.js.map +1 -0
  2211. package/node_modules/ink/build/components/AccessibilityContext.d.ts +3 -0
  2212. package/node_modules/ink/build/components/AccessibilityContext.js +5 -0
  2213. package/node_modules/ink/build/components/AccessibilityContext.js.map +1 -0
  2214. package/node_modules/ink/build/components/App.d.ts +18 -0
  2215. package/node_modules/ink/build/components/App.js +351 -0
  2216. package/node_modules/ink/build/components/App.js.map +1 -0
  2217. package/node_modules/ink/build/components/AppContext.d.ts +15 -0
  2218. package/node_modules/ink/build/components/AppContext.js +11 -0
  2219. package/node_modules/ink/build/components/AppContext.js.map +1 -0
  2220. package/node_modules/ink/build/components/BackgroundContext.d.ts +4 -0
  2221. package/node_modules/ink/build/components/BackgroundContext.js +3 -0
  2222. package/node_modules/ink/build/components/BackgroundContext.js.map +1 -0
  2223. package/node_modules/ink/build/components/Box.d.ts +117 -0
  2224. package/node_modules/ink/build/components/Box.js +34 -0
  2225. package/node_modules/ink/build/components/Box.js.map +1 -0
  2226. package/node_modules/ink/build/components/Color.js +62 -0
  2227. package/node_modules/ink/build/components/Cursor.d.ts +83 -0
  2228. package/node_modules/ink/build/components/Cursor.js +53 -0
  2229. package/node_modules/ink/build/components/Cursor.js.map +1 -0
  2230. package/node_modules/ink/build/components/CursorContext.d.ts +11 -0
  2231. package/node_modules/ink/build/components/CursorContext.js +8 -0
  2232. package/node_modules/ink/build/components/CursorContext.js.map +1 -0
  2233. package/node_modules/ink/build/components/ErrorBoundary.d.ts +18 -0
  2234. package/node_modules/ink/build/components/ErrorBoundary.js +23 -0
  2235. package/node_modules/ink/build/components/ErrorBoundary.js.map +1 -0
  2236. package/node_modules/ink/build/components/ErrorOverview.d.ts +6 -0
  2237. package/node_modules/ink/build/components/ErrorOverview.js +84 -0
  2238. package/node_modules/ink/build/components/ErrorOverview.js.map +1 -0
  2239. package/node_modules/ink/build/components/FocusContext.d.ts +16 -0
  2240. package/node_modules/ink/build/components/FocusContext.js +17 -0
  2241. package/node_modules/ink/build/components/FocusContext.js.map +1 -0
  2242. package/node_modules/ink/build/components/Newline.d.ts +13 -0
  2243. package/node_modules/ink/build/components/Newline.js +8 -0
  2244. package/node_modules/ink/build/components/Newline.js.map +1 -0
  2245. package/node_modules/ink/build/components/Spacer.d.ts +7 -0
  2246. package/node_modules/ink/build/components/Spacer.js +11 -0
  2247. package/node_modules/ink/build/components/Spacer.js.map +1 -0
  2248. package/node_modules/ink/build/components/Static.d.ts +24 -0
  2249. package/node_modules/ink/build/components/Static.js +28 -0
  2250. package/node_modules/ink/build/components/Static.js.map +1 -0
  2251. package/node_modules/ink/build/components/StderrContext.d.ts +15 -0
  2252. package/node_modules/ink/build/components/StderrContext.js +13 -0
  2253. package/node_modules/ink/build/components/StderrContext.js.map +1 -0
  2254. package/node_modules/ink/build/components/StdinContext.d.ts +22 -0
  2255. package/node_modules/ink/build/components/StdinContext.js +19 -0
  2256. package/node_modules/ink/build/components/StdinContext.js.map +1 -0
  2257. package/node_modules/ink/build/components/StdoutContext.d.ts +15 -0
  2258. package/node_modules/ink/build/components/StdoutContext.js +13 -0
  2259. package/node_modules/ink/build/components/StdoutContext.js.map +1 -0
  2260. package/node_modules/ink/build/components/Text.d.ts +55 -0
  2261. package/node_modules/ink/build/components/Text.js +50 -0
  2262. package/node_modules/ink/build/components/Text.js.map +1 -0
  2263. package/node_modules/ink/build/components/Transform.d.ts +16 -0
  2264. package/node_modules/ink/build/components/Transform.js +15 -0
  2265. package/node_modules/ink/build/components/Transform.js.map +1 -0
  2266. package/node_modules/ink/build/cursor-helpers.d.ts +38 -0
  2267. package/node_modules/ink/build/cursor-helpers.js +56 -0
  2268. package/node_modules/ink/build/cursor-helpers.js.map +1 -0
  2269. package/node_modules/ink/build/devtools-window-polyfill.d.ts +1 -0
  2270. package/node_modules/ink/build/devtools-window-polyfill.js +65 -0
  2271. package/node_modules/ink/build/devtools-window-polyfill.js.map +1 -0
  2272. package/node_modules/ink/build/devtools.d.ts +1 -0
  2273. package/node_modules/ink/build/devtools.js +11 -0
  2274. package/node_modules/ink/build/devtools.js.map +1 -0
  2275. package/node_modules/ink/build/dom.d.ts +56 -0
  2276. package/node_modules/ink/build/dom.js +124 -0
  2277. package/node_modules/ink/build/dom.js.map +1 -0
  2278. package/node_modules/ink/build/experimental/apply-style.js +140 -0
  2279. package/node_modules/ink/build/experimental/dom.js +123 -0
  2280. package/node_modules/ink/build/experimental/output.js +91 -0
  2281. package/node_modules/ink/build/experimental/reconciler.js +141 -0
  2282. package/node_modules/ink/build/experimental/renderer.js +81 -0
  2283. package/node_modules/ink/build/get-max-width.d.ts +3 -0
  2284. package/node_modules/ink/build/get-max-width.js +10 -0
  2285. package/node_modules/ink/build/get-max-width.js.map +1 -0
  2286. package/node_modules/ink/build/hooks/use-app.d.ts +5 -0
  2287. package/node_modules/ink/build/hooks/use-app.js +8 -0
  2288. package/node_modules/ink/build/hooks/use-app.js.map +1 -0
  2289. package/node_modules/ink/build/hooks/use-cursor.d.ts +12 -0
  2290. package/node_modules/ink/build/hooks/use-cursor.js +29 -0
  2291. package/node_modules/ink/build/hooks/use-cursor.js.map +1 -0
  2292. package/node_modules/ink/build/hooks/use-focus-manager.d.ts +28 -0
  2293. package/node_modules/ink/build/hooks/use-focus-manager.js +17 -0
  2294. package/node_modules/ink/build/hooks/use-focus-manager.js.map +1 -0
  2295. package/node_modules/ink/build/hooks/use-focus.d.ts +29 -0
  2296. package/node_modules/ink/build/hooks/use-focus.js +42 -0
  2297. package/node_modules/ink/build/hooks/use-focus.js.map +1 -0
  2298. package/node_modules/ink/build/hooks/use-input.d.ts +131 -0
  2299. package/node_modules/ink/build/hooks/use-input.js +124 -0
  2300. package/node_modules/ink/build/hooks/use-input.js.map +1 -0
  2301. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.d.ts +5 -0
  2302. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js +11 -0
  2303. package/node_modules/ink/build/hooks/use-is-screen-reader-enabled.js.map +1 -0
  2304. package/node_modules/ink/build/hooks/use-stderr.d.ts +5 -0
  2305. package/node_modules/ink/build/hooks/use-stderr.js +8 -0
  2306. package/node_modules/ink/build/hooks/use-stderr.js.map +1 -0
  2307. package/node_modules/ink/build/hooks/use-stdin.d.ts +5 -0
  2308. package/node_modules/ink/build/hooks/use-stdin.js +8 -0
  2309. package/node_modules/ink/build/hooks/use-stdin.js.map +1 -0
  2310. package/node_modules/ink/build/hooks/use-stdout.d.ts +5 -0
  2311. package/node_modules/ink/build/hooks/use-stdout.js +8 -0
  2312. package/node_modules/ink/build/hooks/use-stdout.js.map +1 -0
  2313. package/node_modules/ink/build/hooks/useInput.js +38 -0
  2314. package/node_modules/ink/build/index.d.ts +34 -0
  2315. package/node_modules/ink/build/index.js +20 -0
  2316. package/node_modules/ink/build/index.js.map +1 -0
  2317. package/node_modules/ink/build/ink.d.ts +90 -0
  2318. package/node_modules/ink/build/ink.js +637 -0
  2319. package/node_modules/ink/build/ink.js.map +1 -0
  2320. package/node_modules/ink/build/input-parser.d.ts +7 -0
  2321. package/node_modules/ink/build/input-parser.js +154 -0
  2322. package/node_modules/ink/build/input-parser.js.map +1 -0
  2323. package/node_modules/ink/build/instance.js +205 -0
  2324. package/node_modules/ink/build/instances.d.ts +3 -0
  2325. package/node_modules/ink/build/instances.js +8 -0
  2326. package/node_modules/ink/build/instances.js.map +1 -0
  2327. package/node_modules/ink/build/kitty-keyboard.d.ts +23 -0
  2328. package/node_modules/ink/build/kitty-keyboard.js +32 -0
  2329. package/node_modules/ink/build/kitty-keyboard.js.map +1 -0
  2330. package/node_modules/ink/build/layout.d.ts +7 -0
  2331. package/node_modules/ink/build/layout.js +33 -0
  2332. package/node_modules/ink/build/layout.js.map +1 -0
  2333. package/node_modules/ink/build/log-update.d.ts +19 -0
  2334. package/node_modules/ink/build/log-update.js +242 -0
  2335. package/node_modules/ink/build/log-update.js.map +1 -0
  2336. package/node_modules/ink/build/measure-element.d.ts +16 -0
  2337. package/node_modules/ink/build/measure-element.js +9 -0
  2338. package/node_modules/ink/build/measure-element.js.map +1 -0
  2339. package/node_modules/ink/build/measure-text.d.ts +6 -0
  2340. package/node_modules/ink/build/measure-text.js +21 -0
  2341. package/node_modules/ink/build/measure-text.js.map +1 -0
  2342. package/node_modules/ink/build/options.d.ts +52 -0
  2343. package/node_modules/ink/build/options.js +2 -0
  2344. package/node_modules/ink/build/options.js.map +1 -0
  2345. package/node_modules/ink/build/output.d.ts +35 -0
  2346. package/node_modules/ink/build/output.js +183 -0
  2347. package/node_modules/ink/build/output.js.map +1 -0
  2348. package/node_modules/ink/build/parse-keypress.d.ts +22 -0
  2349. package/node_modules/ink/build/parse-keypress.js +493 -0
  2350. package/node_modules/ink/build/parse-keypress.js.map +1 -0
  2351. package/node_modules/ink/build/reconciler.d.ts +4 -0
  2352. package/node_modules/ink/build/reconciler.js +274 -0
  2353. package/node_modules/ink/build/reconciler.js.map +1 -0
  2354. package/node_modules/ink/build/render-background.d.ts +4 -0
  2355. package/node_modules/ink/build/render-background.js +25 -0
  2356. package/node_modules/ink/build/render-background.js.map +1 -0
  2357. package/node_modules/ink/build/render-border.d.ts +4 -0
  2358. package/node_modules/ink/build/render-border.js +73 -0
  2359. package/node_modules/ink/build/render-border.js.map +1 -0
  2360. package/node_modules/ink/build/render-node-to-output.d.ts +14 -0
  2361. package/node_modules/ink/build/render-node-to-output.js +147 -0
  2362. package/node_modules/ink/build/render-node-to-output.js.map +1 -0
  2363. package/node_modules/ink/build/render-to-string.d.ts +38 -0
  2364. package/node_modules/ink/build/render-to-string.js +115 -0
  2365. package/node_modules/ink/build/render-to-string.js.map +1 -0
  2366. package/node_modules/ink/build/render.d.ts +121 -0
  2367. package/node_modules/ink/build/render.js +55 -0
  2368. package/node_modules/ink/build/render.js.map +1 -0
  2369. package/node_modules/ink/build/renderer.d.ts +8 -0
  2370. package/node_modules/ink/build/renderer.js +55 -0
  2371. package/node_modules/ink/build/renderer.js.map +1 -0
  2372. package/node_modules/ink/build/sanitize-ansi.d.ts +2 -0
  2373. package/node_modules/ink/build/sanitize-ansi.js +27 -0
  2374. package/node_modules/ink/build/sanitize-ansi.js.map +1 -0
  2375. package/node_modules/ink/build/screen-reader-update.d.ts +13 -0
  2376. package/node_modules/ink/build/screen-reader-update.js +38 -0
  2377. package/node_modules/ink/build/screen-reader-update.js.map +1 -0
  2378. package/node_modules/ink/build/squash-text-nodes.d.ts +3 -0
  2379. package/node_modules/ink/build/squash-text-nodes.js +36 -0
  2380. package/node_modules/ink/build/squash-text-nodes.js.map +1 -0
  2381. package/node_modules/ink/build/styles.d.ts +240 -0
  2382. package/node_modules/ink/build/styles.js +232 -0
  2383. package/node_modules/ink/build/styles.js.map +1 -0
  2384. package/node_modules/ink/build/utils.d.ts +2 -0
  2385. package/node_modules/ink/build/utils.js +4 -0
  2386. package/node_modules/ink/build/utils.js.map +1 -0
  2387. package/node_modules/ink/build/wrap-text.d.ts +3 -0
  2388. package/node_modules/ink/build/wrap-text.js +31 -0
  2389. package/node_modules/ink/build/wrap-text.js.map +1 -0
  2390. package/node_modules/ink/build/write-synchronized.d.ts +4 -0
  2391. package/node_modules/ink/build/write-synchronized.js +7 -0
  2392. package/node_modules/ink/build/write-synchronized.js.map +1 -0
  2393. package/node_modules/ink/package.json +126 -0
  2394. package/package.json +35 -5
  2395. package/node_modules/@murphai/assistant-engine/dist/assistant/group-phone-call-preview-authority.d.ts +0 -24
  2396. package/node_modules/@murphai/assistant-engine/dist/assistant/group-phone-call-preview-authority.d.ts.map +0 -1
  2397. package/node_modules/@murphai/assistant-engine/dist/assistant/group-phone-call-preview-authority.js +0 -125
  2398. package/node_modules/@murphai/assistant-engine/dist/assistant/group-phone-call-preview-authority.js.map +0 -1
  2399. package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.d.ts +0 -19
  2400. package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.d.ts.map +0 -1
  2401. package/node_modules/@murphai/assistant-engine/dist/assistant/newsletter-outbox.js.map +0 -1
  2402. package/node_modules/@murphai/assistant-engine/skills/general-eye-health/SKILL.md +0 -77
  2403. package/node_modules/@murphai/assistant-engine/skills/general-eye-health/references/evidence-register.md +0 -34
  2404. package/node_modules/@murphai/assistant-engine/skills/general-eye-health/references/triage-and-contact-lenses.md +0 -103
  2405. package/node_modules/@murphai/assistant-engine/skills/recovery-modalities/SKILL.md +0 -57
  2406. package/node_modules/@murphai/assistant-engine/skills/red-light-therapy/SKILL.md +0 -145
  2407. package/node_modules/@murphai/assistant-engine/skills/red-light-therapy/device-seeds.json +0 -259
  2408. package/node_modules/@murphai/inboxd/dist/connectors/email/connector.d.ts +0 -57
  2409. package/node_modules/@murphai/inboxd/dist/connectors/email/connector.d.ts.map +0 -1
  2410. package/node_modules/@murphai/inboxd/dist/connectors/email/connector.js +0 -259
  2411. package/node_modules/@murphai/inboxd/dist/connectors/email/connector.js.map +0 -1
  2412. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.d.ts +0 -44
  2413. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.d.ts.map +0 -1
  2414. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.js +0 -212
  2415. package/node_modules/@murphai/inboxd/dist/connectors/email/normalize.js.map +0 -1
  2416. package/node_modules/@murphai/inboxd/dist/connectors/email/types.d.ts +0 -69
  2417. package/node_modules/@murphai/inboxd/dist/connectors/email/types.d.ts.map +0 -1
  2418. package/node_modules/@murphai/inboxd/dist/connectors/email/types.js +0 -2
  2419. package/node_modules/@murphai/inboxd/dist/connectors/email/types.js.map +0 -1
  2420. package/node_modules/@murphai/operator-config/dist/agentmail-runtime.d.ts +0 -194
  2421. package/node_modules/@murphai/operator-config/dist/agentmail-runtime.d.ts.map +0 -1
  2422. package/node_modules/@murphai/operator-config/dist/agentmail-runtime.js +0 -385
  2423. package/node_modules/@murphai/operator-config/dist/agentmail-runtime.js.map +0 -1
  2424. package/node_modules/@murphai/setup-cli/dist/setup-agentmail.d.ts +0 -30
  2425. package/node_modules/@murphai/setup-cli/dist/setup-agentmail.d.ts.map +0 -1
  2426. package/node_modules/@murphai/setup-cli/dist/setup-agentmail.js +0 -135
  2427. package/node_modules/@murphai/setup-cli/dist/setup-agentmail.js.map +0 -1
  2428. package/node_modules/incur/src/Cli.test.ts +0 -4808
  2429. package/node_modules/incur/src/Completions.test.ts +0 -543
  2430. package/node_modules/incur/src/Errors.test.ts +0 -100
  2431. package/node_modules/incur/src/Fetch.test.ts +0 -285
  2432. package/node_modules/incur/src/Filter.test.ts +0 -237
  2433. package/node_modules/incur/src/Formatter.test.ts +0 -326
  2434. package/node_modules/incur/src/Help.test.ts +0 -414
  2435. package/node_modules/incur/src/Mcp.test.ts +0 -413
  2436. package/node_modules/incur/src/Openapi.test.ts +0 -389
  2437. package/node_modules/incur/src/Parser.test.ts +0 -378
  2438. package/node_modules/incur/src/Schema.test.ts +0 -167
  2439. package/node_modules/incur/src/Skill.test.ts +0 -441
  2440. package/node_modules/incur/src/Skillgen.test.ts +0 -77
  2441. package/node_modules/incur/src/SyncMcp.test.ts +0 -136
  2442. package/node_modules/incur/src/SyncSkills.test.ts +0 -301
  2443. package/node_modules/incur/src/Typegen.test.ts +0 -205
  2444. package/node_modules/incur/src/bun-compile.test.ts +0 -84
  2445. package/node_modules/incur/src/e2e.test.ts +0 -3441
  2446. package/node_modules/incur/src/internal/configSchema.test.ts +0 -193
  2447. package/node_modules/incur/src/internal/dereference.test.ts +0 -695
  2448. package/node_modules/incur/src/internal/helpers.test.ts +0 -75
  2449. package/node_modules/incur/src/internal/pm.test.ts +0 -38
  2450. package/node_modules/incur/src/internal/utils.test.ts +0 -50
  2451. package/node_modules/incur/src/middleware.test.ts +0 -6
@@ -1,5 +1,8 @@
1
1
  import { createHash } from "node:crypto";
2
- import { assertContractId, compareIsoTimestampsAscending, deviceDataOriginSchema, experimentFrontmatterSchema, externalRefSchema, journalDayFrontmatterSchema, eventRecordSchema, eventImportDecisionSchema, isWritableIsoDateTime, safeParseContract, sampleRecordSchema, } from "@murphai/contracts";
2
+ import { createReadStream } from "node:fs";
3
+ import { stat } from "node:fs/promises";
4
+ import { performance } from "node:perf_hooks";
5
+ import { auditRecordSchema, assertContractId, collectEventRawReferencePaths, compareIsoTimestampsAscending, deviceDataOriginSchema, experimentFrontmatterSchema, externalRefSchema, journalDayFrontmatterSchema, eventRecordSchema, eventImportDecisionSchema, isWritableIsoDateTime, resolveFloatingIsoTimestampInTimeZone, safeParseContract, sampleRecordSchema, } from "@murphai/contracts";
3
6
  import { BASELINE_EVENT_KINDS, BASELINE_SAMPLE_STREAMS, EVENT_SCHEMA_VERSION, EVENT_SOURCES, FRONTMATTER_SCHEMA_VERSIONS, ID_PREFIXES, SAMPLE_QUALITIES, SAMPLE_SCHEMA_VERSION, SAMPLE_SOURCES, VAULT_LAYOUT, } from "./constants.js";
4
7
  import { emitAuditRecord } from "./audit.js";
5
8
  import { prepareEventAttachments, stagePreparedEventAttachmentsInBatch, } from "./event-attachments.js";
@@ -10,20 +13,22 @@ import { parseFrontmatterDocument, stringifyFrontmatterDocument } from "./frontm
10
13
  import { deterministicContractId, generateRecordId } from "./ids.js";
11
14
  import { readJsonlRecords, toMonthlyShardRelativePath, visitJsonlRecordsInterruptible, } from "./jsonl.js";
12
15
  import { buildEventSpineLifecycle, collapseEventSpineEntries, compareEventSpineEntries, eventSpineRevision, isDeletedEventSpineRecord, selectLatestEventSpineEntry, } from "./history/event-spine.js";
13
- import { buildPublicEventImportRecord, loadEventLedgerShardsById, selectLatestMatchedEvent, toEventLedgerFile, } from "./domains/events/ledger.js";
16
+ import { buildEventImportDecisionRecord, buildPublicEventImportRecord, loadEventLedgerShardsById, selectLatestMatchedEvent, toEventLedgerFile, } from "./domains/events/ledger.js";
14
17
  import { normalizeMealNutrition, } from "./nutrition.js";
15
- import { stageRawImportManifest } from "./operations/raw-manifests.js";
16
- import { runCanonicalWrite } from "./operations/write-batch.js";
18
+ import { parseRawImportManifest, resolveRawManifestPath, stageRawImportManifest, } from "./operations/raw-manifests.js";
19
+ import { runCanonicalWrite, } from "./operations/write-batch.js";
17
20
  import { assertCanonicalWriteLockScope } from "./operations/canonical-write-lock.js";
18
21
  import { resolveVaultPath } from "./path-safety.js";
19
22
  import { sanitizePathSegment } from "./path-safety.js";
20
- import { prepareInlineRawArtifact, prepareRawArtifact, resolveRawAssetDirectory } from "./raw.js";
23
+ import { prepareInlineRawArtifact, prepareRawArtifact, rawDirectoryMatchesOwner, resolveRawAssetDirectory, } from "./raw.js";
21
24
  import { buildIntegrationEvidencePart, buildIntegrationIngestAppendPlan, buildIntegrationIngestAppendPlanFromInspection, buildIntegrationIngestRecord, stageIntegrationIngestAppendPlan, compactIntegrationIngestReceipt, inspectIntegrationIngestIdsForImportedAt, selectNovelIntegrationIngestEvidence, } from "./integration-ingests.js";
22
25
  import { normalizeUniqueTextList } from "./bank/shared.js";
23
26
  import { defaultTimeZone, normalizeTimeZone, toIsoTimestamp, toLocalDayKey, } from "./time.js";
24
27
  import { loadVault } from "./vault.js";
28
+ import { statAndHashVaultFile } from "./raw-artifact-integrity.js";
25
29
  const DENSE_DEVICE_TELEMETRY_NOT_ALLOWED_CODE = "VAULT_DENSE_DEVICE_TELEMETRY_NOT_ALLOWED";
26
30
  const DENSE_DEVICE_SAMPLES_NOT_ALLOWED_LEGACY_CODE = "VAULT_DENSE_DEVICE_SAMPLES_NOT_ALLOWED";
31
+ const MAX_JUNCTION_DAILY_ALIAS_REPAIR_REVISIONS = 64;
27
32
  const RESERVED_DEVICE_EVENT_FIELD_NAMES = new Set([
28
33
  "schemaVersion",
29
34
  "id",
@@ -47,6 +52,9 @@ const RESERVED_DEVICE_EVENT_FIELD_NAMES = new Set([
47
52
  "visibility",
48
53
  ]);
49
54
  const MAX_DEVICE_PROVIDER_SAMPLE_ROWS_DEFAULT = 1_000;
55
+ // Junction menstrual resources admit 512 dated non-BBT facts plus the
56
+ // period-length and cycle-length scalar facets for the same resource version.
57
+ const MAX_DEVICE_AUTHORITATIVE_CURRENT_FACETS = 514;
50
58
  const EVENT_KIND_SET = new Set(BASELINE_EVENT_KINDS);
51
59
  const EVENT_SOURCE_SET = new Set(EVENT_SOURCES);
52
60
  const SAMPLE_STREAM_SET = new Set(BASELINE_SAMPLE_STREAMS);
@@ -541,7 +549,8 @@ function normalizeDeviceEventInputs(eventInputs, context) {
541
549
  const inputTimeZone = typeof eventInput.timeZone === "string" ? eventInput.timeZone : undefined;
542
550
  const preservesProviderDayWithoutTimeZone = Boolean(inputDayKey &&
543
551
  !inputTimeZone &&
544
- (isJunctionSleepStageExternalRefInput(eventInput.externalRef)
552
+ (context.provider === "junction"
553
+ || isJunctionSleepStageExternalRefInput(eventInput.externalRef)
545
554
  || isDateOnlyFloatingProviderDayInput(inputDayKey, eventInput.dataOrigin)));
546
555
  const seed = buildNormalizedEventSeed({
547
556
  kind,
@@ -656,7 +665,65 @@ function normalizeDeviceBatchObjectArray(input) {
656
665
  }
657
666
  return input.value.map((entry, index) => assertPlainObject(entry, input.itemCode, `${input.itemLabel} ${index + 1} must be a plain object.`));
658
667
  }
659
- function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date(), defaultTimeZone: fallbackTimeZone, source = "device", events = [], samples = [], evidenceParts = [], ingestReceipt, provenance, }) {
668
+ function normalizeDeviceAuthoritativeEventSets(inputs, events) {
669
+ if (inputs.length > 128) {
670
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SETS", "Device batch authoritativeEventSets exceeds 128 resources.");
671
+ }
672
+ const sets = inputs.map((input, index) => {
673
+ const parsedRef = safeParseContract(externalRefSchema, {
674
+ system: input.system,
675
+ resourceType: input.resourceType,
676
+ resourceId: input.resourceId,
677
+ version: input.version,
678
+ });
679
+ if (!parsedRef.success || !parsedRef.data.version || !isWritableIsoDateTime(parsedRef.data.version)) {
680
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SET", `Device authoritative event set ${index + 1} requires a valid versioned externalRef identity.`);
681
+ }
682
+ const facetPrefixes = normalizeUniqueTextList(input.facetPrefixes, `authoritativeEventSets[${index}].facetPrefixes`, 32, 200);
683
+ const currentFacets = normalizeUniqueTextList(input.currentFacets, `authoritativeEventSets[${index}].currentFacets`, MAX_DEVICE_AUTHORITATIVE_CURRENT_FACETS, 200) ?? [];
684
+ if (!facetPrefixes || facetPrefixes.length === 0) {
685
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SET", `Device authoritative event set ${index + 1} requires at least one facet prefix.`);
686
+ }
687
+ const ownsFacet = (facet) => facetPrefixes.some((prefix) => facet === prefix || facet.startsWith(`${prefix}-`));
688
+ if (currentFacets.some((facet) => !ownsFacet(facet))) {
689
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SET", `Device authoritative event set ${index + 1} contains a current facet outside its owned prefixes.`);
690
+ }
691
+ return {
692
+ system: parsedRef.data.system,
693
+ resourceType: parsedRef.data.resourceType,
694
+ resourceId: parsedRef.data.resourceId,
695
+ version: parsedRef.data.version,
696
+ facetPrefixes: [...facetPrefixes].sort(),
697
+ currentFacets: new Set(currentFacets),
698
+ };
699
+ });
700
+ const identityKeys = sets.map((set) => stableStringify({
701
+ system: set.system,
702
+ resourceType: set.resourceType,
703
+ resourceId: set.resourceId,
704
+ }));
705
+ if (new Set(identityKeys).size !== identityKeys.length) {
706
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SETS", "Device batch authoritativeEventSets contains duplicate resource identities.");
707
+ }
708
+ for (const set of sets) {
709
+ for (const facet of set.currentFacets) {
710
+ // Unversioned members follow complete-set reconciliation: the set's
711
+ // version orders only retraction tombstones, while member events collapse
712
+ // by semantic content and reassert through the serialized set seam.
713
+ const hasCurrentEvent = events.some(({ seed }) => seed.externalRef?.system === set.system
714
+ && seed.externalRef.resourceType === set.resourceType
715
+ && seed.externalRef.resourceId === set.resourceId
716
+ && (seed.externalRef.version === set.version
717
+ || seed.externalRef.version === undefined)
718
+ && seed.externalRef.facet === facet);
719
+ if (!hasCurrentEvent) {
720
+ throw new VaultError("VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SET", `Device authoritative event set current facet "${facet}" has no matching current event.`);
721
+ }
722
+ }
723
+ }
724
+ return sets;
725
+ }
726
+ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date(), defaultTimeZone: fallbackTimeZone, source = "device", events = [], samples = [], evidenceParts = [], authoritativeEventSets = [], ingestReceipt, provenance, }) {
660
727
  const normalizedProvider = sanitizePathSegment(provider, "provider");
661
728
  const normalizedAccountId = typeof accountId === "string" && accountId.trim() ? accountId.trim() : undefined;
662
729
  const normalizedImportedAt = toIsoTimestamp(importedAt, "importedAt");
@@ -686,12 +753,26 @@ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date
686
753
  itemCode: "VAULT_INVALID_RAW_ARTIFACT",
687
754
  itemLabel: "Device raw artifact",
688
755
  });
756
+ const authoritativeEventSetInputs = normalizeDeviceBatchObjectArray({
757
+ value: authoritativeEventSets,
758
+ code: "VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SETS",
759
+ message: "Device batch authoritativeEventSets must be an array when provided.",
760
+ itemCode: "VAULT_INVALID_DEVICE_AUTHORITATIVE_EVENT_SET",
761
+ itemLabel: "Device authoritative event set",
762
+ });
689
763
  if (eventInputs.length === 0
690
764
  && sampleInputs.length === 0
691
765
  && evidencePartInputs.length === 0
692
766
  && !normalizedIngestReceipt) {
693
767
  throw new VaultError("VAULT_INVALID_DEVICE_BATCH", "importDeviceBatch requires at least one event, sample, evidence part, or ingest receipt.");
694
768
  }
769
+ const normalizedEvents = normalizeDeviceEventInputs(eventInputs, {
770
+ provider: normalizedProvider,
771
+ accountId: normalizedAccountId,
772
+ importedAt: normalizedImportedAt,
773
+ source: normalizedSource,
774
+ defaultTimeZone,
775
+ });
695
776
  return {
696
777
  provider: normalizedProvider,
697
778
  accountId: normalizedAccountId,
@@ -701,13 +782,7 @@ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date
701
782
  provenance: normalizedProvenance,
702
783
  ingestReceipt: normalizedIngestReceipt,
703
784
  legacyIngestReceipt,
704
- events: normalizeDeviceEventInputs(eventInputs, {
705
- provider: normalizedProvider,
706
- accountId: normalizedAccountId,
707
- importedAt: normalizedImportedAt,
708
- source: normalizedSource,
709
- defaultTimeZone,
710
- }),
785
+ events: normalizedEvents,
711
786
  samples: normalizeDeviceSampleInputs(sampleInputs, {
712
787
  provider: normalizedProvider,
713
788
  accountId: normalizedAccountId,
@@ -715,6 +790,7 @@ function normalizeDeviceBatchInputs({ provider, accountId, importedAt = new Date
715
790
  defaultTimeZone,
716
791
  }),
717
792
  evidenceParts: normalizeDeviceEvidencePartInputs(evidencePartInputs, normalizedProvider),
793
+ authoritativeEventSets: normalizeDeviceAuthoritativeEventSets(authoritativeEventSetInputs, normalizedEvents),
718
794
  };
719
795
  }
720
796
  function prepareDeviceEvidenceParts(evidenceParts) {
@@ -785,12 +861,119 @@ function compareIncomingExternalRefVersion(existing, incoming) {
785
861
  }
786
862
  return compareIsoTimestampsAscending(incomingVersion, existingVersion);
787
863
  }
864
+ const JUNCTION_SPARSE_INTERVAL_RESOURCE_TYPE_SUFFIXES = [
865
+ "-caffeine",
866
+ "-mindfulness-minutes",
867
+ "-water",
868
+ ];
869
+ const MAX_JUNCTION_SPARSE_AFFECTED_DAY_KEYS = 64;
870
+ function isJunctionSparseIntervalExternalRef(externalRef) {
871
+ return externalRef.system === "junction"
872
+ && externalRef.facet === "interval"
873
+ && JUNCTION_SPARSE_INTERVAL_RESOURCE_TYPE_SUFFIXES.some((suffix) => externalRef.resourceType.endsWith(suffix));
874
+ }
875
+ function junctionSparseAffectedCalendarTargets(events, index) {
876
+ const targets = new Map();
877
+ for (const event of events) {
878
+ if (!event.externalRef || !isJunctionSparseIntervalExternalRef(event.externalRef)) {
879
+ continue;
880
+ }
881
+ const sourceProviderSlug = event.dataOrigin?.sourceProviderSlug;
882
+ const externalRefSourceProviderSlug = JUNCTION_SPARSE_INTERVAL_RESOURCE_TYPE_SUFFIXES
883
+ .find((suffix) => event.externalRef?.resourceType.endsWith(suffix));
884
+ const resolvedSourceProviderSlug = sourceProviderSlug ?? (externalRefSourceProviderSlug
885
+ ? event.externalRef.resourceType.slice("junction-".length, -externalRefSourceProviderSlug.length)
886
+ : "");
887
+ if (!resolvedSourceProviderSlug) {
888
+ continue;
889
+ }
890
+ const addTarget = (dayKey) => {
891
+ const target = {
892
+ dayKey,
893
+ sourceProviderSlug: resolvedSourceProviderSlug,
894
+ ...(event.dataOrigin?.sourceInstanceId === undefined
895
+ ? {}
896
+ : { sourceInstanceId: event.dataOrigin.sourceInstanceId }),
897
+ ...(event.dataOrigin?.sourceType
898
+ ? { sourceType: event.dataOrigin.sourceType }
899
+ : {}),
900
+ };
901
+ targets.set(stableStringify(target), target);
902
+ };
903
+ addTarget(event.dayKey);
904
+ // Include the immediately displaced provider day so the caller can persist
905
+ // one calendar-refresh job for each side of this accepted transition.
906
+ const previousRevision = eventSpineRevision(event) - 1;
907
+ if (previousRevision < 1) {
908
+ continue;
909
+ }
910
+ const dayHistory = index.junctionSparseDayHistoryById.get(event.id);
911
+ const previousDayKey = dayHistory?.latest.revision === previousRevision
912
+ ? dayHistory.latest.dayKey
913
+ : dayHistory?.previous?.revision === previousRevision
914
+ ? dayHistory.previous.dayKey
915
+ : undefined;
916
+ if (previousDayKey) {
917
+ addTarget(previousDayKey);
918
+ }
919
+ }
920
+ const affectedTargets = [...targets.values()].sort((left, right) => left.dayKey.localeCompare(right.dayKey)
921
+ || left.sourceProviderSlug.localeCompare(right.sourceProviderSlug)
922
+ || (left.sourceType ?? "").localeCompare(right.sourceType ?? "")
923
+ || (left.sourceInstanceId ?? "").localeCompare(right.sourceInstanceId ?? ""));
924
+ const affectedDayKeys = new Set(affectedTargets.map((target) => target.dayKey));
925
+ if (affectedDayKeys.size > MAX_JUNCTION_SPARSE_AFFECTED_DAY_KEYS
926
+ || affectedTargets.length > MAX_JUNCTION_SPARSE_AFFECTED_DAY_KEYS) {
927
+ throw new VaultError("DEVICE_IMPORT_AFFECTED_DAY_LIMIT_EXCEEDED", "Junction sparse import exceeded the affected provider-day limit; nothing was imported.", {
928
+ affectedDayCount: affectedDayKeys.size,
929
+ affectedTargetCount: affectedTargets.length,
930
+ maxAllowed: MAX_JUNCTION_SPARSE_AFFECTED_DAY_KEYS,
931
+ });
932
+ }
933
+ return affectedTargets;
934
+ }
935
+ function junctionSparseAffectedDayKeys(targets) {
936
+ return [...new Set(targets.map((target) => target.dayKey))].sort();
937
+ }
788
938
  // Device-sync content equality ignores per-import identity (id, lifecycle,
789
939
  // recordedAt) AND rawRefs, because device imports mint fresh raw-artifact
790
- // paths on every sync run.
791
- function deviceEventContentKey(record) {
940
+ // paths on every sync run. Member-edit comparison additionally excludes the
941
+ // immutable provider attribution fields while retaining every public edit.
942
+ function eventContentKey(record, options) {
792
943
  const { id: _id, rawRefs: _rawRefs, lifecycle: _lifecycle, recordedAt: _recordedAt, ...content } = record;
793
- return stableStringify(content);
944
+ if (options.includeProviderAttribution) {
945
+ return stableStringify(content);
946
+ }
947
+ const { dataOrigin: _dataOrigin, externalRef: _externalRef, ...memberMutableContent } = content;
948
+ return stableStringify(memberMutableContent);
949
+ }
950
+ function deviceEventContentKey(record) {
951
+ const { id: _id, rawRefs: _rawRefs, lifecycle: _lifecycle, recordedAt: _recordedAt, externalRef, dataOrigin, ...semanticContent } = record;
952
+ return stableStringify({
953
+ ...semanticContent,
954
+ // Identity and source ordering are enforced independently. Keeping them
955
+ // out of semantic equality prevents a newer provider capture/version from
956
+ // masquerading as a health-data change over a member-authored revision.
957
+ externalRef: externalRef
958
+ ? {
959
+ system: externalRef.system,
960
+ resourceType: externalRef.resourceType,
961
+ resourceId: externalRef.resourceId,
962
+ facet: externalRef.facet ?? null,
963
+ }
964
+ : null,
965
+ dataOrigin: dataOrigin
966
+ ? {
967
+ // This is the fixed data-origin schema discriminator, not the
968
+ // provider resource version used for ordering.
969
+ version: dataOrigin.version,
970
+ aggregatorProvider: dataOrigin.aggregatorProvider ?? null,
971
+ sourceProviderSlug: dataOrigin.sourceProviderSlug ?? null,
972
+ sourceType: dataOrigin.sourceType ?? null,
973
+ sourceInstanceId: dataOrigin.sourceInstanceId ?? null,
974
+ }
975
+ : null,
976
+ });
794
977
  }
795
978
  function deviceEventContentFingerprint(record) {
796
979
  return createHash("sha256").update(deviceEventContentKey(record)).digest("hex");
@@ -872,7 +1055,11 @@ function orderEventImportDecisionsBySourceVersion(decisions) {
872
1055
  return ordered;
873
1056
  }
874
1057
  async function indexLatestEventsByExternalRef(vaultRoot, relativePaths, signal) {
1058
+ const aliasRepairContaminatedEventIds = new Set();
1059
+ const aliasRepairContaminatedRefKeys = new Set();
875
1060
  const deviceOwnerRevisionsByRefKeyAndFingerprint = new Map();
1061
+ const junctionSparseDayHistoryById = new Map();
1062
+ const liveOwnerIdsByRefKey = new Map();
876
1063
  const latestByRefKey = new Map();
877
1064
  const latestById = new Map();
878
1065
  const maxRevisionById = new Map();
@@ -892,13 +1079,41 @@ async function indexLatestEventsByExternalRef(vaultRoot, relativePaths, signal)
892
1079
  signal?.throwIfAborted();
893
1080
  const parsed = safeParseContract(eventRecordSchema, raw);
894
1081
  if (!parsed.success) {
1082
+ if (isLooseRecordValue(raw)) {
1083
+ if (typeof raw.id === "string" && raw.id.length > 0) {
1084
+ aliasRepairContaminatedEventIds.add(raw.id);
1085
+ }
1086
+ const rejectedRefKey = readRejectedEventExternalRefKey(raw.externalRef);
1087
+ if (rejectedRefKey) {
1088
+ aliasRepairContaminatedRefKeys.add(rejectedRefKey);
1089
+ }
1090
+ }
895
1091
  return;
896
1092
  }
897
1093
  const entry = { relativePath, record: parsed.data };
898
1094
  maxRevisionById.set(entry.record.id, Math.max(maxRevisionById.get(entry.record.id) ?? 0, eventSpineRevision(entry.record)));
899
1095
  const revisions = revisionsById.get(entry.record.id) ?? new Set();
900
- revisions.add(eventSpineRevision(entry.record));
1096
+ const revision = eventSpineRevision(entry.record);
1097
+ revisions.add(revision);
901
1098
  revisionsById.set(entry.record.id, revisions);
1099
+ if (entry.record.externalRef
1100
+ && isJunctionSparseIntervalExternalRef(entry.record.externalRef)) {
1101
+ const candidate = { dayKey: entry.record.dayKey, revision };
1102
+ const history = junctionSparseDayHistoryById.get(entry.record.id);
1103
+ if (!history || revision > history.latest.revision) {
1104
+ junctionSparseDayHistoryById.set(entry.record.id, {
1105
+ latest: candidate,
1106
+ ...(history ? { previous: history.latest } : {}),
1107
+ });
1108
+ }
1109
+ else if (revision < history.latest.revision
1110
+ && (!history.previous || revision > history.previous.revision)) {
1111
+ junctionSparseDayHistoryById.set(entry.record.id, {
1112
+ latest: history.latest,
1113
+ previous: candidate,
1114
+ });
1115
+ }
1116
+ }
902
1117
  const state = entriesById.get(entry.record.id);
903
1118
  const latestDeviceExternalRefEntryByRefKey = state?.latestDeviceExternalRefEntryByRefKey ?? new Map();
904
1119
  if (entry.record.source === "device" && entry.record.externalRef) {
@@ -949,13 +1164,19 @@ async function indexLatestEventsByExternalRef(vaultRoot, relativePaths, signal)
949
1164
  const refKey = eventExternalRefKey(externalRefEntry.record.externalRef);
950
1165
  const indexedExternalRefEntry = state.latestDeviceExternalRefEntryByRefKey.get(refKey) ?? externalRefEntry;
951
1166
  const refGroup = groupedByRefKey.get(refKey) ?? [];
952
- refGroup.push({
1167
+ const indexedMatch = {
953
1168
  indexedExternalRef: indexedExternalRefEntry.record.externalRef ?? externalRefEntry.record.externalRef,
954
1169
  indexedRecord: indexedExternalRefEntry.record,
955
1170
  relativePath: latestForId.relativePath,
956
1171
  record: latestForId.record,
957
- });
1172
+ };
1173
+ refGroup.push(indexedMatch);
958
1174
  groupedByRefKey.set(refKey, refGroup);
1175
+ if (!isDeletedEventSpineRecord(latestForId.record)) {
1176
+ const liveOwnerIds = liveOwnerIdsByRefKey.get(refKey) ?? new Set();
1177
+ liveOwnerIds.add(latestForId.record.id);
1178
+ liveOwnerIdsByRefKey.set(refKey, liveOwnerIds);
1179
+ }
959
1180
  }
960
1181
  for (const [refKey, group] of groupedByRefKey) {
961
1182
  signal?.throwIfAborted();
@@ -966,14 +1187,45 @@ async function indexLatestEventsByExternalRef(vaultRoot, relativePaths, signal)
966
1187
  latestByRefKey.set(refKey, latest);
967
1188
  }
968
1189
  }
1190
+ const junctionNoIdProfilePredecessorsByScope = indexJunctionNoIdProfilePredecessors(latestByRefKey.values());
969
1191
  return {
1192
+ aliasRepairContaminatedEventIds,
1193
+ aliasRepairContaminatedRefKeys,
1194
+ aliasRepairHistoryById: new Map(),
970
1195
  deviceOwnerRevisionsByRefKeyAndFingerprint,
1196
+ junctionNoIdProfilePredecessorsByScope,
1197
+ junctionSparseDayHistoryById,
971
1198
  latestByRefKey,
972
1199
  latestById,
1200
+ liveOwnerIdsByRefKey,
973
1201
  maxRevisionById,
974
1202
  revisionsById,
975
1203
  };
976
1204
  }
1205
+ async function loadBoundedAliasRepairHistories(vaultRoot, relativePaths, eventIds) {
1206
+ const histories = new Map();
1207
+ for (const relativePath of relativePaths) {
1208
+ await visitJsonlRecordsInterruptible({
1209
+ vaultRoot,
1210
+ relativePath,
1211
+ visit(raw) {
1212
+ const parsed = safeParseContract(eventRecordSchema, raw);
1213
+ if (!parsed.success || !eventIds.has(parsed.data.id)) {
1214
+ return;
1215
+ }
1216
+ const history = histories.get(parsed.data.id) ?? [];
1217
+ if (history.length <= MAX_JUNCTION_DAILY_ALIAS_REPAIR_REVISIONS) {
1218
+ history.push({ relativePath, record: parsed.data });
1219
+ histories.set(parsed.data.id, history);
1220
+ }
1221
+ },
1222
+ });
1223
+ }
1224
+ for (const history of histories.values()) {
1225
+ history.sort((left, right) => eventSpineRevision(left.record) - eventSpineRevision(right.record));
1226
+ }
1227
+ return histories;
1228
+ }
977
1229
  function isSameObservationFacet(existing, incoming) {
978
1230
  return existing.kind === "observation" &&
979
1231
  incoming.kind === "observation" &&
@@ -995,6 +1247,8 @@ const JUNCTION_SLEEP_STAGE_METRIC_FACETS = new Set([
995
1247
  ]);
996
1248
  const JUNCTION_SLEEP_STAGE_SUMMARY_NORMALIZER_VERSION = "junction-sleep-stage-summary.v1";
997
1249
  const JUNCTION_SLEEP_STAGE_CYCLE_FALLBACK_NORMALIZER_VERSION = "junction-sleep-stage-cycle-fallback.v1";
1250
+ const JUNCTION_NO_ID_PROFILE_NORMALIZER_VERSION = "junction-no-id-profile.v1";
1251
+ const JUNCTION_STABLE_PROFILE_CREATED_AT_NORMALIZER_VERSION = "junction-stable-profile-created-at.v1";
998
1252
  function deviceDataOriginSourceMatches(existing, incoming) {
999
1253
  if (!existing || !incoming) {
1000
1254
  return false;
@@ -1013,6 +1267,193 @@ function deviceDataOriginSourceMatches(existing, incoming) {
1013
1267
  }
1014
1268
  return compared;
1015
1269
  }
1270
+ function junctionNoIdProfileScopeKey(externalRef, origin) {
1271
+ if (externalRef?.system !== "junction"
1272
+ || !externalRef.resourceType.endsWith("-profile")
1273
+ || typeof externalRef.facet !== "string"
1274
+ || !/^profile-[a-f0-9]{16}$/u.test(externalRef.resourceId)
1275
+ || origin?.sourceProviderSlug === undefined) {
1276
+ return null;
1277
+ }
1278
+ return stableStringify({
1279
+ resourceType: externalRef.resourceType,
1280
+ facet: externalRef.facet,
1281
+ aggregatorProvider: origin.aggregatorProvider,
1282
+ sourceProviderSlug: origin.sourceProviderSlug,
1283
+ sourceType: origin.sourceType,
1284
+ sourceInstanceId: origin.sourceInstanceId,
1285
+ });
1286
+ }
1287
+ function junctionNoIdProfileResourceId(origin, occurredAt) {
1288
+ return `profile-${createHash("sha256")
1289
+ .update(JSON.stringify([
1290
+ "profile",
1291
+ origin.sourceProviderSlug,
1292
+ origin.sourceType,
1293
+ origin.sourceInstanceId,
1294
+ occurredAt,
1295
+ ]))
1296
+ .digest("hex")
1297
+ .slice(0, 16)}`;
1298
+ }
1299
+ function junctionNoIdProfileProviderBaselineRevision(match) {
1300
+ const externalRef = match.indexedExternalRef;
1301
+ const providerRecord = match.indexedRecord;
1302
+ const origin = providerRecord.dataOrigin;
1303
+ const isCurrentNoIdProfile = origin?.normalizerVersion
1304
+ === JUNCTION_NO_ID_PROFILE_NORMALIZER_VERSION;
1305
+ const isLegacyNoIdProfile = origin?.normalizerVersion === "junction-normalizer.v1";
1306
+ const persistedRevision = isCurrentNoIdProfile
1307
+ ? externalRef.version
1308
+ : externalRef.version ?? providerRecord.occurredAt;
1309
+ if ((!isCurrentNoIdProfile && !isLegacyNoIdProfile)
1310
+ || !junctionNoIdProfileScopeKey(externalRef, origin)
1311
+ || persistedRevision === undefined
1312
+ || !isWritableIsoDateTime(persistedRevision)
1313
+ || !isWritableIsoDateTime(providerRecord.occurredAt)
1314
+ || origin?.observedAtRaw !== providerRecord.occurredAt
1315
+ || (isLegacyNoIdProfile && providerRecord.occurredAt !== persistedRevision)) {
1316
+ return null;
1317
+ }
1318
+ const expectedResourceId = junctionNoIdProfileResourceId(origin, providerRecord.occurredAt);
1319
+ return externalRef.resourceId === expectedResourceId ? persistedRevision : null;
1320
+ }
1321
+ function junctionNoIdProfilePredecessorRevision(match) {
1322
+ return isDeletedEventSpineRecord(match.record)
1323
+ ? null
1324
+ : junctionNoIdProfileProviderBaselineRevision(match);
1325
+ }
1326
+ function isJunctionNoIdProfilePredecessor(match) {
1327
+ return junctionNoIdProfileProviderBaselineRevision(match) !== null;
1328
+ }
1329
+ function indexJunctionNoIdProfilePredecessors(matches) {
1330
+ const byScope = new Map();
1331
+ for (const match of matches) {
1332
+ if (!isJunctionNoIdProfilePredecessor(match)) {
1333
+ continue;
1334
+ }
1335
+ const scopeKey = junctionNoIdProfileScopeKey(match.indexedExternalRef, match.indexedRecord.dataOrigin);
1336
+ if (!scopeKey) {
1337
+ continue;
1338
+ }
1339
+ const scopedMatches = byScope.get(scopeKey) ?? [];
1340
+ scopedMatches.push(match);
1341
+ byScope.set(scopeKey, scopedMatches);
1342
+ }
1343
+ return byScope;
1344
+ }
1345
+ function isIncomingJunctionNoIdProfile(record) {
1346
+ return record.dataOrigin?.normalizerVersion === JUNCTION_NO_ID_PROFILE_NORMALIZER_VERSION
1347
+ && junctionNoIdProfileScopeKey(record.externalRef, record.dataOrigin) !== null;
1348
+ }
1349
+ function isIncomingJunctionStableProfileCreatedAt(record) {
1350
+ return record.dataOrigin?.normalizerVersion === JUNCTION_STABLE_PROFILE_CREATED_AT_NORMALIZER_VERSION
1351
+ && junctionNoIdProfileScopeKey(record.externalRef, record.dataOrigin) !== null;
1352
+ }
1353
+ function isExactJunctionProfileCreatedAtTimestampReplay(existing, incoming) {
1354
+ const existingRef = existing.externalRef;
1355
+ const incomingRef = incoming.externalRef;
1356
+ const existingOrigin = existing.dataOrigin;
1357
+ const incomingOrigin = incoming.dataOrigin;
1358
+ const existingRevision = existingRef?.version ?? existing.occurredAt;
1359
+ const existingScopeKey = junctionNoIdProfileScopeKey(existingRef, existingOrigin);
1360
+ const incomingScopeKey = junctionNoIdProfileScopeKey(incomingRef, incomingOrigin);
1361
+ if (!existingOrigin
1362
+ || !incomingOrigin
1363
+ || existingScopeKey === null
1364
+ || existingScopeKey !== incomingScopeKey
1365
+ || !existingRef
1366
+ || !incomingRef?.version
1367
+ || !isWritableIsoDateTime(existingRevision)
1368
+ || !isWritableIsoDateTime(incomingRef.version)
1369
+ || !isWritableIsoDateTime(existing.occurredAt)
1370
+ || !isWritableIsoDateTime(existing.recordedAt)
1371
+ || !isWritableIsoDateTime(incoming.occurredAt)
1372
+ || !isWritableIsoDateTime(incoming.recordedAt)
1373
+ || compareIsoTimestampsAscending(incomingRef.version, existingRevision) !== 0
1374
+ || (!isDeletedEventSpineRecord(existing)
1375
+ && compareIsoTimestampsAscending(existing.recordedAt, existing.occurredAt) !== 0)
1376
+ || (isDeletedEventSpineRecord(existing)
1377
+ && compareIsoTimestampsAscending(existing.recordedAt, existing.occurredAt) < 0)
1378
+ || existing.dayKey !== toIsoTimestamp(existing.occurredAt, "existing.occurredAt").slice(0, 10)
1379
+ || compareIsoTimestampsAscending(incoming.occurredAt, existing.occurredAt) >= 0
1380
+ || compareIsoTimestampsAscending(incoming.recordedAt, incoming.occurredAt) !== 0
1381
+ || incoming.dayKey !== toIsoTimestamp(incoming.occurredAt, "incoming.occurredAt").slice(0, 10)
1382
+ || existingOrigin.observedAtRaw !== existing.occurredAt
1383
+ || incomingOrigin.observedAtRaw !== incoming.occurredAt
1384
+ || !deviceDataOriginSourceMatches(existingOrigin, incomingOrigin)
1385
+ || existingOrigin.timeZoneOffsetMinutes !== incomingOrigin.timeZoneOffsetMinutes
1386
+ || existingOrigin.timestampSemantics !== incomingOrigin.timestampSemantics
1387
+ || existingOrigin.originConfidence !== incomingOrigin.originConfidence) {
1388
+ return false;
1389
+ }
1390
+ return deviceEventContentKey({
1391
+ ...existing,
1392
+ occurredAt: incoming.occurredAt,
1393
+ recordedAt: incoming.recordedAt,
1394
+ dayKey: incoming.dayKey,
1395
+ externalRef: incomingRef,
1396
+ dataOrigin: incomingOrigin,
1397
+ }) === deviceEventContentKey(incoming);
1398
+ }
1399
+ // One released Junction normalizer pinned stable-profile occurrence to the
1400
+ // mutable updated-at revision. The successor pins occurrence to created-at but
1401
+ // deliberately keeps updated-at as source ordering. Admit only that exact,
1402
+ // one-way timestamp-only replay so the generic equal-revision guard remains
1403
+ // fail-closed for health-data changes.
1404
+ function isJunctionStableProfileCreatedAtTimestampMigration(existing, incoming) {
1405
+ const existingRef = existing.externalRef;
1406
+ const incomingRef = incoming.externalRef;
1407
+ return isIncomingJunctionStableProfileCreatedAt(incoming)
1408
+ && existing.dataOrigin?.normalizerVersion === "junction-normalizer.v1"
1409
+ && existingRef?.version !== undefined
1410
+ && incomingRef !== undefined
1411
+ && eventExternalRefKey(existingRef) === eventExternalRefKey(incomingRef)
1412
+ && isExactJunctionProfileCreatedAtTimestampReplay(existing, incoming);
1413
+ }
1414
+ // Revision-2 admission is account-wide, so a released no-ID profile can be
1415
+ // replayed after created_at becomes available while updated_at (the provider
1416
+ // revision) is unchanged. Its timestamp-derived resource identity changes,
1417
+ // but the replay must not split a member edit or bypass a deletion. Retain the
1418
+ // old identity only for this exact timestamp-only transition; changed health
1419
+ // data at the same source revision remains a conflict.
1420
+ function isJunctionNoIdProfileEqualRevisionTimestampReplay(existing, incoming) {
1421
+ const existingRef = existing.externalRef;
1422
+ const incomingRef = incoming.externalRef;
1423
+ const existingOrigin = existing.dataOrigin;
1424
+ const incomingOrigin = incoming.dataOrigin;
1425
+ if (!isIncomingJunctionNoIdProfile(incoming)
1426
+ || !existingRef
1427
+ || !incomingRef
1428
+ || !existingOrigin
1429
+ || !incomingOrigin
1430
+ || eventExternalRefKey(existingRef) === eventExternalRefKey(incomingRef)
1431
+ || junctionNoIdProfileResourceId(existingOrigin, existing.occurredAt)
1432
+ !== existingRef.resourceId
1433
+ || junctionNoIdProfileResourceId(incomingOrigin, incoming.occurredAt)
1434
+ !== incomingRef.resourceId
1435
+ || !(existingOrigin.normalizerVersion === "junction-normalizer.v1"
1436
+ || existingOrigin.normalizerVersion === JUNCTION_NO_ID_PROFILE_NORMALIZER_VERSION)) {
1437
+ return false;
1438
+ }
1439
+ return isExactJunctionProfileCreatedAtTimestampReplay(existing, incoming);
1440
+ }
1441
+ function isMemberDeletedJunctionStableProfile(existing, incoming) {
1442
+ const existingRef = existing.externalRef;
1443
+ const incomingRef = incoming.externalRef;
1444
+ if (!existingRef || !incomingRef) {
1445
+ return false;
1446
+ }
1447
+ return isDeletedEventSpineRecord(existing)
1448
+ && isIncomingJunctionStableProfileCreatedAt(incoming)
1449
+ && junctionNoIdProfileScopeKey(existingRef, existing.dataOrigin) !== null
1450
+ && eventExternalRefKey(existingRef) === eventExternalRefKey(incomingRef)
1451
+ && deviceDataOriginSourceMatches(existing.dataOrigin, incoming.dataOrigin)
1452
+ && existingRef?.version !== undefined
1453
+ && isWritableIsoDateTime(existingRef.version)
1454
+ && isWritableIsoDateTime(existing.recordedAt)
1455
+ && compareIsoTimestampsAscending(existing.recordedAt, existingRef.version) > 0;
1456
+ }
1016
1457
  function isDateLikeWhoopBodyMeasurementResourceId(resourceId) {
1017
1458
  return /^\d{4}-\d{2}-\d{2}$/u.test(resourceId) ||
1018
1459
  /^date:\d{4}-\d{2}-\d{2}$/u.test(resourceId);
@@ -1077,6 +1518,95 @@ function shouldKeepExistingJunctionSleepStageSummaryObservation(existing, incomi
1077
1518
  isJunctionSleepStageCycleFallbackObservation(incoming);
1078
1519
  }
1079
1520
  const JUNCTION_COMPANION_HEALTH_METADATA_SOURCE_TYPE = "companion-whoop-metadata-unverified";
1521
+ const JUNCTION_SPARSE_FLOATING_FALLBACK_NORMALIZER_VERSION = "junction-sparse-timeseries.floating-fallback.v2";
1522
+ function resolveJunctionFloatingFallbackTime(existing, incoming) {
1523
+ if (incoming.externalRef?.system !== "junction"
1524
+ || incoming.dataOrigin?.normalizerVersion
1525
+ !== JUNCTION_SPARSE_FLOATING_FALLBACK_NORMALIZER_VERSION
1526
+ || incoming.dataOrigin.timestampSemantics !== "floating") {
1527
+ return incoming;
1528
+ }
1529
+ if (!incoming.timeZone) {
1530
+ return incoming;
1531
+ }
1532
+ // Junction documents Libre's +00:00 values as wall clocks, not instants.
1533
+ // The importer carries those raw wall values through a schema-valid transient
1534
+ // event. Resolve them only after stable external identity lookup, so a matched
1535
+ // row uses its event spine's accepted zone while a new row uses the incoming
1536
+ // fallback zone. Each endpoint resolves independently across DST transitions.
1537
+ const acceptedExisting = existing?.externalRef?.system === "junction"
1538
+ && existing.dataOrigin?.timestampSemantics === "floating"
1539
+ && deviceDataOriginSourceMatches(existing.dataOrigin, incoming.dataOrigin)
1540
+ ? existing
1541
+ : undefined;
1542
+ const targetTimeZone = acceptedExisting?.timeZone ?? incoming.timeZone;
1543
+ const startRaw = incoming.dataOrigin.observedAtRaw;
1544
+ if (typeof startRaw !== "string") {
1545
+ return incoming;
1546
+ }
1547
+ const resolvedOccurrence = resolveFloatingIsoTimestampInTimeZone(startRaw, targetTimeZone);
1548
+ const resolvedStart = incoming.kind === "intervention_session"
1549
+ && typeof incoming.fields?.["start-at"] === "string"
1550
+ ? resolveFloatingIsoTimestampInTimeZone(incoming.fields["start-at"], targetTimeZone)
1551
+ : undefined;
1552
+ const resolvedStartAt = resolvedStart?.timestamp;
1553
+ const resolvedEndAt = incoming.kind === "intervention_session"
1554
+ && typeof incoming.fields?.["end-at"] === "string"
1555
+ ? resolveFloatingIsoTimestampInTimeZone(incoming.fields["end-at"], targetTimeZone)?.timestamp
1556
+ : undefined;
1557
+ if (!resolvedOccurrence
1558
+ || (incoming.kind === "intervention_session"
1559
+ && (!resolvedStartAt
1560
+ || !resolvedEndAt
1561
+ || Date.parse(resolvedEndAt) < Date.parse(resolvedStartAt)))) {
1562
+ return null;
1563
+ }
1564
+ const resolvedInterventionFields = incoming.kind === "intervention_session"
1565
+ && incoming.fields
1566
+ ? {
1567
+ ...incoming.fields,
1568
+ ...(resolvedStartAt ? { "start-at": resolvedStartAt } : {}),
1569
+ ...(resolvedEndAt ? { "end-at": resolvedEndAt } : {}),
1570
+ }
1571
+ : undefined;
1572
+ const canonicalOccurrence = incoming.kind === "intervention_session"
1573
+ && resolvedStartAt
1574
+ ? resolvedStartAt
1575
+ : resolvedOccurrence.timestamp;
1576
+ const canonicalDayKey = incoming.kind === "intervention_session"
1577
+ && resolvedStart
1578
+ ? resolvedStart.dayKey
1579
+ : resolvedOccurrence.dayKey;
1580
+ return {
1581
+ ...incoming,
1582
+ occurredAt: canonicalOccurrence,
1583
+ recordedAt: acceptedExisting?.recordedAt ?? incoming.recordedAt,
1584
+ dayKey: canonicalDayKey,
1585
+ timeZone: targetTimeZone,
1586
+ ...(incoming.kind === "intervention_session" && resolvedInterventionFields
1587
+ ? { fields: resolvedInterventionFields }
1588
+ : {}),
1589
+ };
1590
+ }
1591
+ function resolveJunctionFloatingFallbackEntries(entries, context) {
1592
+ return entries.flatMap((entry) => {
1593
+ if (entry.record.externalRef?.system !== "junction"
1594
+ || entry.record.dataOrigin?.normalizerVersion
1595
+ !== JUNCTION_SPARSE_FLOATING_FALLBACK_NORMALIZER_VERSION) {
1596
+ return [entry];
1597
+ }
1598
+ const resolved = resolveDeviceEventIdentity(entry, context, { strict: true });
1599
+ const indexedProviderMatch = resolved?.matchedEntries.find((match) => match.indexedMatch.record.id === resolved.latest?.id)?.indexedMatch ?? resolved?.matchedEntries[0]?.indexedMatch;
1600
+ const canonicalRecord = resolveJunctionFloatingFallbackTime(indexedProviderMatch?.indexedRecord, entry.record);
1601
+ return canonicalRecord
1602
+ ? [{
1603
+ ...entry,
1604
+ relativePath: toEventLedgerFile(canonicalRecord.occurredAt),
1605
+ record: canonicalRecord,
1606
+ }]
1607
+ : [];
1608
+ });
1609
+ }
1080
1610
  function parseJunctionCompanionSyncVersion(version) {
1081
1611
  if (!version || !/^(?:0|[1-9]\d*)$/u.test(version)) {
1082
1612
  return undefined;
@@ -1178,12 +1708,126 @@ function toIndexedExternalRefMatch(record, externalRef, relativePath = "") {
1178
1708
  record,
1179
1709
  };
1180
1710
  }
1181
- function userAuthoredEventStateKey(record) {
1182
- return stableStringify({
1183
- links: record.links ?? [],
1184
- note: record.note ?? null,
1185
- tags: record.tags ?? [],
1711
+ const deviceBatchImportSessionState = new WeakMap();
1712
+ export function createDeviceBatchImportSession() {
1713
+ const session = Object.freeze({
1714
+ kind: "device_batch_import_session",
1715
+ });
1716
+ deviceBatchImportSessionState.set(session, new Map());
1717
+ return session;
1718
+ }
1719
+ function buildDeviceEventIdentityDependency(plan, additionalEventIds = []) {
1720
+ const externalRefs = plan.preparedEvents.flatMap((entry) => [
1721
+ ...(entry.record.externalRef ? [entry.record.externalRef] : []),
1722
+ ...entry.legacyExternalRefs,
1723
+ ]);
1724
+ return {
1725
+ authoritativeEventSets: plan.authoritativeEventSets,
1726
+ eventIds: new Set([
1727
+ ...plan.preparedEvents.map((entry) => entry.record.id),
1728
+ ...additionalEventIds,
1729
+ ]),
1730
+ externalRefs,
1731
+ junctionNoIdProfileScopes: new Set(plan.preparedEvents.flatMap((entry) => {
1732
+ const externalRef = entry.record.externalRef;
1733
+ const scope = externalRef
1734
+ ? junctionNoIdProfileScopeKey(externalRef, entry.record.dataOrigin)
1735
+ : null;
1736
+ return scope ? [scope] : [];
1737
+ })),
1738
+ };
1739
+ }
1740
+ function eventRefBelongsToAuthoritativeSet(externalRef, set) {
1741
+ if (externalRef.system !== set.system
1742
+ || externalRef.resourceType !== set.resourceType
1743
+ || externalRef.resourceId !== set.resourceId
1744
+ || externalRef.facet === undefined) {
1745
+ return false;
1746
+ }
1747
+ return set.facetPrefixes.some((prefix) => externalRef.facet === prefix || externalRef.facet?.startsWith(`${prefix}-`));
1748
+ }
1749
+ function authoritativeEventSetsOverlap(left, right) {
1750
+ if (left.system !== right.system
1751
+ || left.resourceType !== right.resourceType
1752
+ || left.resourceId !== right.resourceId) {
1753
+ return false;
1754
+ }
1755
+ return left.facetPrefixes.some((leftPrefix) => right.facetPrefixes.some((rightPrefix) => leftPrefix === rightPrefix
1756
+ || leftPrefix.startsWith(`${rightPrefix}-`)
1757
+ || rightPrefix.startsWith(`${leftPrefix}-`)));
1758
+ }
1759
+ function deviceEventIdentityDependenciesOverlap(left, right) {
1760
+ if ([...left.eventIds].some((eventId) => right.eventIds.has(eventId))) {
1761
+ return true;
1762
+ }
1763
+ const rightRefKeys = new Set(right.externalRefs.map(eventExternalRefKey));
1764
+ if (left.externalRefs.some((externalRef) => rightRefKeys.has(eventExternalRefKey(externalRef)))) {
1765
+ return true;
1766
+ }
1767
+ if ([...left.junctionNoIdProfileScopes].some((scope) => right.junctionNoIdProfileScopes.has(scope))) {
1768
+ return true;
1769
+ }
1770
+ if (left.externalRefs.some((externalRef) => right.authoritativeEventSets.some((set) => eventRefBelongsToAuthoritativeSet(externalRef, set)))) {
1771
+ return true;
1772
+ }
1773
+ if (right.externalRefs.some((externalRef) => left.authoritativeEventSets.some((set) => eventRefBelongsToAuthoritativeSet(externalRef, set)))) {
1774
+ return true;
1775
+ }
1776
+ return left.authoritativeEventSets.some((leftSet) => right.authoritativeEventSets.some((rightSet) => authoritativeEventSetsOverlap(leftSet, rightSet)));
1777
+ }
1778
+ function readDeviceBatchImportSessionVaultState(session, vaultRoot) {
1779
+ return session ? deviceBatchImportSessionState.get(session)?.get(vaultRoot) : undefined;
1780
+ }
1781
+ function replaceDeviceBatchImportSessionVaultState(session, vaultRoot, state) {
1782
+ if (!session) {
1783
+ return;
1784
+ }
1785
+ deviceBatchImportSessionState.get(session)?.set(vaultRoot, state);
1786
+ }
1787
+ function clearDeviceBatchImportSessionVaultState(session, vaultRoot) {
1788
+ if (!session) {
1789
+ return;
1790
+ }
1791
+ deviceBatchImportSessionState.get(session)?.delete(vaultRoot);
1792
+ }
1793
+ function emitDeviceBatchImportTiming(observer, timing) {
1794
+ try {
1795
+ observer?.({ ...timing });
1796
+ }
1797
+ catch {
1798
+ // Diagnostics must not turn an already-committed canonical write into an
1799
+ // apparent import failure.
1800
+ }
1801
+ }
1802
+ async function buildDeviceEventLedgerFingerprint(vaultRoot) {
1803
+ const shardPaths = await walkVaultFiles(vaultRoot, VAULT_LAYOUT.eventLedgerDirectory, {
1804
+ extension: ".jsonl",
1186
1805
  });
1806
+ const metadata = await Promise.all(shardPaths.map(async (relativePath) => {
1807
+ const shard = await stat(resolveVaultPath(vaultRoot, relativePath).absolutePath);
1808
+ return [
1809
+ relativePath,
1810
+ shard.dev,
1811
+ shard.ino,
1812
+ shard.size,
1813
+ shard.mtimeMs,
1814
+ shard.ctimeMs,
1815
+ ].join("\0");
1816
+ }));
1817
+ return createHash("sha256").update(metadata.join("\n")).digest("hex");
1818
+ }
1819
+ async function tryBuildDeviceEventLedgerFingerprint(vaultRoot) {
1820
+ try {
1821
+ return await buildDeviceEventLedgerFingerprint(vaultRoot);
1822
+ }
1823
+ catch {
1824
+ // A failed cache fence disables reuse. The canonical import path remains
1825
+ // authoritative and will surface any real ledger read failure itself.
1826
+ return undefined;
1827
+ }
1828
+ }
1829
+ function userAuthoredEventStateKey(record) {
1830
+ return eventContentKey(record, { includeProviderAttribution: false });
1187
1831
  }
1188
1832
  function hasHistoricalExternalRefUserAuthoredChanges(match) {
1189
1833
  return eventSpineRevision(match.record) > eventSpineRevision(match.indexedRecord) &&
@@ -1191,39 +1835,99 @@ function hasHistoricalExternalRefUserAuthoredChanges(match) {
1191
1835
  }
1192
1836
  function buildLegacyExternalRefReservations(entries, index) {
1193
1837
  const reservations = new Map();
1838
+ const reserve = (entry, refKey, indexedMatch) => {
1839
+ const existing = reservations.get(refKey);
1840
+ if (existing && existing.entry !== entry) {
1841
+ const externalRef = indexedMatch.indexedExternalRef;
1842
+ throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Event legacy externalRef "${externalRef.system}/${externalRef.resourceType}/` +
1843
+ `${externalRef.resourceId}${externalRef.facet ? `#${externalRef.facet}` : ""}" ` +
1844
+ "matched multiple incoming device events; ambiguous legacy cleanup must be repaired explicitly.");
1845
+ }
1846
+ reservations.set(refKey, { entry, indexedMatch });
1847
+ };
1194
1848
  for (const entry of entries) {
1195
1849
  const externalRef = entry.record.externalRef;
1196
1850
  if (!externalRef) {
1197
1851
  continue;
1198
1852
  }
1199
1853
  const primaryRefKey = eventExternalRefKey(externalRef);
1854
+ const dailyAliasOwnerSplit = resolveJunctionDailyAggregateAliasOwnerSplit(entry, index);
1200
1855
  for (const legacyExternalRef of entry.legacyExternalRefs) {
1201
1856
  const legacyRefKey = eventExternalRefKey(legacyExternalRef);
1202
1857
  if (legacyRefKey === primaryRefKey) {
1203
1858
  continue;
1204
1859
  }
1205
- const indexedMatch = index.latestByRefKey.get(legacyRefKey);
1206
- if (!indexedMatch || !isCompatibleLegacyExternalRefMatch(indexedMatch, entry.record, legacyExternalRef)) {
1860
+ const persistedAliasMatch = dailyAliasOwnerSplit?.legacyRefKey === legacyRefKey
1861
+ ? dailyAliasOwnerSplit.legacyOwner
1862
+ : undefined;
1863
+ const indexedMatch = persistedAliasMatch ?? index.latestByRefKey.get(legacyRefKey);
1864
+ if (!indexedMatch
1865
+ || (!persistedAliasMatch
1866
+ && !isCompatibleLegacyExternalRefMatch(indexedMatch, entry.record, legacyExternalRef))) {
1207
1867
  continue;
1208
1868
  }
1209
- const existing = reservations.get(legacyRefKey);
1210
- if (existing && existing.entry !== entry) {
1211
- throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Event legacy externalRef "${legacyExternalRef.system}/${legacyExternalRef.resourceType}/` +
1212
- `${legacyExternalRef.resourceId}${legacyExternalRef.facet ? `#${legacyExternalRef.facet}` : ""}" ` +
1213
- "matched multiple incoming device events; ambiguous legacy cleanup must be repaired explicitly.");
1869
+ reserve(entry, legacyRefKey, indexedMatch);
1870
+ }
1871
+ if (!isIncomingJunctionNoIdProfile(entry.record)) {
1872
+ continue;
1873
+ }
1874
+ const scopeKey = junctionNoIdProfileScopeKey(externalRef, entry.record.dataOrigin);
1875
+ const incomingRevision = externalRef.version;
1876
+ if (!scopeKey || !incomingRevision || !isWritableIsoDateTime(incomingRevision)) {
1877
+ continue;
1878
+ }
1879
+ const scopedMatches = (index.junctionNoIdProfilePredecessorsByScope.get(scopeKey) ?? [])
1880
+ .filter((match) => eventExternalRefKey(match.indexedExternalRef) !== primaryRefKey);
1881
+ const equalRevisionMatches = scopedMatches.filter((match) => {
1882
+ const predecessorRevision = junctionNoIdProfileProviderBaselineRevision(match);
1883
+ return predecessorRevision !== null
1884
+ && compareIsoTimestampsAscending(incomingRevision, predecessorRevision) === 0;
1885
+ });
1886
+ if (equalRevisionMatches.length > 1) {
1887
+ throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Junction profile externalRef "${externalRef.system}/${externalRef.resourceType}/` +
1888
+ `${externalRef.resourceId}${externalRef.facet ? `#${externalRef.facet}` : ""}" ` +
1889
+ "matched multiple persisted identities at the same provider revision; nothing was imported.");
1890
+ }
1891
+ const equalRevisionMatch = equalRevisionMatches[0];
1892
+ if (equalRevisionMatch) {
1893
+ if (!isJunctionNoIdProfileEqualRevisionTimestampReplay(equalRevisionMatch.indexedRecord, entry.record)) {
1894
+ throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Junction profile externalRef "${externalRef.system}/${externalRef.resourceType}/` +
1895
+ `${externalRef.resourceId}${externalRef.facet ? `#${externalRef.facet}` : ""}" ` +
1896
+ `has conflicting content for source revision "${incomingRevision}"; nothing was imported.`);
1214
1897
  }
1215
- reservations.set(legacyRefKey, { entry, indexedMatch });
1898
+ reserve(entry, eventExternalRefKey(equalRevisionMatch.indexedExternalRef), equalRevisionMatch);
1899
+ continue;
1900
+ }
1901
+ const predecessorMatches = scopedMatches.filter((match) => {
1902
+ const predecessorRevision = junctionNoIdProfilePredecessorRevision(match);
1903
+ return predecessorRevision !== null
1904
+ && compareIsoTimestampsAscending(incomingRevision, predecessorRevision) > 0;
1905
+ });
1906
+ if (predecessorMatches.length > 1) {
1907
+ throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Junction profile externalRef "${externalRef.system}/${externalRef.resourceType}/` +
1908
+ `${externalRef.resourceId}${externalRef.facet ? `#${externalRef.facet}` : ""}" ` +
1909
+ "matched multiple persisted predecessor identities; nothing was imported.");
1910
+ }
1911
+ const predecessor = predecessorMatches[0];
1912
+ if (predecessor) {
1913
+ reserve(entry, eventExternalRefKey(predecessor.indexedExternalRef), predecessor);
1216
1914
  }
1217
1915
  }
1218
1916
  return reservations;
1219
1917
  }
1220
- async function buildDeviceEventIdentityContext(vaultRoot, entries) {
1221
- if (entries.length === 0) {
1918
+ async function buildDeviceEventIdentityContext(vaultRoot, entries, authoritativeEventSets = []) {
1919
+ if (entries.length === 0 && authoritativeEventSets.length === 0) {
1222
1920
  return {
1223
1921
  index: {
1922
+ aliasRepairContaminatedEventIds: new Set(),
1923
+ aliasRepairContaminatedRefKeys: new Set(),
1924
+ aliasRepairHistoryById: new Map(),
1224
1925
  deviceOwnerRevisionsByRefKeyAndFingerprint: new Map(),
1926
+ junctionNoIdProfilePredecessorsByScope: new Map(),
1927
+ junctionSparseDayHistoryById: new Map(),
1225
1928
  latestByRefKey: new Map(),
1226
1929
  latestById: new Map(),
1930
+ liveOwnerIdsByRefKey: new Map(),
1227
1931
  maxRevisionById: new Map(),
1228
1932
  revisionsById: new Map(),
1229
1933
  },
@@ -1234,28 +1938,55 @@ async function buildDeviceEventIdentityContext(vaultRoot, entries) {
1234
1938
  extension: ".jsonl",
1235
1939
  });
1236
1940
  const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths);
1237
- return {
1238
- index,
1239
- legacyReservations: buildLegacyExternalRefReservations(entries, index),
1240
- };
1941
+ const context = { index, legacyReservations: new Map() };
1942
+ // A legitimate primary spine may advance before the duplicate is repaired.
1943
+ // Load only structural candidates first so reservations can use the bounded
1944
+ // common-initial-history proof instead of latest-record equality.
1945
+ const aliasRepairOwnerIds = new Set();
1946
+ for (const entry of entries) {
1947
+ const ownerSplit = resolveStructuralJunctionDailyAggregateAliasOwnerSplit(entry, index);
1948
+ if (!ownerSplit) {
1949
+ continue;
1950
+ }
1951
+ assertJunctionDailyAggregateAliasHistoryIsUncontaminated(entry, context);
1952
+ aliasRepairOwnerIds.add(ownerSplit.primaryOwner.record.id);
1953
+ aliasRepairOwnerIds.add(ownerSplit.legacyOwner.record.id);
1954
+ }
1955
+ if (aliasRepairOwnerIds.size > 0) {
1956
+ index.aliasRepairHistoryById = await loadBoundedAliasRepairHistories(vaultRoot, shardPaths, aliasRepairOwnerIds);
1957
+ }
1958
+ context.legacyReservations = buildLegacyExternalRefReservations(entries, index);
1959
+ return context;
1241
1960
  }
1242
1961
  function cloneDeviceEventIdentityContext(context) {
1243
1962
  return {
1244
1963
  index: {
1964
+ aliasRepairContaminatedEventIds: new Set(context.index.aliasRepairContaminatedEventIds),
1965
+ aliasRepairContaminatedRefKeys: new Set(context.index.aliasRepairContaminatedRefKeys),
1966
+ aliasRepairHistoryById: new Map([...context.index.aliasRepairHistoryById].map(([id, history]) => [id, [...history]])),
1245
1967
  deviceOwnerRevisionsByRefKeyAndFingerprint: context.index.deviceOwnerRevisionsByRefKeyAndFingerprint,
1968
+ junctionNoIdProfilePredecessorsByScope: context.index.junctionNoIdProfilePredecessorsByScope,
1969
+ junctionSparseDayHistoryById: context.index.junctionSparseDayHistoryById,
1246
1970
  latestByRefKey: new Map(context.index.latestByRefKey),
1247
1971
  latestById: new Map(context.index.latestById),
1972
+ liveOwnerIdsByRefKey: new Map([...context.index.liveOwnerIdsByRefKey].map(([key, ids]) => [key, new Set(ids)])),
1248
1973
  maxRevisionById: new Map(context.index.maxRevisionById),
1249
- revisionsById: new Map(context.index.revisionsById),
1974
+ revisionsById: new Map([...context.index.revisionsById].map(([id, revisions]) => [id, new Set(revisions)])),
1250
1975
  },
1251
1976
  legacyReservations: new Map(context.legacyReservations),
1252
1977
  };
1253
1978
  }
1254
1979
  function buildEmptyDeviceEventIdentityContext(entries) {
1255
1980
  const index = {
1981
+ aliasRepairContaminatedEventIds: new Set(),
1982
+ aliasRepairContaminatedRefKeys: new Set(),
1983
+ aliasRepairHistoryById: new Map(),
1256
1984
  deviceOwnerRevisionsByRefKeyAndFingerprint: new Map(),
1985
+ junctionNoIdProfilePredecessorsByScope: new Map(),
1986
+ junctionSparseDayHistoryById: new Map(),
1257
1987
  latestByRefKey: new Map(),
1258
1988
  latestById: new Map(),
1989
+ liveOwnerIdsByRefKey: new Map(),
1259
1990
  maxRevisionById: new Map(),
1260
1991
  revisionsById: new Map(),
1261
1992
  };
@@ -1272,6 +2003,470 @@ function eventSpineRevisionsAreComplete(index, eventId) {
1272
2003
  && revisions !== undefined
1273
2004
  && revisions.size === maxRevision;
1274
2005
  }
2006
+ function buildDeviceEventAliasRepairContext(plan) {
2007
+ return {
2008
+ evidenceByRole: new Map(plan.preparedEvidenceParts.map((part) => [part.role, part])),
2009
+ evidenceRolesByPreparedRecordId: plan.evidenceRolesByPreparedRecordId,
2010
+ };
2011
+ }
2012
+ function isLooseRecordValue(value) {
2013
+ return value !== null && typeof value === "object" && !Array.isArray(value);
2014
+ }
2015
+ function readRejectedEventExternalRefKey(value) {
2016
+ if (!isLooseRecordValue(value)) {
2017
+ return undefined;
2018
+ }
2019
+ const parsed = safeParseContract(externalRefSchema, {
2020
+ system: value.system,
2021
+ resourceType: value.resourceType,
2022
+ resourceId: value.resourceId,
2023
+ ...(value.facet === undefined ? {} : { facet: value.facet }),
2024
+ ...(value.version === undefined ? {} : { version: value.version }),
2025
+ });
2026
+ return parsed.success ? eventExternalRefKey(parsed.data) : undefined;
2027
+ }
2028
+ function junctionDailyAggregateAliasRefShape(externalRef) {
2029
+ return stableStringify({
2030
+ facet: externalRef.facet ?? null,
2031
+ resourceType: externalRef.resourceType,
2032
+ system: externalRef.system,
2033
+ version: externalRef.version ?? null,
2034
+ });
2035
+ }
2036
+ function junctionDailyAggregateAliasOriginKey(origin) {
2037
+ if (!origin) {
2038
+ return null;
2039
+ }
2040
+ const { observedAtRaw: _observedAtRaw, ...stableOrigin } = origin;
2041
+ return stableStringify(stableOrigin);
2042
+ }
2043
+ function junctionDailyAggregateAliasHistoricalOriginMatches(historical, current) {
2044
+ if (!historical) {
2045
+ return false;
2046
+ }
2047
+ if (junctionDailyAggregateAliasOriginKey(historical)
2048
+ === junctionDailyAggregateAliasOriginKey(current)) {
2049
+ return true;
2050
+ }
2051
+ if (historical.timeZoneOffsetMinutes !== undefined) {
2052
+ return false;
2053
+ }
2054
+ const { observedAtRaw: _historicalObservedAtRaw, timeZoneOffsetMinutes: _historicalOffset, ...stableHistorical } = historical;
2055
+ const { observedAtRaw: _currentObservedAtRaw, timeZoneOffsetMinutes: _currentOffset, ...stableCurrent } = current;
2056
+ return stableStringify(stableHistorical) === stableStringify(stableCurrent);
2057
+ }
2058
+ function junctionDailyAggregateProviderStateKey(record) {
2059
+ const { dataOrigin: _dataOrigin, dayKey: _dayKey, externalRef: _externalRef, id: _id, lifecycle: _lifecycle, links: _links, note: _note, recordedAt: _recordedAt, source: _source, tags: _tags, ...providerState } = record;
2060
+ return stableStringify(providerState);
2061
+ }
2062
+ function isJunctionDailyAggregateAliasCandidate(entry) {
2063
+ const externalRef = entry.record.externalRef;
2064
+ const legacyExternalRef = entry.legacyExternalRefs[0];
2065
+ return externalRef !== undefined
2066
+ && legacyExternalRef !== undefined
2067
+ && entry.legacyExternalRefs.length === 1
2068
+ && entry.record.kind === "observation"
2069
+ && entry.record.source === "device"
2070
+ && entry.record.dataOrigin?.aggregatorProvider === "junction"
2071
+ && entry.record.dataOrigin.normalizerVersion === "junction-normalizer.v1"
2072
+ && externalRef.system === "junction"
2073
+ && externalRef.version === undefined
2074
+ && legacyExternalRef.version === undefined
2075
+ && eventExternalRefKey(externalRef) !== eventExternalRefKey(legacyExternalRef)
2076
+ && junctionDailyAggregateAliasRefShape(externalRef)
2077
+ === junctionDailyAggregateAliasRefShape(legacyExternalRef)
2078
+ && entry.record.note === undefined
2079
+ && entry.record.tags === undefined
2080
+ && entry.record.links === undefined
2081
+ && entry.record.rawRefs === undefined
2082
+ && entry.record.evidence === undefined
2083
+ && entry.record.attachments === undefined;
2084
+ }
2085
+ function resolveStructuralJunctionDailyAggregateAliasOwnerSplit(entry, index) {
2086
+ const externalRef = entry.record.externalRef;
2087
+ const legacyExternalRef = entry.legacyExternalRefs[0];
2088
+ if (!externalRef
2089
+ || !legacyExternalRef
2090
+ || !isJunctionDailyAggregateAliasCandidate(entry)) {
2091
+ return null;
2092
+ }
2093
+ const primaryRefKey = eventExternalRefKey(externalRef);
2094
+ const legacyRefKey = eventExternalRefKey(legacyExternalRef);
2095
+ const primaryOwnerIds = index.liveOwnerIdsByRefKey.get(primaryRefKey)
2096
+ ?? new Set();
2097
+ const legacyOwnerIds = index.liveOwnerIdsByRefKey.get(legacyRefKey)
2098
+ ?? new Set();
2099
+ if (primaryOwnerIds.size === 0 || legacyOwnerIds.size === 0) {
2100
+ return null;
2101
+ }
2102
+ const primaryOwner = index.latestByRefKey.get(primaryRefKey);
2103
+ const legacyOwner = index.latestByRefKey.get(legacyRefKey);
2104
+ if (!primaryOwner || !legacyOwner) {
2105
+ return null;
2106
+ }
2107
+ const primaryProviderRecord = primaryOwner.indexedRecord;
2108
+ const legacyProviderRecord = legacyOwner.indexedRecord;
2109
+ const primaryOrigin = primaryProviderRecord.dataOrigin;
2110
+ const legacyOrigin = legacyProviderRecord.dataOrigin;
2111
+ const incomingOrigin = entry.record.dataOrigin;
2112
+ const observedAtRaw = incomingOrigin?.observedAtRaw;
2113
+ const observedAtRawPrefix = `${entry.record.dayKey}:`;
2114
+ const resource = observedAtRaw?.startsWith(observedAtRawPrefix)
2115
+ && observedAtRaw.endsWith(":daily")
2116
+ ? observedAtRaw.slice(observedAtRawPrefix.length, -":daily".length)
2117
+ : "";
2118
+ if (primaryProviderRecord.dayKey !== entry.record.dayKey
2119
+ || !isSameObservationFacet(primaryProviderRecord, entry.record)
2120
+ || !isSameObservationFacet(primaryProviderRecord, legacyProviderRecord)
2121
+ || junctionDailyAggregateAliasRefShape(primaryOwner.indexedExternalRef)
2122
+ !== junctionDailyAggregateAliasRefShape(externalRef)
2123
+ || junctionDailyAggregateAliasRefShape(legacyOwner.indexedExternalRef)
2124
+ !== junctionDailyAggregateAliasRefShape(legacyExternalRef)
2125
+ || !primaryOrigin
2126
+ || !legacyOrigin
2127
+ || !incomingOrigin
2128
+ || resource.length === 0
2129
+ || !deviceDataOriginSourceMatches(primaryOrigin, incomingOrigin)
2130
+ || !deviceDataOriginSourceMatches(legacyOrigin, incomingOrigin)) {
2131
+ return null;
2132
+ }
2133
+ const distinctOwnerIds = new Set([...primaryOwnerIds, ...legacyOwnerIds]);
2134
+ if (distinctOwnerIds.size < 2) {
2135
+ return null;
2136
+ }
2137
+ if (primaryOwnerIds.size !== 1
2138
+ || legacyOwnerIds.size !== 1
2139
+ || distinctOwnerIds.size !== 2) {
2140
+ throw new VaultError("EVENT_ALIAS_REPAIR_OWNER_REFUSED", "Junction daily aggregate alias repair requires exactly one live owner per claimed reference.");
2141
+ }
2142
+ if (!primaryOwnerIds.has(primaryOwner.record.id)
2143
+ || !legacyOwnerIds.has(legacyOwner.record.id)
2144
+ || primaryOwner.record.id === legacyOwner.record.id) {
2145
+ throw new VaultError("EVENT_ALIAS_REPAIR_OWNER_REFUSED", "Junction daily aggregate alias repair could not prove the two live reference owners.");
2146
+ }
2147
+ return { legacyOwner, legacyRefKey, primaryOwner, primaryRefKey, resource };
2148
+ }
2149
+ function assertJunctionDailyAggregateAliasHistoryIsUncontaminated(entry, context) {
2150
+ const externalRef = entry.record.externalRef;
2151
+ const legacyExternalRef = entry.legacyExternalRefs[0];
2152
+ if (!externalRef || !legacyExternalRef) {
2153
+ return;
2154
+ }
2155
+ const primaryRefKey = eventExternalRefKey(externalRef);
2156
+ const legacyRefKey = eventExternalRefKey(legacyExternalRef);
2157
+ const ownerIds = new Set([
2158
+ ...(context.index.liveOwnerIdsByRefKey.get(primaryRefKey) ?? []),
2159
+ ...(context.index.liveOwnerIdsByRefKey.get(legacyRefKey) ?? []),
2160
+ ]);
2161
+ if ([...ownerIds].some((id) => context.index.aliasRepairContaminatedEventIds.has(id))
2162
+ || context.index.aliasRepairContaminatedRefKeys.has(primaryRefKey)
2163
+ || context.index.aliasRepairContaminatedRefKeys.has(legacyRefKey)) {
2164
+ throw new VaultError("EVENT_ALIAS_REPAIR_HISTORY_REFUSED", "Junction daily aggregate alias repair found a schema-rejected candidate revision.");
2165
+ }
2166
+ }
2167
+ function parseJunctionDailyAggregateAliasEvidence(entry, context) {
2168
+ const roles = context.evidenceRolesByPreparedRecordId.get(entry.record.id) ?? [];
2169
+ const part = roles.length === 1 ? context.evidenceByRole.get(roles[0]) : undefined;
2170
+ const metadata = part?.metadata;
2171
+ if (!part
2172
+ || !isLooseRecordValue(metadata)
2173
+ || metadata.artifactClass !== "compact_provider_timeseries_aggregate"
2174
+ || metadata.provider !== "junction"
2175
+ || metadata.resourceCategory !== "timeseries_daily_aggregate"
2176
+ || metadata.retentionClass !== "provider_evidence") {
2177
+ throw new VaultError("EVENT_ALIAS_REPAIR_EVIDENCE_REFUSED", "Junction daily aggregate alias repair requires one exact compact provider evidence role.");
2178
+ }
2179
+ let parsed;
2180
+ try {
2181
+ parsed = JSON.parse(part.content);
2182
+ }
2183
+ catch {
2184
+ throw new VaultError("EVENT_ALIAS_REPAIR_EVIDENCE_REFUSED", "Junction daily aggregate alias repair evidence was not valid JSON.");
2185
+ }
2186
+ if (!isLooseRecordValue(parsed)) {
2187
+ throw new VaultError("EVENT_ALIAS_REPAIR_EVIDENCE_REFUSED", "Junction daily aggregate alias repair evidence did not contain an object.");
2188
+ }
2189
+ const legacyDayKeys = parsed.legacyDayKeys;
2190
+ const origin = entry.record.dataOrigin;
2191
+ if (parsed.schema !== "junction.timeseries_daily_aggregate.v1"
2192
+ || parsed.provider !== "junction"
2193
+ || typeof parsed.resource !== "string"
2194
+ || parsed.resource.length === 0
2195
+ || metadata.resource !== parsed.resource
2196
+ || typeof parsed.dayKey !== "string"
2197
+ || !/^\d{4}-\d{2}-\d{2}$/u.test(parsed.dayKey)
2198
+ || parsed.dayKey !== entry.record.dayKey
2199
+ || typeof parsed.sourceProviderSlug !== "string"
2200
+ || parsed.sourceProviderSlug.length === 0
2201
+ || typeof parsed.sampleCount !== "number"
2202
+ || !Number.isSafeInteger(parsed.sampleCount)
2203
+ || parsed.sampleCount <= 0
2204
+ || !Array.isArray(legacyDayKeys)
2205
+ || legacyDayKeys.length !== 1
2206
+ || typeof legacyDayKeys[0] !== "string"
2207
+ || !/^\d{4}-\d{2}-\d{2}$/u.test(legacyDayKeys[0])
2208
+ || legacyDayKeys[0] === parsed.dayKey
2209
+ || (parsed.sourceType !== undefined && typeof parsed.sourceType !== "string")
2210
+ || (parsed.sourceInstanceId !== undefined
2211
+ && parsed.sourceInstanceId !== null
2212
+ && typeof parsed.sourceInstanceId !== "string")
2213
+ || origin?.sourceProviderSlug !== parsed.sourceProviderSlug
2214
+ || (origin.sourceType ?? null) !== (parsed.sourceType ?? null)
2215
+ || (origin.sourceInstanceId ?? null) !== (parsed.sourceInstanceId ?? null)
2216
+ || origin.observedAtRaw !== `${parsed.dayKey}:${parsed.resource}:daily`) {
2217
+ throw new VaultError("EVENT_ALIAS_REPAIR_EVIDENCE_REFUSED", "Junction daily aggregate alias repair evidence did not prove one normalized primary and legacy day split.");
2218
+ }
2219
+ return {
2220
+ dayKey: parsed.dayKey,
2221
+ legacyDayKey: legacyDayKeys[0],
2222
+ resource: parsed.resource,
2223
+ };
2224
+ }
2225
+ function readCompleteJunctionDailyAggregateAliasHistory(index, eventId) {
2226
+ const history = index.aliasRepairHistoryById.get(eventId) ?? [];
2227
+ const maxRevision = index.maxRevisionById.get(eventId) ?? 0;
2228
+ const revisions = index.revisionsById.get(eventId);
2229
+ if (maxRevision < 1
2230
+ || maxRevision > MAX_JUNCTION_DAILY_ALIAS_REPAIR_REVISIONS
2231
+ || !revisions
2232
+ || revisions.size !== maxRevision
2233
+ || history.length !== maxRevision
2234
+ || history.some((entry, historyIndex) => eventSpineRevision(entry.record) !== historyIndex + 1)) {
2235
+ throw new VaultError("EVENT_ALIAS_REPAIR_HISTORY_REFUSED", "Junction daily aggregate alias repair requires a complete bounded event history.");
2236
+ }
2237
+ return history;
2238
+ }
2239
+ function junctionDailyAggregateAliasPersistedOriginsMatch(left, right) {
2240
+ if (!left || !right) {
2241
+ return false;
2242
+ }
2243
+ return junctionDailyAggregateAliasHistoricalOriginMatches(left, right)
2244
+ || junctionDailyAggregateAliasHistoricalOriginMatches(right, left);
2245
+ }
2246
+ function junctionDailyAggregateAliasInitialRecordMatches(record, input) {
2247
+ return record !== undefined
2248
+ && record.source === "device"
2249
+ && !isDeletedEventSpineRecord(record)
2250
+ && record.dayKey === input.expectedDayKey
2251
+ && record.dataOrigin?.observedAtRaw === input.expectedObservedAtRaw
2252
+ && record.externalRef !== undefined
2253
+ && eventExternalRefKey(record.externalRef)
2254
+ === eventExternalRefKey(input.expectedExternalRef)
2255
+ && junctionDailyAggregateAliasRefShape(record.externalRef)
2256
+ === junctionDailyAggregateAliasRefShape(input.expectedExternalRef);
2257
+ }
2258
+ function analyzeJunctionDailyAggregateAliasHistoryEvolution(input) {
2259
+ const expectedRefKey = eventExternalRefKey(input.expectedExternalRef);
2260
+ let providerStateKey = input.initialProviderStateKey;
2261
+ let memberCarrierStateKey;
2262
+ for (const { record } of input.history) {
2263
+ const recordProviderStateKey = junctionDailyAggregateProviderStateKey(record);
2264
+ const providerRecord = record.source === "device";
2265
+ const manualMatchesProvider = recordProviderStateKey === providerStateKey;
2266
+ const manualMatchesCarrier = memberCarrierStateKey !== undefined
2267
+ && recordProviderStateKey === memberCarrierStateKey;
2268
+ if (isDeletedEventSpineRecord(record)
2269
+ || (record.source !== "device" && record.source !== "manual")
2270
+ || record.dayKey !== input.expectedDayKey
2271
+ || !isSameObservationFacet(input.initialRecord, record)
2272
+ || (providerRecord
2273
+ && (!record.externalRef
2274
+ || !record.dataOrigin))
2275
+ || (record.externalRef !== undefined
2276
+ && (eventExternalRefKey(record.externalRef) !== expectedRefKey
2277
+ || junctionDailyAggregateAliasRefShape(record.externalRef)
2278
+ !== junctionDailyAggregateAliasRefShape(input.expectedExternalRef)))
2279
+ || (record.dataOrigin !== undefined
2280
+ && (record.dataOrigin.observedAtRaw !== input.expectedObservedAtRaw
2281
+ || !junctionDailyAggregateAliasHistoricalOriginMatches(record.dataOrigin, input.expectedOrigin)))
2282
+ || (providerRecord
2283
+ ? !input.allowProviderEvolution
2284
+ && recordProviderStateKey !== input.initialProviderStateKey
2285
+ : !manualMatchesProvider && !manualMatchesCarrier)) {
2286
+ throw new VaultError("EVENT_ALIAS_REPAIR_HISTORY_REFUSED", "Junction daily aggregate alias repair found unsupported or divergent historical state.");
2287
+ }
2288
+ if (providerRecord) {
2289
+ providerStateKey = recordProviderStateKey;
2290
+ }
2291
+ else if (manualMatchesProvider) {
2292
+ memberCarrierStateKey = recordProviderStateKey;
2293
+ }
2294
+ }
2295
+ const latest = input.history.at(-1)?.record;
2296
+ if (!latest) {
2297
+ throw new VaultError("EVENT_ALIAS_REPAIR_HISTORY_REFUSED", "Junction daily aggregate alias repair requires a complete bounded event history.");
2298
+ }
2299
+ const links = [...(latest.links ?? [])];
2300
+ const tags = [...(latest.tags ?? [])];
2301
+ return {
2302
+ links,
2303
+ memberAuthored: latest.source === "manual"
2304
+ || latest.note !== undefined
2305
+ || tags.length > 0
2306
+ || links.length > 0,
2307
+ ...(latest.note ? { note: latest.note } : {}),
2308
+ tags,
2309
+ };
2310
+ }
2311
+ function resolveJunctionDailyAggregateAliasOwnerSplit(entry, index) {
2312
+ const ownerSplit = resolveStructuralJunctionDailyAggregateAliasOwnerSplit(entry, index);
2313
+ const externalRef = entry.record.externalRef;
2314
+ const legacyExternalRef = entry.legacyExternalRefs[0];
2315
+ if (!ownerSplit || !externalRef || !legacyExternalRef || !entry.record.dataOrigin) {
2316
+ return null;
2317
+ }
2318
+ const primaryInitial = index.aliasRepairHistoryById.get(ownerSplit.primaryOwner.record.id)?.[0]?.record;
2319
+ const legacyInitial = index.aliasRepairHistoryById.get(ownerSplit.legacyOwner.record.id)?.[0]?.record;
2320
+ const legacyDayKey = ownerSplit.legacyOwner.indexedRecord.dayKey;
2321
+ // Divergent initial baselines are ordinary adjacent-day owners. Once the
2322
+ // baselines match, every later revision must satisfy the bounded evolution
2323
+ // rules before this pair can reserve or mutate either identity.
2324
+ if (!junctionDailyAggregateAliasInitialRecordMatches(primaryInitial, {
2325
+ expectedDayKey: entry.record.dayKey,
2326
+ expectedExternalRef: externalRef,
2327
+ expectedObservedAtRaw: `${entry.record.dayKey}:${ownerSplit.resource}:daily`,
2328
+ })
2329
+ || !junctionDailyAggregateAliasInitialRecordMatches(legacyInitial, {
2330
+ expectedDayKey: legacyDayKey,
2331
+ expectedExternalRef: legacyExternalRef,
2332
+ expectedObservedAtRaw: `${legacyDayKey}:${ownerSplit.resource}:daily`,
2333
+ })
2334
+ || !isSameObservationFacet(primaryInitial, legacyInitial)
2335
+ || junctionDailyAggregateProviderStateKey(primaryInitial)
2336
+ !== junctionDailyAggregateProviderStateKey(legacyInitial)
2337
+ || !junctionDailyAggregateAliasPersistedOriginsMatch(primaryInitial.dataOrigin, legacyInitial.dataOrigin)) {
2338
+ return null;
2339
+ }
2340
+ const primaryHistory = readCompleteJunctionDailyAggregateAliasHistory(index, ownerSplit.primaryOwner.record.id);
2341
+ const legacyHistory = readCompleteJunctionDailyAggregateAliasHistory(index, ownerSplit.legacyOwner.record.id);
2342
+ const primaryOverlay = analyzeJunctionDailyAggregateAliasHistoryEvolution({
2343
+ allowProviderEvolution: true,
2344
+ expectedDayKey: entry.record.dayKey,
2345
+ expectedExternalRef: externalRef,
2346
+ expectedOrigin: entry.record.dataOrigin,
2347
+ expectedObservedAtRaw: `${entry.record.dayKey}:${ownerSplit.resource}:daily`,
2348
+ history: primaryHistory,
2349
+ initialProviderStateKey: junctionDailyAggregateProviderStateKey(primaryInitial),
2350
+ initialRecord: primaryInitial,
2351
+ });
2352
+ const legacyOverlay = analyzeJunctionDailyAggregateAliasHistoryEvolution({
2353
+ allowProviderEvolution: false,
2354
+ expectedDayKey: legacyDayKey,
2355
+ expectedExternalRef: legacyExternalRef,
2356
+ expectedOrigin: entry.record.dataOrigin,
2357
+ expectedObservedAtRaw: `${legacyDayKey}:${ownerSplit.resource}:daily`,
2358
+ history: legacyHistory,
2359
+ initialProviderStateKey: junctionDailyAggregateProviderStateKey(legacyInitial),
2360
+ initialRecord: legacyInitial,
2361
+ });
2362
+ return { ...ownerSplit, legacyOverlay, primaryOverlay };
2363
+ }
2364
+ function hasJunctionDailyAggregateAliasSplit(entry, context) {
2365
+ return resolveJunctionDailyAggregateAliasOwnerSplit(entry, context.index) !== null;
2366
+ }
2367
+ function mergeJunctionDailyAggregateAliasOverlays(primary, legacy) {
2368
+ if (primary.note && legacy.note && primary.note !== legacy.note) {
2369
+ throw new VaultError("EVENT_ALIAS_REPAIR_OVERLAY_REFUSED", "Junction daily aggregate alias repair found conflicting member notes.");
2370
+ }
2371
+ const linksByKey = new Map();
2372
+ for (const link of [...primary.links, ...legacy.links]) {
2373
+ linksByKey.set(stableStringify(link), link);
2374
+ }
2375
+ return {
2376
+ links: [...linksByKey.entries()]
2377
+ .sort(([left], [right]) => left.localeCompare(right))
2378
+ .map(([, link]) => link),
2379
+ memberAuthored: primary.memberAuthored || legacy.memberAuthored,
2380
+ ...(primary.note || legacy.note ? { note: primary.note ?? legacy.note } : {}),
2381
+ tags: [...new Set([...primary.tags, ...legacy.tags])].sort(),
2382
+ };
2383
+ }
2384
+ function buildJunctionDailyAggregateAliasRepairPlan(input) {
2385
+ const { aliasRepairContext, context, entry } = input;
2386
+ const externalRef = entry.record.externalRef;
2387
+ const legacyExternalRef = entry.legacyExternalRefs[0];
2388
+ const ownerSplit = resolveJunctionDailyAggregateAliasOwnerSplit(entry, context.index);
2389
+ if (!aliasRepairContext
2390
+ || !externalRef
2391
+ || !legacyExternalRef
2392
+ || !ownerSplit) {
2393
+ return null;
2394
+ }
2395
+ assertJunctionDailyAggregateAliasHistoryIsUncontaminated(entry, context);
2396
+ const { legacyOverlay, legacyOwner, legacyRefKey, primaryOverlay, primaryOwner, primaryRefKey, } = ownerSplit;
2397
+ const evidence = parseJunctionDailyAggregateAliasEvidence(entry, aliasRepairContext);
2398
+ if (primaryOwner.record.dayKey !== evidence.dayKey
2399
+ || legacyOwner.record.dayKey !== evidence.legacyDayKey
2400
+ || ownerSplit.resource !== evidence.resource) {
2401
+ throw new VaultError("EVENT_ALIAS_REPAIR_HISTORY_REFUSED", "Junction daily aggregate alias repair owner days did not match the normalized evidence.");
2402
+ }
2403
+ const overlay = mergeJunctionDailyAggregateAliasOverlays(primaryOverlay, legacyOverlay);
2404
+ const primaryRevision = (context.index.maxRevisionById.get(primaryOwner.record.id) ?? 0) + 1;
2405
+ const legacyRevision = (context.index.maxRevisionById.get(legacyOwner.record.id) ?? 0) + 1;
2406
+ const providerSurvivor = {
2407
+ ...entry.record,
2408
+ id: primaryOwner.record.id,
2409
+ lifecycle: buildEventSpineLifecycle(primaryRevision),
2410
+ };
2411
+ const loserTombstone = {
2412
+ ...entry.record,
2413
+ id: legacyOwner.record.id,
2414
+ lifecycle: buildEventSpineLifecycle(legacyRevision, "deleted"),
2415
+ };
2416
+ const overlaySurvivor = overlay.memberAuthored
2417
+ ? {
2418
+ ...providerSurvivor,
2419
+ source: "manual",
2420
+ ...(overlay.note ? { note: overlay.note } : {}),
2421
+ ...(overlay.tags.length > 0 ? { tags: overlay.tags } : {}),
2422
+ ...(overlay.links.length > 0 ? { links: overlay.links } : {}),
2423
+ lifecycle: buildEventSpineLifecycle(primaryRevision + 1),
2424
+ }
2425
+ : undefined;
2426
+ return {
2427
+ legacyRefKey,
2428
+ loserPath: legacyOwner.relativePath || toEventLedgerFile(legacyOwner.record.occurredAt),
2429
+ loserTombstone,
2430
+ ...(overlaySurvivor ? { overlaySurvivor } : {}),
2431
+ primaryExternalRef: externalRef,
2432
+ primaryRefKey,
2433
+ providerSurvivor,
2434
+ survivorPath: entry.relativePath,
2435
+ };
2436
+ }
2437
+ function applyJunctionDailyAggregateAliasRepairToIndex(plan, index) {
2438
+ const survivor = plan.overlaySurvivor ?? plan.providerSurvivor;
2439
+ index.latestByRefKey.set(plan.primaryRefKey, {
2440
+ indexedExternalRef: plan.primaryExternalRef,
2441
+ indexedRecord: plan.providerSurvivor,
2442
+ relativePath: plan.survivorPath,
2443
+ record: survivor,
2444
+ });
2445
+ index.latestByRefKey.delete(plan.legacyRefKey);
2446
+ index.latestById.set(survivor.id, survivor);
2447
+ index.latestById.set(plan.loserTombstone.id, plan.loserTombstone);
2448
+ index.liveOwnerIdsByRefKey.set(plan.primaryRefKey, new Set([survivor.id]));
2449
+ index.liveOwnerIdsByRefKey.delete(plan.legacyRefKey);
2450
+ for (const record of [
2451
+ plan.providerSurvivor,
2452
+ ...(plan.overlaySurvivor ? [plan.overlaySurvivor] : []),
2453
+ plan.loserTombstone,
2454
+ ]) {
2455
+ const revision = eventSpineRevision(record);
2456
+ index.maxRevisionById.set(record.id, revision);
2457
+ const revisions = index.revisionsById.get(record.id) ?? new Set();
2458
+ revisions.add(revision);
2459
+ index.revisionsById.set(record.id, revisions);
2460
+ const history = index.aliasRepairHistoryById.get(record.id) ?? [];
2461
+ history.push({
2462
+ relativePath: record.id === plan.loserTombstone.id
2463
+ ? plan.loserPath
2464
+ : plan.survivorPath,
2465
+ record,
2466
+ });
2467
+ index.aliasRepairHistoryById.set(record.id, history);
2468
+ }
2469
+ }
1275
2470
  function whoopSleepTypeProviderBaselineRevision(index, refKey, eventId, incoming) {
1276
2471
  if (incoming.kind !== "sleep_session"
1277
2472
  || incoming.externalRef?.system !== "whoop"
@@ -1314,6 +2509,7 @@ function resolveDeviceEventIdentity(entry, context, options = {}) {
1314
2509
  const primaryMatch = reservedForLegacyClaim && reservedForLegacyClaim.entry !== entry
1315
2510
  ? undefined
1316
2511
  : index.latestByRefKey.get(refKey);
2512
+ const explicitLegacyRefKeys = new Set(entry.legacyExternalRefs.map((legacyExternalRef) => eventExternalRefKey(legacyExternalRef)));
1317
2513
  const legacyMatchedEntries = entry.legacyExternalRefs
1318
2514
  .map((legacyExternalRef) => ({
1319
2515
  legacyExternalRef,
@@ -1338,9 +2534,18 @@ function resolveDeviceEventIdentity(entry, context, options = {}) {
1338
2534
  return (!reservation || reservation.entry === entry)
1339
2535
  && isCompatibleLegacyExternalRefMatch(match.indexedMatch, entry.record, match.legacyExternalRef);
1340
2536
  });
2537
+ const implicitReservedEntries = [...legacyReservations.entries()]
2538
+ .filter(([reservedRefKey, reservation]) => reservation.entry === entry
2539
+ && reservedRefKey !== refKey
2540
+ && !explicitLegacyRefKeys.has(reservedRefKey))
2541
+ .map(([reservedRefKey, reservation]) => ({
2542
+ refKey: reservedRefKey,
2543
+ indexedMatch: reservation.indexedMatch,
2544
+ }));
1341
2545
  const matchedEntries = [
1342
2546
  ...(primaryMatch ? [{ refKey, indexedMatch: primaryMatch }] : []),
1343
2547
  ...legacyMatchedEntries,
2548
+ ...implicitReservedEntries,
1344
2549
  ];
1345
2550
  const selectedPrimaryMatch = matchedEntries.find((match) => match.refKey === refKey);
1346
2551
  const latest = selectedPrimaryMatch?.indexedMatch.record ?? matchedEntries[0]?.indexedMatch.record;
@@ -1447,6 +2652,8 @@ function mapCurrentDeviceEventOwners(entries, context) {
1447
2652
  ? []
1448
2653
  : resolved.matchedEntries.map(({ indexedMatch }) => compareIncomingExternalRefVersion(indexedMatch.indexedExternalRef, incomingExternalRef)).filter((comparison) => comparison !== null);
1449
2654
  const incomingHasEqualOrNewerComparableVersion = sourceVersionComparisons.some((comparison) => comparison >= 0);
2655
+ const incomingHasOnlyOlderComparableVersions = sourceVersionComparisons.length > 0
2656
+ && !incomingHasEqualOrNewerComparableVersion;
1450
2657
  if (sourceVersionComparisons.some((comparison) => comparison > 0)) {
1451
2658
  incomingNewerPreparedIds.add(entry.record.id);
1452
2659
  }
@@ -1456,6 +2663,7 @@ function mapCurrentDeviceEventOwners(entries, context) {
1456
2663
  historicallyDeliveredPreparedIds.add(entry.record.id);
1457
2664
  }
1458
2665
  if (resolved.associationSafe
2666
+ && !incomingHasOnlyOlderComparableVersions
1459
2667
  && !isDeletedEventSpineRecord(current)
1460
2668
  && deviceEventContentKey(current) === deviceEventContentKey(entry.record)) {
1461
2669
  associationSafePreparedIds.add(entry.record.id);
@@ -1479,18 +2687,63 @@ function mapCurrentDeviceEventOwners(entries, context) {
1479
2687
  // skipped; changed content normally appends an event-spine revision onto the
1480
2688
  // existing event id instead of a new event. Callers may mark a capture's
1481
2689
  // externalRef immutable when changed content must be rejected instead.
1482
- async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, existingContext, preferredCanonicalIdByPreparedId = new Map()) {
2690
+ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, existingContext, preferredCanonicalIdByPreparedId = new Map(), authoritativeEventSets = [], aliasRepairContext) {
1483
2691
  assertCanonicalWriteLockScope(vaultRoot);
1484
2692
  const context = existingContext ?? await buildDeviceEventIdentityContext(vaultRoot, entries);
1485
2693
  const { index } = context;
1486
2694
  const appendEntries = [];
1487
2695
  const appendRecordIdByPreparedRecordId = new Map();
1488
- const records = [];
2696
+ const recordsByEntryIndex = new Map();
1489
2697
  const forceAppendIds = new Set();
1490
2698
  const retainedPreparedIds = new Set();
1491
2699
  let skippedDuplicateCount = 0;
1492
2700
  let supersededCount = 0;
1493
- for (const entry of entries) {
2701
+ let retractedCount = 0;
2702
+ const aliasRepairByEntryIndex = new Map();
2703
+ for (const [entryIndex, entry] of entries.entries()) {
2704
+ const aliasRepair = buildJunctionDailyAggregateAliasRepairPlan({
2705
+ aliasRepairContext,
2706
+ context,
2707
+ entry,
2708
+ });
2709
+ if (aliasRepair) {
2710
+ aliasRepairByEntryIndex.set(entryIndex, aliasRepair);
2711
+ }
2712
+ }
2713
+ const aliasRepairOwnerIds = new Set();
2714
+ for (const aliasRepair of aliasRepairByEntryIndex.values()) {
2715
+ for (const ownerId of [
2716
+ aliasRepair.providerSurvivor.id,
2717
+ aliasRepair.loserTombstone.id,
2718
+ ]) {
2719
+ if (aliasRepairOwnerIds.has(ownerId)) {
2720
+ throw new VaultError("EVENT_ALIAS_REPAIR_OWNER_REFUSED", "Junction daily aggregate alias repair operations cannot share persisted owners.");
2721
+ }
2722
+ aliasRepairOwnerIds.add(ownerId);
2723
+ }
2724
+ }
2725
+ for (const [entryIndex, aliasRepair] of aliasRepairByEntryIndex) {
2726
+ const entry = entries[entryIndex];
2727
+ appendEntries.push({ relativePath: aliasRepair.survivorPath, record: aliasRepair.providerSurvivor }, { relativePath: aliasRepair.loserPath, record: aliasRepair.loserTombstone });
2728
+ if (aliasRepair.overlaySurvivor) {
2729
+ appendEntries.push({
2730
+ relativePath: aliasRepair.survivorPath,
2731
+ record: aliasRepair.overlaySurvivor,
2732
+ });
2733
+ }
2734
+ appendRecordIdByPreparedRecordId.set(entry.record.id, aliasRepair.providerSurvivor.id);
2735
+ forceAppendIds.add(aliasRepair.providerSurvivor.id);
2736
+ forceAppendIds.add(aliasRepair.loserTombstone.id);
2737
+ recordsByEntryIndex.set(entryIndex, aliasRepair.overlaySurvivor ?? aliasRepair.providerSurvivor);
2738
+ applyJunctionDailyAggregateAliasRepairToIndex(aliasRepair, index);
2739
+ supersededCount += 1;
2740
+ retractedCount += 1;
2741
+ }
2742
+ for (const [entryIndex, originalEntry] of entries.entries()) {
2743
+ if (aliasRepairByEntryIndex.has(entryIndex)) {
2744
+ continue;
2745
+ }
2746
+ let entry = originalEntry;
1494
2747
  const externalRef = entry.record.externalRef;
1495
2748
  if (!externalRef) {
1496
2749
  const current = index.latestById.get(entry.record.id);
@@ -1499,20 +2752,25 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1499
2752
  && deviceEventContentKey(current) === deviceEventContentKey(entry.record)) {
1500
2753
  skippedDuplicateCount += 1;
1501
2754
  retainedPreparedIds.add(entry.record.id);
1502
- records.push(current);
2755
+ recordsByEntryIndex.set(entryIndex, current);
1503
2756
  continue;
1504
2757
  }
1505
2758
  appendEntries.push(entry);
1506
2759
  appendRecordIdByPreparedRecordId.set(entry.record.id, entry.record.id);
1507
- records.push(entry.record);
2760
+ recordsByEntryIndex.set(entryIndex, entry.record);
1508
2761
  continue;
1509
2762
  }
1510
2763
  const resolved = resolveDeviceEventIdentity(entry, context, { strict: true });
1511
2764
  if (!resolved) {
1512
2765
  throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", "Device event identity unexpectedly lost its externalRef during reconciliation.");
1513
2766
  }
2767
+ if (resolved.latest && aliasRepairOwnerIds.has(resolved.latest.id)) {
2768
+ throw new VaultError("EVENT_ALIAS_REPAIR_OWNER_REFUSED", "Junction daily aggregate alias repair operations cannot share persisted owners.");
2769
+ }
1514
2770
  const { matchedEntries, refKey } = resolved;
1515
2771
  let latest = resolved.latest;
2772
+ const migratesJunctionNoIdProfileIdentity = isIncomingJunctionNoIdProfile(entry.record)
2773
+ && matchedEntries.some((match) => match.refKey !== refKey);
1516
2774
  if (!latest) {
1517
2775
  const canonicalRecordId = preferredCanonicalIdByPreparedId.get(entry.record.id)
1518
2776
  ?? entry.record.id;
@@ -1522,9 +2780,59 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1522
2780
  index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(canonicalRecord, externalRef));
1523
2781
  appendEntries.push({ relativePath: entry.relativePath, record: canonicalRecord });
1524
2782
  appendRecordIdByPreparedRecordId.set(entry.record.id, canonicalRecord.id);
1525
- records.push(canonicalRecord);
2783
+ recordsByEntryIndex.set(entryIndex, canonicalRecord);
2784
+ continue;
2785
+ }
2786
+ const indexedProviderMatch = matchedEntries.find((match) => match.indexedMatch.record.id === latest.id)?.indexedMatch ?? matchedEntries[0]?.indexedMatch;
2787
+ const replaysJunctionNoIdProfileTimestamp = indexedProviderMatch !== undefined
2788
+ && isJunctionNoIdProfileEqualRevisionTimestampReplay(indexedProviderMatch.indexedRecord, entry.record);
2789
+ if (replaysJunctionNoIdProfileTimestamp) {
2790
+ skippedDuplicateCount += 1;
2791
+ retainedPreparedIds.add(entry.record.id);
2792
+ recordsByEntryIndex.set(entryIndex, latest);
1526
2793
  continue;
1527
2794
  }
2795
+ const matchesIndexedProviderContent = indexedProviderMatch !== undefined
2796
+ && deviceEventContentKey(indexedProviderMatch.indexedRecord)
2797
+ === deviceEventContentKey(entry.record);
2798
+ const indexedSourceVersionComparison = indexedProviderMatch
2799
+ ? compareIncomingExternalRefVersion(indexedProviderMatch.indexedExternalRef, externalRef)
2800
+ : null;
2801
+ const migratesJunctionStableProfileTimestamp = indexedProviderMatch !== undefined
2802
+ && isJunctionStableProfileCreatedAtTimestampMigration(indexedProviderMatch.indexedRecord, entry.record);
2803
+ const retainsDeletedJunctionStableProfile = isMemberDeletedJunctionStableProfile(latest, entry.record);
2804
+ if (isDeletedEventSpineRecord(latest)
2805
+ && (migratesJunctionStableProfileTimestamp || retainsDeletedJunctionStableProfile)) {
2806
+ skippedDuplicateCount += 1;
2807
+ retainedPreparedIds.add(entry.record.id);
2808
+ recordsByEntryIndex.set(entryIndex, latest);
2809
+ continue;
2810
+ }
2811
+ const authoritativeSet = authoritativeEventSets.find((set) => externalRef.system === set.system
2812
+ && externalRef.resourceType === set.resourceType
2813
+ && externalRef.resourceId === set.resourceId
2814
+ && externalRef.facet !== undefined
2815
+ && set.currentFacets.has(externalRef.facet));
2816
+ if (authoritativeSet) {
2817
+ const sourceVersionComparison = compareIncomingExternalRefVersion(matchedEntries.find((match) => match.refKey === refKey)?.indexedMatch.indexedExternalRef
2818
+ ?? matchedEntries[0]?.indexedMatch.indexedExternalRef
2819
+ ?? latest.externalRef
2820
+ ?? externalRef, externalRef);
2821
+ if (sourceVersionComparison !== null && sourceVersionComparison < 0) {
2822
+ skippedDuplicateCount += 1;
2823
+ recordsByEntryIndex.set(entryIndex, latest);
2824
+ continue;
2825
+ }
2826
+ if (sourceVersionComparison === 0
2827
+ && (isDeletedEventSpineRecord(latest)
2828
+ || deviceEventContentKey(latest) !== deviceEventContentKey(entry.record))
2829
+ && !matchesIndexedProviderContent
2830
+ && !migratesJunctionStableProfileTimestamp) {
2831
+ throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Authoritative device event externalRef "${externalRef.system}/${externalRef.resourceType}/` +
2832
+ `${externalRef.resourceId}#${externalRef.facet}" has conflicting content for source revision ` +
2833
+ `"${authoritativeSet.version}"; nothing was imported.`);
2834
+ }
2835
+ }
1528
2836
  // externalRef identity does not include kind. Event spines are kind-stable,
1529
2837
  // so device reconciliation must reject under-faceted provider refs instead
1530
2838
  // of rewriting an existing event id as a different event kind.
@@ -1533,24 +2841,111 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1533
2841
  `${externalRef.facet ? `#${externalRef.facet}` : ""}" already belongs to kind ` +
1534
2842
  `"${latest.kind}" and cannot be rewritten as "${entry.record.kind}"; nothing was imported.`);
1535
2843
  }
1536
- if (deviceEventContentKey(latest) === deviceEventContentKey(entry.record)) {
2844
+ // An unversioned member declared current by this batch's authoritative set
2845
+ // reasserts a retracted facet in serialized arrival order rather than
2846
+ // treating the tombstone's identical content as an exact replay. Ordinary
2847
+ // versionless deliveries without complete-set authority never resurrect.
2848
+ // Only provider-owned authoritative-set retractions may be reasserted.
2849
+ // Their tombstones carry the set's explicit version marker on the external
2850
+ // reference, while a member deletion preserves the member's unversioned
2851
+ // reference and must stay deleted under authoritative replay.
2852
+ const reassertsUnversionedSetMember = Boolean(authoritativeSet
2853
+ && indexedSourceVersionComparison === null
2854
+ && isDeletedEventSpineRecord(latest)
2855
+ && latest.source === "device"
2856
+ && latest.externalRef?.version !== undefined);
2857
+ if (deviceEventContentKey(latest) === deviceEventContentKey(entry.record)
2858
+ && (indexedSourceVersionComparison === null || indexedSourceVersionComparison === 0)
2859
+ && !reassertsUnversionedSetMember) {
1537
2860
  skippedDuplicateCount += 1;
1538
2861
  retainedPreparedIds.add(entry.record.id);
1539
- records.push(latest);
2862
+ recordsByEntryIndex.set(entryIndex, latest);
1540
2863
  continue;
1541
2864
  }
1542
- const indexedProviderMatch = matchedEntries.find((match) => match.indexedMatch.record.id === latest.id)?.indexedMatch ?? matchedEntries[0]?.indexedMatch;
1543
- if (indexedProviderMatch
1544
- && deviceEventContentKey(indexedProviderMatch.indexedRecord)
1545
- === deviceEventContentKey(entry.record)) {
1546
- skippedDuplicateCount += 1;
1547
- retainedPreparedIds.add(entry.record.id);
1548
- records.push(latest);
1549
- continue;
2865
+ if (matchesIndexedProviderContent && !reassertsUnversionedSetMember) {
2866
+ const historicalUserEditMatch = matchedEntries.find((match) => hasHistoricalExternalRefUserAuthoredChanges(match.indexedMatch));
2867
+ if (historicalUserEditMatch
2868
+ && indexedSourceVersionComparison !== null
2869
+ && indexedSourceVersionComparison > 0) {
2870
+ const providerRevision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
2871
+ const providerBaseline = {
2872
+ ...entry.record,
2873
+ id: latest.id,
2874
+ lifecycle: buildEventSpineLifecycle(providerRevision),
2875
+ };
2876
+ const retainedMemberRevision = {
2877
+ ...latest,
2878
+ ...(migratesJunctionNoIdProfileIdentity
2879
+ ? { externalRef, dataOrigin: entry.record.dataOrigin }
2880
+ : {}),
2881
+ lifecycle: buildEventSpineLifecycle(providerRevision + 1),
2882
+ };
2883
+ const retainedMemberPath = historicalUserEditMatch.indexedMatch.relativePath
2884
+ || toEventLedgerFile(latest.occurredAt);
2885
+ forceAppendIds.add(latest.id);
2886
+ index.latestByRefKey.set(refKey, {
2887
+ indexedExternalRef: externalRef,
2888
+ indexedRecord: providerBaseline,
2889
+ relativePath: retainedMemberPath,
2890
+ record: retainedMemberRevision,
2891
+ });
2892
+ for (const { refKey: matchedRefKey, indexedMatch } of matchedEntries) {
2893
+ const currentMatch = index.latestByRefKey.get(matchedRefKey);
2894
+ if (matchedRefKey !== refKey
2895
+ && indexedMatch.record.id === latest.id
2896
+ && currentMatch?.record.id === latest.id) {
2897
+ index.latestByRefKey.delete(matchedRefKey);
2898
+ }
2899
+ }
2900
+ index.maxRevisionById.set(latest.id, providerRevision + 1);
2901
+ appendEntries.push({ relativePath: entry.relativePath, record: providerBaseline });
2902
+ appendEntries.push({
2903
+ relativePath: retainedMemberPath,
2904
+ record: retainedMemberRevision,
2905
+ });
2906
+ appendRecordIdByPreparedRecordId.set(entry.record.id, providerBaseline.id);
2907
+ recordsByEntryIndex.set(entryIndex, retainedMemberRevision);
2908
+ supersededCount += 1;
2909
+ continue;
2910
+ }
2911
+ if (indexedSourceVersionComparison === null || indexedSourceVersionComparison === 0) {
2912
+ skippedDuplicateCount += 1;
2913
+ retainedPreparedIds.add(entry.record.id);
2914
+ recordsByEntryIndex.set(entryIndex, latest);
2915
+ continue;
2916
+ }
1550
2917
  }
1551
2918
  if (entry.externalRefUpdatePolicy === "immutable") {
1552
2919
  throw new VaultError("EVENT_IMMUTABLE_EXTERNAL_REF_CONFLICT", "Immutable device event externalRef already exists with different content; nothing was imported.");
1553
2920
  }
2921
+ if (indexedProviderMatch
2922
+ && isJunctionSparseIntervalExternalRef(indexedProviderMatch.indexedExternalRef)
2923
+ && isJunctionSparseIntervalExternalRef(externalRef)
2924
+ && (indexedProviderMatch.indexedExternalRef.version !== undefined
2925
+ || externalRef.version !== undefined)) {
2926
+ const sourceVersionComparison = compareIncomingExternalRefVersion(indexedProviderMatch.indexedExternalRef, externalRef);
2927
+ if (sourceVersionComparison === null) {
2928
+ const incomingVersion = externalRef.version;
2929
+ const existingVersion = indexedProviderMatch.indexedExternalRef.version;
2930
+ const replacesUnorderedBaseline = incomingVersion !== undefined
2931
+ && isWritableIsoDateTime(incomingVersion)
2932
+ && (existingVersion === undefined || !isWritableIsoDateTime(existingVersion));
2933
+ if (!replacesUnorderedBaseline) {
2934
+ throw new VaultError("EVENT_SOURCE_REVISION_UNORDERED", "Changed Junction sparse intervals require comparable explicit provider revisions; nothing was imported.");
2935
+ }
2936
+ }
2937
+ if (sourceVersionComparison !== null && sourceVersionComparison < 0) {
2938
+ skippedDuplicateCount += 1;
2939
+ if (eventSpineRevisionsAreComplete(index, latest.id)) {
2940
+ retainedPreparedIds.add(entry.record.id);
2941
+ }
2942
+ recordsByEntryIndex.set(entryIndex, latest);
2943
+ continue;
2944
+ }
2945
+ if (sourceVersionComparison === 0) {
2946
+ throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", "Junction sparse interval content conflicts at the same provider revision; nothing was imported.");
2947
+ }
2948
+ }
1554
2949
  if (indexedProviderMatch
1555
2950
  && indexedProviderMatch.indexedExternalRef.system === "whoop"
1556
2951
  && externalRef.system === "whoop") {
@@ -1560,7 +2955,7 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1560
2955
  if (eventSpineRevisionsAreComplete(index, latest.id)) {
1561
2956
  retainedPreparedIds.add(entry.record.id);
1562
2957
  }
1563
- records.push(latest);
2958
+ recordsByEntryIndex.set(entryIndex, latest);
1564
2959
  continue;
1565
2960
  }
1566
2961
  const sleepTypeBaselineRevision = sourceVersionComparison === 0
@@ -1586,7 +2981,7 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1586
2981
  if (eventSpineRevisionsAreComplete(index, latest.id)) {
1587
2982
  retainedPreparedIds.add(entry.record.id);
1588
2983
  }
1589
- records.push(latest);
2984
+ recordsByEntryIndex.set(entryIndex, latest);
1590
2985
  continue;
1591
2986
  }
1592
2987
  }
@@ -1597,37 +2992,87 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1597
2992
  if (eventSpineRevisionsAreComplete(index, latest.id)) {
1598
2993
  retainedPreparedIds.add(entry.record.id);
1599
2994
  }
1600
- records.push(latest);
2995
+ recordsByEntryIndex.set(entryIndex, latest);
1601
2996
  continue;
1602
2997
  }
1603
- if (isDeletedEventSpineRecord(latest)) {
2998
+ const replaysProviderOwnedRetractionWithoutSetAuthority = Boolean(isDeletedEventSpineRecord(latest)
2999
+ && latest.source === "device"
3000
+ && latest.externalRef?.version !== undefined
3001
+ && externalRef.version === undefined
3002
+ && !authoritativeSet);
3003
+ if (replaysProviderOwnedRetractionWithoutSetAuthority) {
3004
+ skippedDuplicateCount += 1;
3005
+ retainedPreparedIds.add(entry.record.id);
3006
+ recordsByEntryIndex.set(entryIndex, latest);
3007
+ continue;
3008
+ }
3009
+ if (isDeletedEventSpineRecord(latest) && !reassertsUnversionedSetMember) {
3010
+ // A member-authored deletion tombstone (unversioned reference) stays
3011
+ // dead under authoritative replay: no append, no index change, so a
3012
+ // later empty-then-populated cadence cannot launder the deletion away.
3013
+ if (authoritativeSet && indexedSourceVersionComparison === null) {
3014
+ skippedDuplicateCount += 1;
3015
+ retainedPreparedIds.add(entry.record.id);
3016
+ recordsByEntryIndex.set(entryIndex, latest);
3017
+ continue;
3018
+ }
1604
3019
  index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(entry.record, externalRef));
1605
3020
  appendEntries.push(entry);
1606
3021
  appendRecordIdByPreparedRecordId.set(entry.record.id, entry.record.id);
1607
- records.push(entry.record);
3022
+ recordsByEntryIndex.set(entryIndex, entry.record);
1608
3023
  continue;
1609
3024
  }
3025
+ // A member declared current by this batch's authoritative set falls
3026
+ // through to the superseding append below, so the reassertion lands as
3027
+ // the next serialized event-spine revision over the retraction tombstone.
1610
3028
  if (shouldKeepExistingJunctionSleepStageSummaryObservation(latest, entry.record)) {
1611
3029
  if (eventSpineRevisionsAreComplete(index, latest.id)) {
1612
3030
  retainedPreparedIds.add(entry.record.id);
1613
3031
  }
1614
- records.push(latest);
3032
+ recordsByEntryIndex.set(entryIndex, latest);
1615
3033
  continue;
1616
3034
  }
1617
3035
  const historicalUserEditMatch = matchedEntries.find((match) => hasHistoricalExternalRefUserAuthoredChanges(match.indexedMatch));
1618
- if (historicalUserEditMatch) {
1619
- throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Event externalRef "${externalRef.system}/${externalRef.resourceType}/${externalRef.resourceId}` +
1620
- `${externalRef.facet ? `#${externalRef.facet}` : ""}" matched a historical provider identity ` +
1621
- "whose latest event revision contains user-authored changes; merge must be repaired explicitly.");
1622
- }
1623
3036
  const revision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
1624
3037
  const superseding = {
1625
3038
  ...entry.record,
1626
3039
  id: latest.id,
1627
3040
  lifecycle: buildEventSpineLifecycle(revision),
1628
3041
  };
3042
+ const migratesRetainedMemberOccurrence = migratesJunctionStableProfileTimestamp
3043
+ && indexedProviderMatch !== undefined
3044
+ && latest.occurredAt === indexedProviderMatch.indexedRecord.occurredAt
3045
+ && latest.dayKey === indexedProviderMatch.indexedRecord.dayKey;
3046
+ const retainedMemberRevision = historicalUserEditMatch
3047
+ ? {
3048
+ ...latest,
3049
+ ...(migratesJunctionStableProfileTimestamp
3050
+ ? {
3051
+ ...(migratesRetainedMemberOccurrence
3052
+ ? { occurredAt: entry.record.occurredAt, dayKey: entry.record.dayKey }
3053
+ : {}),
3054
+ externalRef,
3055
+ dataOrigin: entry.record.dataOrigin,
3056
+ }
3057
+ : migratesJunctionNoIdProfileIdentity
3058
+ ? { externalRef, dataOrigin: entry.record.dataOrigin }
3059
+ : {}),
3060
+ lifecycle: buildEventSpineLifecycle(revision + 1),
3061
+ }
3062
+ : null;
3063
+ const retainedMemberPath = migratesRetainedMemberOccurrence
3064
+ ? entry.relativePath
3065
+ : historicalUserEditMatch?.indexedMatch.relativePath
3066
+ || toEventLedgerFile(latest.occurredAt);
1629
3067
  forceAppendIds.add(latest.id);
1630
- index.latestByRefKey.set(refKey, toIndexedExternalRefMatch(superseding, externalRef));
3068
+ index.latestByRefKey.set(refKey, retainedMemberRevision
3069
+ ? {
3070
+ indexedExternalRef: externalRef,
3071
+ indexedRecord: superseding,
3072
+ relativePath: retainedMemberPath,
3073
+ record: retainedMemberRevision,
3074
+ }
3075
+ : toIndexedExternalRefMatch(superseding, externalRef));
1631
3076
  for (const { refKey: matchedRefKey, indexedMatch } of matchedEntries) {
1632
3077
  const currentMatch = index.latestByRefKey.get(matchedRefKey);
1633
3078
  if (matchedRefKey !== refKey &&
@@ -1636,12 +3081,87 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1636
3081
  index.latestByRefKey.delete(matchedRefKey);
1637
3082
  }
1638
3083
  }
1639
- index.maxRevisionById.set(latest.id, revision);
3084
+ index.maxRevisionById.set(latest.id, retainedMemberRevision ? revision + 1 : revision);
1640
3085
  appendEntries.push({ relativePath: entry.relativePath, record: superseding });
3086
+ if (retainedMemberRevision) {
3087
+ appendEntries.push({ relativePath: retainedMemberPath, record: retainedMemberRevision });
3088
+ }
1641
3089
  appendRecordIdByPreparedRecordId.set(entry.record.id, superseding.id);
1642
- records.push(superseding);
3090
+ recordsByEntryIndex.set(entryIndex, retainedMemberRevision ?? superseding);
1643
3091
  supersededCount += 1;
1644
3092
  }
3093
+ for (const set of authoritativeEventSets) {
3094
+ const ownsFacet = (facet) => set.facetPrefixes.some((prefix) => facet === prefix || facet.startsWith(`${prefix}-`));
3095
+ const candidates = [...index.latestByRefKey.entries()].filter(([, match]) => {
3096
+ const externalRef = match.record.externalRef;
3097
+ return externalRef?.system === set.system
3098
+ && externalRef.resourceType === set.resourceType
3099
+ && externalRef.resourceId === set.resourceId
3100
+ && typeof externalRef.facet === "string"
3101
+ && ownsFacet(externalRef.facet)
3102
+ && !set.currentFacets.has(externalRef.facet)
3103
+ && !isDeletedEventSpineRecord(match.record);
3104
+ });
3105
+ for (const [refKey, latestMatch] of candidates) {
3106
+ const latest = latestMatch.record;
3107
+ const latestRef = latest.externalRef;
3108
+ if (!latestRef?.facet) {
3109
+ continue;
3110
+ }
3111
+ const incomingRef = { ...latestRef, version: set.version };
3112
+ const sourceVersionComparison = compareIncomingExternalRefVersion(latestMatch.indexedExternalRef, incomingRef);
3113
+ if (sourceVersionComparison !== null && sourceVersionComparison < 0) {
3114
+ continue;
3115
+ }
3116
+ if (sourceVersionComparison === 0
3117
+ && isDeletedEventSpineRecord(latestMatch.indexedRecord)) {
3118
+ continue;
3119
+ }
3120
+ if (sourceVersionComparison === 0) {
3121
+ throw new VaultError("EVENT_SOURCE_REVISION_CONFLICT", `Authoritative device event externalRef "${set.system}/${set.resourceType}/` +
3122
+ `${set.resourceId}#${latestRef.facet}" has conflicting membership for source revision ` +
3123
+ `"${set.version}"; nothing was imported.`);
3124
+ }
3125
+ const hasMemberEdit = hasHistoricalExternalRefUserAuthoredChanges(latestMatch);
3126
+ const revision = Math.max(eventSpineRevision(latest), index.maxRevisionById.get(latest.id) ?? 0) + 1;
3127
+ const tombstone = {
3128
+ ...latestMatch.indexedRecord,
3129
+ source: "device",
3130
+ recordedAt: set.version,
3131
+ externalRef: incomingRef,
3132
+ lifecycle: buildEventSpineLifecycle(revision, "deleted"),
3133
+ };
3134
+ const retainedMemberRevision = hasMemberEdit
3135
+ ? {
3136
+ ...latest,
3137
+ lifecycle: buildEventSpineLifecycle(revision + 1),
3138
+ }
3139
+ : null;
3140
+ const latestPath = latestMatch.relativePath || toEventLedgerFile(latest.occurredAt);
3141
+ forceAppendIds.add(latest.id);
3142
+ index.latestByRefKey.set(refKey, retainedMemberRevision
3143
+ ? {
3144
+ indexedExternalRef: incomingRef,
3145
+ indexedRecord: tombstone,
3146
+ relativePath: latestPath,
3147
+ record: retainedMemberRevision,
3148
+ }
3149
+ : toIndexedExternalRefMatch(tombstone, incomingRef, latestPath));
3150
+ index.maxRevisionById.set(latest.id, retainedMemberRevision ? revision + 1 : revision);
3151
+ appendEntries.push({ relativePath: latestPath, record: tombstone });
3152
+ if (retainedMemberRevision) {
3153
+ appendEntries.push({ relativePath: latestPath, record: retainedMemberRevision });
3154
+ }
3155
+ retractedCount += 1;
3156
+ }
3157
+ }
3158
+ const records = entries.map((entry, entryIndex) => {
3159
+ const record = recordsByEntryIndex.get(entryIndex);
3160
+ if (!record) {
3161
+ throw new VaultError("EVENT_EXTERNAL_REF_ALIAS_CONFLICT", `Device event reconciliation did not produce a result for "${entry.record.id}".`);
3162
+ }
3163
+ return record;
3164
+ });
1645
3165
  return {
1646
3166
  appendEntries,
1647
3167
  appendRecordIdByPreparedRecordId,
@@ -1650,6 +3170,7 @@ async function reconcileDeviceEventEntriesByExternalRef(vaultRoot, entries, exis
1650
3170
  retainedPreparedIds,
1651
3171
  skippedDuplicateCount,
1652
3172
  supersededCount,
3173
+ retractedCount,
1653
3174
  };
1654
3175
  }
1655
3176
  // Public bulk import reconciles externalRef identity vault-wide, not per
@@ -1665,6 +3186,22 @@ async function reconcileEventImportDecisionsByExternalRef(vaultRoot, decisions,
1665
3186
  signal,
1666
3187
  });
1667
3188
  const index = await indexLatestEventsByExternalRef(vaultRoot, shardPaths, signal);
3189
+ for (const decision of decisions) {
3190
+ signal?.throwIfAborted();
3191
+ if (decision.action !== "upsert" || !decision.expectedLatest) {
3192
+ continue;
3193
+ }
3194
+ const externalRef = decision.entry.record.externalRef;
3195
+ const latestById = index.latestById.get(decision.expectedLatest.eventId);
3196
+ const latestByRef = externalRef
3197
+ ? index.latestByRefKey.get(eventExternalRefKey(externalRef))?.record
3198
+ : undefined;
3199
+ if (!latestById
3200
+ || latestById.id !== latestByRef?.id
3201
+ || eventSpineRevision(latestById) !== decision.expectedLatest.lifecycleRevision) {
3202
+ throw new VaultError("EVENT_EXPECTED_LATEST_MISMATCH", "An imported event changed after it was inspected; the whole batch was rejected without writes.");
3203
+ }
3204
+ }
1668
3205
  const appendEntries = [];
1669
3206
  const forceAppendIds = new Set();
1670
3207
  const eventIds = [];
@@ -2003,6 +3540,9 @@ function buildDeviceBatchAuditSummary(input) {
2003
3540
  if (input.supersededCount > 0) {
2004
3541
  dedupeNotes.push(`${input.supersededCount} event(s) updated in place by externalRef`);
2005
3542
  }
3543
+ if (input.retractedCount > 0) {
3544
+ dedupeNotes.push(`${input.retractedCount} omitted authoritative event(s) retracted`);
3545
+ }
2006
3546
  const dedupeSuffix = dedupeNotes.length > 0 ? ` (${dedupeNotes.join(", ")})` : "";
2007
3547
  return `Imported ${input.provider} device batch with ${input.eventCount} event(s) and ${input.sampleCount} sample(s)${dedupeSuffix}.`;
2008
3548
  }
@@ -2034,7 +3574,7 @@ function buildLegacyReceiptFingerprint(receipt, provider) {
2034
3574
  sha256: createHash("sha256").update(content).digest("hex"),
2035
3575
  }];
2036
3576
  }
2037
- function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(), defaultTimeZone: fallbackTimeZone, source = "device", events = [], samples = [], evidenceParts = [], ingestReceipt, provenance, }) {
3577
+ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(), defaultTimeZone: fallbackTimeZone, source = "device", events = [], samples = [], evidenceParts = [], authoritativeEventSets = [], ingestReceipt, provenance, }) {
2038
3578
  const normalizedInputs = normalizeDeviceBatchInputs({
2039
3579
  provider,
2040
3580
  accountId,
@@ -2044,6 +3584,7 @@ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(),
2044
3584
  events,
2045
3585
  samples,
2046
3586
  evidenceParts,
3587
+ authoritativeEventSets,
2047
3588
  ingestReceipt,
2048
3589
  provenance,
2049
3590
  });
@@ -2080,6 +3621,18 @@ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(),
2080
3621
  receipt: compactedIngestReceipt ?? null,
2081
3622
  eventIds: normalizedInputs.events.map(({ recordId }) => recordId),
2082
3623
  sampleIds: normalizedInputs.samples.map(({ recordId }) => recordId),
3624
+ ...(normalizedInputs.authoritativeEventSets.length === 0
3625
+ ? {}
3626
+ : {
3627
+ authoritativeEventSets: normalizedInputs.authoritativeEventSets.map((set) => ({
3628
+ system: set.system,
3629
+ resourceType: set.resourceType,
3630
+ resourceId: set.resourceId,
3631
+ version: set.version,
3632
+ facetPrefixes: set.facetPrefixes,
3633
+ currentFacets: [...set.currentFacets].sort(),
3634
+ })),
3635
+ }),
2083
3636
  evidenceParts: fingerprint,
2084
3637
  }));
2085
3638
  const importId = buildImportId(rawArtifactFingerprint);
@@ -2101,10 +3654,399 @@ function prepareDeviceBatchPlan({ provider, accountId, importedAt = new Date(),
2101
3654
  evidenceRolesByPreparedRecordId: eventPlan.evidenceRolesByPreparedRecordId,
2102
3655
  preparedSamples,
2103
3656
  preparedEvidenceParts,
3657
+ authoritativeEventSets: normalizedInputs.authoritativeEventSets,
3658
+ };
3659
+ }
3660
+ async function hashSourceFile(sourcePath) {
3661
+ const hash = createHash("sha256");
3662
+ let byteLength = 0;
3663
+ await new Promise((resolve, reject) => {
3664
+ const stream = createReadStream(sourcePath);
3665
+ stream.on("data", (chunk) => {
3666
+ const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
3667
+ byteLength += bytes.byteLength;
3668
+ hash.update(bytes);
3669
+ });
3670
+ stream.on("error", reject);
3671
+ stream.on("end", resolve);
3672
+ });
3673
+ return { byteLength, sha256: hash.digest("hex") };
3674
+ }
3675
+ const DOCUMENT_SOURCE_AUDIT_COMMAND = "core.importDocument";
3676
+ const WORKOUT_SOURCE_IMPORT_AUDIT_COMMAND = "core.importEventBatch.sourceRawRefOnce";
3677
+ function buildRawSourceReceiptTarget(sourceReceipt) {
3678
+ return `raw-source-v1:sha256:${sourceReceipt.sha256}:bytes:${sourceReceipt.byteLength}`;
3679
+ }
3680
+ function rejectDamagedExactDocumentEvidence(input) {
3681
+ throw new VaultError("RAW_MANIFEST_INVALID", "Preserved exact source evidence is incomplete or damaged. Exact reuse will not create a replacement identity.", {
3682
+ documentId: input.documentId,
3683
+ ...(input.manifestPath ? { manifestPath: input.manifestPath } : {}),
3684
+ reason: input.reason,
3685
+ });
3686
+ }
3687
+ async function inspectExactSourceAuditEvidence(input) {
3688
+ const targetId = buildRawSourceReceiptTarget(input.sourceReceipt);
3689
+ const auditPaths = await walkVaultFiles(input.vaultRoot, VAULT_LAYOUT.auditDirectory, {
3690
+ extension: ".jsonl",
3691
+ });
3692
+ const completionTargetEventIds = new Set();
3693
+ const documentIdsByEventId = new Map();
3694
+ for (const relativePath of auditPaths) {
3695
+ for (const rawRecord of await readJsonlRecords({ vaultRoot: input.vaultRoot, relativePath })) {
3696
+ const parsed = safeParseContract(auditRecordSchema, rawRecord);
3697
+ if (!parsed.success
3698
+ || parsed.data.status !== "success"
3699
+ || parsed.data.targetIds?.includes(targetId) !== true) {
3700
+ continue;
3701
+ }
3702
+ const targetIds = parsed.data.targetIds;
3703
+ if (parsed.data.commandName === DOCUMENT_SOURCE_AUDIT_COMMAND) {
3704
+ let documentId;
3705
+ let eventId;
3706
+ try {
3707
+ if (targetIds.length !== 3 || targetIds[0] !== targetId) {
3708
+ throw new TypeError("source receipt audit must retain exactly one owner");
3709
+ }
3710
+ documentId = assertContractId(targetIds[1], ID_PREFIXES.document, "documentId");
3711
+ eventId = assertContractId(targetIds[2], ID_PREFIXES.event, "eventId");
3712
+ }
3713
+ catch {
3714
+ rejectDamagedExactDocumentEvidence({
3715
+ documentId: typeof targetIds[1] === "string" ? targetIds[1] : "unknown",
3716
+ reason: "source receipt audit does not retain one valid document owner",
3717
+ });
3718
+ }
3719
+ const existing = documentIdsByEventId.get(eventId);
3720
+ if (existing && existing !== documentId) {
3721
+ rejectDamagedExactDocumentEvidence({
3722
+ documentId,
3723
+ reason: "source receipt audit assigns one event to multiple document owners",
3724
+ });
3725
+ }
3726
+ documentIdsByEventId.set(eventId, documentId);
3727
+ continue;
3728
+ }
3729
+ if (parsed.data.commandName === WORKOUT_SOURCE_IMPORT_AUDIT_COMMAND) {
3730
+ for (const candidate of targetIds.slice(1)) {
3731
+ try {
3732
+ completionTargetEventIds.add(assertContractId(candidate, ID_PREFIXES.event, "eventId"));
3733
+ }
3734
+ catch {
3735
+ // The bounded audit target list may contain non-event context.
3736
+ }
3737
+ }
3738
+ }
3739
+ }
3740
+ }
3741
+ return { completionTargetEventIds, documentIdsByEventId };
3742
+ }
3743
+ async function inspectExactDocumentSourceSet(input) {
3744
+ const auditEvidence = await inspectExactSourceAuditEvidence(input);
3745
+ const emptyActivityIndex = new Map();
3746
+ if (auditEvidence.documentIdsByEventId.size === 0
3747
+ && auditEvidence.completionTargetEventIds.size === 0) {
3748
+ return {
3749
+ activityEventIdsByRawRef: emptyActivityIndex,
3750
+ completionAuditEventIds: new Set(),
3751
+ deletedExactSourceExists: false,
3752
+ liveSources: [],
3753
+ };
3754
+ }
3755
+ const shardPaths = await walkVaultFiles(input.vaultRoot, VAULT_LAYOUT.eventLedgerDirectory, {
3756
+ extension: ".jsonl",
3757
+ });
3758
+ const entries = [];
3759
+ const activityEventIds = new Set();
3760
+ const activityEventIdsByRawRef = new Map();
3761
+ for (const relativePath of shardPaths) {
3762
+ for (const rawRecord of await readJsonlRecords({ vaultRoot: input.vaultRoot, relativePath })) {
3763
+ const parsed = safeParseContract(eventRecordSchema, rawRecord);
3764
+ const rawEventId = typeof rawRecord === "object"
3765
+ && rawRecord !== null
3766
+ && "id" in rawRecord
3767
+ && typeof rawRecord.id === "string"
3768
+ ? rawRecord.id
3769
+ : null;
3770
+ if (!parsed.success) {
3771
+ if (rawEventId && auditEvidence.documentIdsByEventId.has(rawEventId)) {
3772
+ rejectDamagedExactDocumentEvidence({
3773
+ documentId: auditEvidence.documentIdsByEventId.get(rawEventId) ?? "unknown",
3774
+ reason: "source receipt audit points to a contract-invalid document event",
3775
+ });
3776
+ }
3777
+ continue;
3778
+ }
3779
+ if (parsed.data.kind === "document"
3780
+ && auditEvidence.documentIdsByEventId.has(parsed.data.id)) {
3781
+ entries.push({ relativePath, record: parsed.data });
3782
+ }
3783
+ if (parsed.data.kind === "activity_session") {
3784
+ activityEventIds.add(parsed.data.id);
3785
+ for (const rawRef of collectEventRawReferencePaths(parsed.data)) {
3786
+ const ids = activityEventIdsByRawRef.get(rawRef) ?? new Set();
3787
+ ids.add(parsed.data.id);
3788
+ activityEventIdsByRawRef.set(rawRef, ids);
3789
+ }
3790
+ }
3791
+ }
3792
+ }
3793
+ const completionAuditEventIds = new Set([...auditEvidence.completionTargetEventIds].filter((eventId) => activityEventIds.has(eventId)));
3794
+ if (auditEvidence.documentIdsByEventId.size === 0) {
3795
+ if (completionAuditEventIds.size > 0) {
3796
+ rejectDamagedExactDocumentEvidence({
3797
+ documentId: "unknown",
3798
+ reason: "whole-source completion survives without its source receipt owner",
3799
+ });
3800
+ }
3801
+ return {
3802
+ activityEventIdsByRawRef,
3803
+ completionAuditEventIds,
3804
+ deletedExactSourceExists: false,
3805
+ liveSources: [],
3806
+ };
3807
+ }
3808
+ // Exact-source identity needs the latest revision even when it is a
3809
+ // tombstone. The ordinary collapse helper intentionally removes deleted
3810
+ // records, which would make a deleted source look like it never existed.
3811
+ const latestDocuments = new Map();
3812
+ for (const entry of entries) {
3813
+ const current = latestDocuments.get(entry.record.id);
3814
+ if (!current || compareEventSpineEntries(current, entry) < 0) {
3815
+ latestDocuments.set(entry.record.id, entry);
3816
+ }
3817
+ }
3818
+ // The content-derived import audit owns source recreation identity. Its
3819
+ // document/event targets select the lifecycle row; that row derives the one
3820
+ // manifest and raw artifact to verify. No vault-wide manifest discovery or
3821
+ // compatibility reader participates in the decision.
3822
+ const claims = new Map();
3823
+ for (const [eventId, documentId] of auditEvidence.documentIdsByEventId) {
3824
+ let origin = null;
3825
+ let raw = null;
3826
+ for (const entry of entries) {
3827
+ if (entry.record.id !== eventId || entry.record.documentId !== documentId) {
3828
+ continue;
3829
+ }
3830
+ const candidateRaw = entry.record.attachments?.find((attachment) => attachment.role === "source_document"
3831
+ && attachment.sha256 === input.sourceReceipt.sha256);
3832
+ if (candidateRaw
3833
+ && (!origin || compareEventSpineEntries(entry, origin) < 0)) {
3834
+ origin = entry;
3835
+ raw = candidateRaw;
3836
+ }
3837
+ }
3838
+ if (!origin || !raw) {
3839
+ rejectDamagedExactDocumentEvidence({
3840
+ documentId,
3841
+ reason: "source receipt audit has no matching canonical document event",
3842
+ });
3843
+ }
3844
+ claims.set(eventId, { entry: origin, raw });
3845
+ }
3846
+ const verified = new Map();
3847
+ for (const claim of [...claims.values()]
3848
+ .sort((left, right) => left.entry.record.id.localeCompare(right.entry.record.id))) {
3849
+ const documentId = claim.entry.record.documentId;
3850
+ const manifestPath = resolveRawManifestPath({
3851
+ artifacts: [claim.raw],
3852
+ importId: documentId,
3853
+ importedAt: claim.entry.record.recordedAt,
3854
+ });
3855
+ const latest = latestDocuments.get(claim.entry.record.id);
3856
+ if (!latest
3857
+ || latest.record.documentId !== documentId
3858
+ || !claim.entry.record.rawRefs?.includes(claim.raw.relativePath)) {
3859
+ rejectDamagedExactDocumentEvidence({
3860
+ documentId,
3861
+ manifestPath,
3862
+ reason: "canonical document history does not retain one stable source owner",
3863
+ });
3864
+ }
3865
+ let manifestText;
3866
+ try {
3867
+ manifestText = await readUtf8File(input.vaultRoot, manifestPath);
3868
+ }
3869
+ catch (error) {
3870
+ if (error instanceof VaultError && error.code === "VAULT_FILE_MISSING") {
3871
+ rejectDamagedExactDocumentEvidence({
3872
+ documentId,
3873
+ manifestPath,
3874
+ reason: "required raw manifest is missing",
3875
+ });
3876
+ }
3877
+ throw error;
3878
+ }
3879
+ let manifest;
3880
+ try {
3881
+ manifest = parseRawImportManifest(JSON.parse(manifestText));
3882
+ }
3883
+ catch {
3884
+ rejectDamagedExactDocumentEvidence({
3885
+ documentId,
3886
+ manifestPath,
3887
+ reason: "required raw manifest is malformed",
3888
+ });
3889
+ }
3890
+ const sourceArtifacts = manifest.artifacts.filter((artifact) => artifact.role === "source_document");
3891
+ const artifact = sourceArtifacts[0];
3892
+ let resolvedManifestPath = null;
3893
+ try {
3894
+ resolvedManifestPath = resolveRawManifestPath({
3895
+ artifacts: manifest.artifacts,
3896
+ rawDirectory: manifest.rawDirectory,
3897
+ importId: manifest.importId,
3898
+ importedAt: manifest.importedAt,
3899
+ });
3900
+ }
3901
+ catch {
3902
+ // The shared resolver supplies the semantic owner/directory check below.
3903
+ }
3904
+ if (manifest.importKind !== "document"
3905
+ || manifest.importId !== documentId
3906
+ || manifest.importedAt !== claim.entry.record.recordedAt
3907
+ || manifest.owner.kind !== "document"
3908
+ || manifest.owner.id !== documentId
3909
+ || !rawDirectoryMatchesOwner(manifest.rawDirectory, manifest.owner)
3910
+ || resolvedManifestPath !== manifestPath
3911
+ || sourceArtifacts.length !== 1
3912
+ || !artifact
3913
+ || artifact.relativePath !== claim.raw.relativePath
3914
+ || artifact.originalFileName !== claim.raw.originalFileName
3915
+ || artifact.mediaType !== claim.raw.mediaType
3916
+ || artifact.byteSize !== input.sourceReceipt.byteLength
3917
+ || artifact.sha256 !== input.sourceReceipt.sha256) {
3918
+ rejectDamagedExactDocumentEvidence({
3919
+ documentId,
3920
+ manifestPath,
3921
+ reason: "raw manifest does not match its canonical document owner",
3922
+ });
3923
+ }
3924
+ const integrity = await statAndHashVaultFile(input.vaultRoot, artifact.relativePath);
3925
+ if (!integrity) {
3926
+ throw new VaultError("RAW_REFERENCE_MISSING", "Preserved exact source evidence is missing its immutable raw artifact. Exact reuse will not create a replacement identity.", { documentId, manifestPath, relativePath: artifact.relativePath });
3927
+ }
3928
+ if (integrity.byteSize !== artifact.byteSize
3929
+ || integrity.sha256 !== artifact.sha256) {
3930
+ rejectDamagedExactDocumentEvidence({
3931
+ documentId,
3932
+ manifestPath,
3933
+ reason: "raw artifact bytes do not match the immutable manifest",
3934
+ });
3935
+ }
3936
+ const latestRaw = latest.record.attachments?.find((attachment) => attachment.role === "source_document"
3937
+ && attachment.relativePath === artifact.relativePath
3938
+ && attachment.sha256 === artifact.sha256);
3939
+ if (!latest.record.rawRefs?.includes(artifact.relativePath) || !latestRaw) {
3940
+ rejectDamagedExactDocumentEvidence({
3941
+ documentId,
3942
+ manifestPath,
3943
+ reason: "latest document lifecycle no longer retains its source attachment",
3944
+ });
3945
+ }
3946
+ verified.set(claim.entry.record.id, {
3947
+ latest,
3948
+ manifestPath,
3949
+ raw: claim.raw,
3950
+ });
3951
+ }
3952
+ // A deleted identity must fence the whole exact-byte equivalence set. An
3953
+ // ordinary import may have created a live alias later, but returning that
3954
+ // alias would reset raw-reference-scoped workout completion.
3955
+ const deletedExactSourceExists = [...verified.values()].some(({ latest }) => isDeletedEventSpineRecord(latest.record));
3956
+ const liveSources = [];
3957
+ for (const stored of verified.values()) {
3958
+ const entry = stored.latest;
3959
+ if (isDeletedEventSpineRecord(entry.record)) {
3960
+ continue;
3961
+ }
3962
+ liveSources.push({
3963
+ rawRef: stored.raw.relativePath,
3964
+ result: {
3965
+ created: false,
3966
+ documentId: entry.record.documentId,
3967
+ raw: {
3968
+ relativePath: stored.raw.relativePath,
3969
+ originalFileName: stored.raw.originalFileName,
3970
+ mediaType: stored.raw.mediaType,
3971
+ },
3972
+ event: entry.record,
3973
+ eventPath: entry.relativePath,
3974
+ auditPath: null,
3975
+ manifestPath: stored.manifestPath,
3976
+ },
3977
+ });
3978
+ }
3979
+ return {
3980
+ activityEventIdsByRawRef,
3981
+ completionAuditEventIds,
3982
+ deletedExactSourceExists,
3983
+ liveSources,
3984
+ };
3985
+ }
3986
+ async function findExactDocumentImport(input) {
3987
+ const exactSources = await inspectExactDocumentSourceSet(input);
3988
+ if (exactSources.deletedExactSourceExists) {
3989
+ throw new VaultError("DOCUMENT_EXACT_SOURCE_DELETED", "An exact source document existed but was deleted. Exact reuse will not create a replacement identity.");
3990
+ }
3991
+ return exactSources.liveSources[0]?.result ?? null;
3992
+ }
3993
+ export const WORKOUT_SOURCE_IMPORT_STATUS_VALUES = [
3994
+ "not_imported",
3995
+ "completed",
3996
+ "partial_conflict",
3997
+ ];
3998
+ async function inspectWorkoutSourceImportStatus(input) {
3999
+ const sourceIntegrity = await statAndHashVaultFile(input.vaultRoot, input.rawRef);
4000
+ if (sourceIntegrity === null) {
4001
+ throw new VaultError("EVENT_BATCH_SOURCE_RAW_REF_MISSING", "The workout source does not exist as a vault file.");
4002
+ }
4003
+ const sourceReceipt = {
4004
+ byteLength: sourceIntegrity.byteSize,
4005
+ sha256: sourceIntegrity.sha256,
4006
+ };
4007
+ const exactSources = await inspectExactDocumentSourceSet({
4008
+ vaultRoot: input.vaultRoot,
4009
+ sourceReceipt,
4010
+ });
4011
+ if (!exactSources.liveSources.some((source) => source.rawRef === input.rawRef)) {
4012
+ throw new VaultError("EVENT_BATCH_SOURCE_DOCUMENT_NOT_LIVE", "The workout source is no longer owned by a live source document.");
4013
+ }
4014
+ if (exactSources.deletedExactSourceExists) {
4015
+ throw new VaultError("DOCUMENT_EXACT_SOURCE_DELETED", "An exact source document existed but was deleted. Workout import will not reuse a replacement identity.");
4016
+ }
4017
+ const completionTargetId = buildRawSourceReceiptTarget(sourceReceipt);
4018
+ const exactRawRefs = new Set(exactSources.liveSources.map((source) => source.rawRef));
4019
+ const sourceEventIds = new Set();
4020
+ for (const rawRef of exactRawRefs) {
4021
+ for (const eventId of exactSources.activityEventIdsByRawRef.get(rawRef) ?? []) {
4022
+ sourceEventIds.add(eventId);
4023
+ }
4024
+ }
4025
+ if ([...exactSources.completionAuditEventIds].some((eventId) => sourceEventIds.has(eventId))) {
4026
+ return { status: "completed", completionTargetId };
4027
+ }
4028
+ return {
4029
+ status: sourceEventIds.size > 0 ? "partial_conflict" : "not_imported",
4030
+ completionTargetId,
2104
4031
  };
2105
4032
  }
2106
- export async function importDocument({ vaultRoot, sourcePath, occurredAt = new Date(), title, note, source = "import", }) {
4033
+ export async function resolveWorkoutSourceImportStatus(input) {
4034
+ return (await inspectWorkoutSourceImportStatus(input)).status;
4035
+ }
4036
+ export async function importDocument({ vaultRoot, sourcePath, occurredAt = new Date(), title, note, source = "import", reuseExact = false, }) {
2107
4037
  const vault = await loadVault({ vaultRoot });
4038
+ const sourceReceipt = await hashSourceFile(sourcePath);
4039
+ if (reuseExact) {
4040
+ const existing = await findExactDocumentImport({ vaultRoot, sourceReceipt });
4041
+ if (existing) {
4042
+ const verifiedSourceReceipt = await hashSourceFile(sourcePath);
4043
+ if (verifiedSourceReceipt.byteLength !== sourceReceipt.byteLength
4044
+ || verifiedSourceReceipt.sha256 !== sourceReceipt.sha256) {
4045
+ throw new VaultError("DOCUMENT_SOURCE_CHANGED", "Document source changed while exact reuse was being verified.");
4046
+ }
4047
+ return existing;
4048
+ }
4049
+ }
2108
4050
  const documentId = generateRecordId(ID_PREFIXES.document);
2109
4051
  const eventId = generateRecordId(ID_PREFIXES.event);
2110
4052
  const preparedAttachments = prepareEventAttachments({
@@ -2116,6 +4058,7 @@ export async function importDocument({ vaultRoot, sourcePath, occurredAt = new D
2116
4058
  role: "source_document",
2117
4059
  kind: "document",
2118
4060
  sourcePath,
4061
+ expectedSourceReceipt: sourceReceipt,
2119
4062
  },
2120
4063
  ],
2121
4064
  });
@@ -2164,6 +4107,14 @@ export async function importDocument({ vaultRoot, sourcePath, occurredAt = new D
2164
4107
  if (!stagedAttachments) {
2165
4108
  throw new VaultError("EVENT_ATTACHMENTS_MISSING", "Document import expected one staged attachment.");
2166
4109
  }
4110
+ const stagedSourceAttachment = stagedAttachments.attachments.find((attachment) => attachment.role === "source_document");
4111
+ if (!stagedSourceAttachment) {
4112
+ throw new VaultError("EVENT_ATTACHMENTS_MISSING", "Document import expected one source attachment receipt.");
4113
+ }
4114
+ const sourceTargetId = buildRawSourceReceiptTarget({
4115
+ byteLength: sourceReceipt.byteLength,
4116
+ sha256: stagedSourceAttachment.sha256,
4117
+ });
2167
4118
  const event = prepareStoredEventLedgerEntry({
2168
4119
  ...eventSeed,
2169
4120
  rawRefs: stagedAttachments.rawRefs,
@@ -2182,9 +4133,10 @@ export async function importDocument({ vaultRoot, sourcePath, occurredAt = new D
2182
4133
  summary: `Imported document ${raw.originalFileName}.`,
2183
4134
  occurredAt,
2184
4135
  files: [raw.relativePath, manifestPath, event.relativePath],
2185
- targetIds: [documentId, event.record.id],
4136
+ targetIds: [sourceTargetId, documentId, event.record.id],
2186
4137
  });
2187
4138
  return {
4139
+ created: true,
2188
4140
  documentId,
2189
4141
  raw,
2190
4142
  event: event.record,
@@ -2670,7 +4622,8 @@ function preparedDeviceEventRetainsCurrentOutput(input) {
2670
4622
  }
2671
4623
  const current = input.currentEventOwners.currentRecordByPreparedId.get(preparedId);
2672
4624
  return current !== undefined && (isDeletedEventSpineRecord(current)
2673
- || (eventSpineRevision(current) > eventSpineRevision(input.entry.record)
4625
+ || (current.source !== "device"
4626
+ && eventSpineRevision(current) > eventSpineRevision(input.entry.record)
2674
4627
  && userAuthoredEventStateKey(current) !== userAuthoredEventStateKey(input.entry.record)));
2675
4628
  }
2676
4629
  function storedIntegrationIngestRetainsCurrentOutputLocators(input) {
@@ -2797,7 +4750,28 @@ function buildStoredDeviceDeliveryNoopResult(input) {
2797
4750
  auditPath: null,
2798
4751
  };
2799
4752
  }
2800
- export async function importDeviceBatch({ vaultRoot, provider, accountId, importedAt = new Date(), source = "device", events = [], samples = [], evidenceParts = [], ingestReceipt, provenance, }) {
4753
+ export async function importDeviceBatch(input, options = {}) {
4754
+ assertCanonicalWriteLockScope(input.vaultRoot);
4755
+ const startedAt = performance.now();
4756
+ const timing = {
4757
+ canonicalWriteElapsedMs: 0,
4758
+ eventIdentityIndexCacheHit: false,
4759
+ eventIdentityIndexElapsedMs: 0,
4760
+ totalElapsedMs: 0,
4761
+ };
4762
+ try {
4763
+ return await importDeviceBatchWithExecutionOptions(input, options, timing);
4764
+ }
4765
+ catch (error) {
4766
+ clearDeviceBatchImportSessionVaultState(options.session, input.vaultRoot);
4767
+ throw error;
4768
+ }
4769
+ finally {
4770
+ timing.totalElapsedMs = Math.max(0, performance.now() - startedAt);
4771
+ emitDeviceBatchImportTiming(options.onTiming, timing);
4772
+ }
4773
+ }
4774
+ async function importDeviceBatchWithExecutionOptions({ vaultRoot, provider, accountId, importedAt = new Date(), source = "device", events = [], samples = [], evidenceParts = [], authoritativeEventSets = [], ingestReceipt, provenance, }, options, timing) {
2801
4775
  assertDeviceSampleRowLimit(Array.isArray(samples) ? samples.length : 0);
2802
4776
  const vault = await loadVault({ vaultRoot });
2803
4777
  const deviceBatchPlan = prepareDeviceBatchPlan({
@@ -2809,17 +4783,66 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
2809
4783
  events,
2810
4784
  samples,
2811
4785
  evidenceParts,
4786
+ authoritativeEventSets,
2812
4787
  ingestReceipt,
2813
4788
  provenance,
2814
4789
  });
2815
- const eventTargetShardPaths = [
2816
- ...new Set(deviceBatchPlan.preparedEvents.map((entry) => entry.relativePath)),
2817
- ].sort();
2818
4790
  const sampleRecords = deviceBatchPlan.preparedSamples.map((entry) => entry.record);
2819
4791
  const sampleAppendPlan = await buildJsonlAppendPlan(vaultRoot, deviceBatchPlan.preparedSamples, {
2820
4792
  dedupeWithinPlan: true,
2821
4793
  });
2822
- const eventIdentityContext = await buildDeviceEventIdentityContext(vaultRoot, deviceBatchPlan.preparedEvents);
4794
+ const requiresEventIdentityContext = deviceBatchPlan.preparedEvents.length > 0
4795
+ || deviceBatchPlan.authoritativeEventSets.length > 0;
4796
+ const eventIdentityDependency = buildDeviceEventIdentityDependency(deviceBatchPlan);
4797
+ const indexStartedAt = performance.now();
4798
+ const sessionVaultState = requiresEventIdentityContext
4799
+ ? readDeviceBatchImportSessionVaultState(options.session, vaultRoot)
4800
+ : undefined;
4801
+ const currentEventLedgerFingerprint = sessionVaultState
4802
+ ? await tryBuildDeviceEventLedgerFingerprint(vaultRoot)
4803
+ : undefined;
4804
+ const sessionFingerprintMatches = sessionVaultState
4805
+ && currentEventLedgerFingerprint !== undefined
4806
+ ? sessionVaultState.eventLedgerFingerprint
4807
+ === currentEventLedgerFingerprint
4808
+ : false;
4809
+ const cachedEventIdentityContext = sessionVaultState
4810
+ && sessionFingerprintMatches
4811
+ && sessionVaultState.dependencyChanges.every((dependencyChange) => !deviceEventIdentityDependenciesOverlap(eventIdentityDependency, dependencyChange))
4812
+ ? cloneDeviceEventIdentityContext(sessionVaultState.eventIdentityContext)
4813
+ : undefined;
4814
+ let initialEventIdentityContext = cachedEventIdentityContext
4815
+ ?? await buildDeviceEventIdentityContext(vaultRoot, deviceBatchPlan.preparedEvents, deviceBatchPlan.authoritativeEventSets);
4816
+ if (cachedEventIdentityContext
4817
+ && deviceBatchPlan.preparedEvents.some((entry) => resolveStructuralJunctionDailyAggregateAliasOwnerSplit(entry, cachedEventIdentityContext.index) !== null)) {
4818
+ initialEventIdentityContext = await buildDeviceEventIdentityContext(vaultRoot, deviceBatchPlan.preparedEvents, deviceBatchPlan.authoritativeEventSets);
4819
+ }
4820
+ else if (cachedEventIdentityContext) {
4821
+ timing.eventIdentityIndexCacheHit = true;
4822
+ }
4823
+ timing.eventIdentityIndexElapsedMs = Math.max(0, performance.now() - indexStartedAt);
4824
+ if (requiresEventIdentityContext && !timing.eventIdentityIndexCacheHit) {
4825
+ const eventLedgerFingerprint = await tryBuildDeviceEventLedgerFingerprint(vaultRoot);
4826
+ if (eventLedgerFingerprint) {
4827
+ replaceDeviceBatchImportSessionVaultState(options.session, vaultRoot, {
4828
+ dependencyChanges: [],
4829
+ eventIdentityContext: cloneDeviceEventIdentityContext(initialEventIdentityContext),
4830
+ eventLedgerFingerprint,
4831
+ });
4832
+ }
4833
+ else {
4834
+ clearDeviceBatchImportSessionVaultState(options.session, vaultRoot);
4835
+ }
4836
+ }
4837
+ deviceBatchPlan.preparedEvents = resolveJunctionFloatingFallbackEntries(deviceBatchPlan.preparedEvents, initialEventIdentityContext);
4838
+ const eventIdentityContext = {
4839
+ index: initialEventIdentityContext.index,
4840
+ legacyReservations: buildLegacyExternalRefReservations(deviceBatchPlan.preparedEvents, initialEventIdentityContext.index),
4841
+ };
4842
+ const aliasRepairContext = buildDeviceEventAliasRepairContext(deviceBatchPlan);
4843
+ const eventTargetShardPaths = [
4844
+ ...new Set(deviceBatchPlan.preparedEvents.map((entry) => entry.relativePath)),
4845
+ ].sort();
2823
4846
  const currentEventOwners = mapCurrentDeviceEventOwners(deviceBatchPlan.preparedEvents, eventIdentityContext);
2824
4847
  const baselineEventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, deviceBatchPlan.preparedEvents, buildEmptyDeviceEventIdentityContext(deviceBatchPlan.preparedEvents));
2825
4848
  const baselineRetainedPreparedIds = new Set(baselineEventReconciliation.appendRecordIdByPreparedRecordId.keys());
@@ -2834,6 +4857,7 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
2834
4857
  });
2835
4858
  const protectedPreparedEventIds = new Set(deviceBatchPlan.preparedEvents
2836
4859
  .filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
4860
+ && !hasJunctionDailyAggregateAliasSplit(entry, eventIdentityContext)
2837
4861
  && (currentEventOwners.historicallyDeliveredPreparedIds.has(entry.record.id)
2838
4862
  || (entry.record.externalRef === undefined
2839
4863
  && currentEventOwners.currentRecordByPreparedId.has(entry.record.id)
@@ -2842,7 +4866,7 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
2842
4866
  .map((entry) => entry.record.id));
2843
4867
  const ordinaryReconciliationEntries = deviceBatchPlan.preparedEvents.filter((entry) => baselineRetainedPreparedIds.has(entry.record.id)
2844
4868
  && !protectedPreparedEventIds.has(entry.record.id));
2845
- const currentEventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, ordinaryReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext));
4869
+ const currentEventReconciliation = await reconcileDeviceEventEntriesByExternalRef(vaultRoot, ordinaryReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext), new Map(), deviceBatchPlan.authoritativeEventSets, aliasRepairContext);
2846
4870
  const replayRetainedPreparedIds = new Set([
2847
4871
  ...protectedPreparedEventIds,
2848
4872
  ...currentEventReconciliation.retainedPreparedIds,
@@ -2935,15 +4959,22 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
2935
4959
  throw new VaultError("INTEGRATION_INGEST_ID_CONFLICT", `Device ingest id "${incrementalEvidenceImportId}" already belongs to a different delivery.`, { ingestId: incrementalEvidenceImportId });
2936
4960
  }
2937
4961
  };
2938
- const buildExactNoopResult = (storedDelivery) => buildStoredDeviceDeliveryNoopResult({
2939
- associationEvidenceRolesByPreparedRecordId,
2940
- currentEventOwners,
2941
- deviceBatchPlan,
2942
- eventTargetShardPaths,
2943
- preparedEventOutputOwners,
2944
- sampleRecords,
2945
- storedDelivery,
2946
- });
4962
+ const buildExactNoopResult = (storedDelivery) => {
4963
+ const result = buildStoredDeviceDeliveryNoopResult({
4964
+ associationEvidenceRolesByPreparedRecordId,
4965
+ currentEventOwners,
4966
+ deviceBatchPlan,
4967
+ eventTargetShardPaths,
4968
+ preparedEventOutputOwners,
4969
+ sampleRecords,
4970
+ storedDelivery,
4971
+ });
4972
+ const affectedSparseCalendarTargets = junctionSparseAffectedCalendarTargets(result.events, eventIdentityContext.index);
4973
+ const affectedEventDayKeys = junctionSparseAffectedDayKeys(affectedSparseCalendarTargets);
4974
+ return affectedSparseCalendarTargets.length > 0
4975
+ ? { ...result, affectedEventDayKeys, affectedSparseCalendarTargets }
4976
+ : result;
4977
+ };
2947
4978
  let fullInspectionAttempted = false;
2948
4979
  const ensureFullInspection = async () => {
2949
4980
  if (fullInspectionAttempted || (ingestIdInspection.historyComplete && !ingestIdInspection.unsafe)) {
@@ -3144,7 +5175,7 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3144
5175
  const persistenceReconciliationEntries = reconciliationEntries.filter((entry) => !storedEventRepairIds.has(entry.record.id));
3145
5176
  const repairedProtectedPreparedEventCount = [...historicalRepairEntryByPreparedId.keys()].filter((preparedId) => persistenceProtectedPreparedEventIds.has(preparedId)).length;
3146
5177
  const reconciled = evidenceRepairRequired
3147
- ? await reconcileDeviceEventEntriesByExternalRef(vaultRoot, persistenceReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext))
5178
+ ? await reconcileDeviceEventEntriesByExternalRef(vaultRoot, persistenceReconciliationEntries, cloneDeviceEventIdentityContext(eventIdentityContext), new Map(), deviceBatchPlan.authoritativeEventSets, aliasRepairContext)
3148
5179
  : currentEventReconciliation;
3149
5180
  const reconciledRecordByPreparedId = new Map(persistenceReconciliationEntries.map((entry, index) => [
3150
5181
  entry.record.id,
@@ -3207,6 +5238,8 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3207
5238
  const preparedId = deviceBatchPlan.preparedEvents[index]?.record.id;
3208
5239
  return preparedId !== undefined && associablePreparedEventIds.has(preparedId);
3209
5240
  });
5241
+ const affectedSparseCalendarTargets = junctionSparseAffectedCalendarTargets(canonicalEventRecords, eventIdentityContext.index);
5242
+ const affectedEventDayKeys = junctionSparseAffectedDayKeys(affectedSparseCalendarTargets);
3210
5243
  const persistenceEvidenceRolesByPreparedRecordId = new Map(deviceBatchPlan.preparedEvents
3211
5244
  .filter((entry) => associablePreparedEventIds.has(entry.record.id)
3212
5245
  && acceptedEvidenceRolesByPreparedRecordId.has(entry.record.id))
@@ -3216,7 +5249,7 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3216
5249
  ]));
3217
5250
  const persistencePreparedEvents = deviceBatchPlan.preparedEvents.filter((entry) => associablePreparedEventIds.has(entry.record.id)
3218
5251
  && persistenceEvidenceRolesByPreparedRecordId.has(entry.record.id));
3219
- const hasAppendedOutputs = appendedPreparedEventIds.size > 0
5252
+ const hasAppendedOutputs = eventAppendPlan.appendedRecordIds.length > 0
3220
5253
  || sampleAppendPlan.appendedRecordIds.length > 0;
3221
5254
  const eventIdsByEvidenceRole = new Map();
3222
5255
  for (const entry of deviceBatchPlan.preparedEvents) {
@@ -3270,6 +5303,9 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3270
5303
  }
3271
5304
  const eventOutputs = buildIntegrationEventOutputs(shouldPersistDelivery ? persistencePreparedEvents : [], canonicalIdByPreparedId, retainedEvidenceRolesByPreparedRecordId);
3272
5305
  const buildNoopResult = () => ({
5306
+ ...(affectedEventDayKeys.length > 0
5307
+ ? { affectedEventDayKeys, affectedSparseCalendarTargets }
5308
+ : {}),
3273
5309
  applied: false,
3274
5310
  ingestId: null,
3275
5311
  ingestShardPath: null,
@@ -3285,6 +5321,8 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3285
5321
  auditPath: null,
3286
5322
  });
3287
5323
  return {
5324
+ affectedEventDayKeys,
5325
+ affectedSparseCalendarTargets,
3288
5326
  buildNoopResult,
3289
5327
  eventAppendPlan,
3290
5328
  eventOutputs,
@@ -3334,7 +5372,7 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3334
5372
  assertInspectionCanAuthorizeNoop();
3335
5373
  return persistence.buildNoopResult();
3336
5374
  }
3337
- const { buildNoopResult, eventAppendPlan, eventOutputs, eventReconciliation, canonicalEventRecords, retainedEvidenceParts, } = persistence;
5375
+ const { affectedEventDayKeys, affectedSparseCalendarTargets, buildNoopResult, eventAppendPlan, eventOutputs, eventReconciliation, canonicalEventRecords, retainedEvidenceParts, } = persistence;
3338
5376
  const currentImportIdOccupied = ingestIdInspection.entriesById.has(deviceBatchPlan.importId)
3339
5377
  || ingestIdInspection.invalidIds.has(deviceBatchPlan.importId);
3340
5378
  const finalAssociationImportId = buildAssociationImportId(eventOutputs);
@@ -3380,7 +5418,8 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3380
5418
  assertInspectionCanAuthorizeNoop();
3381
5419
  return buildNoopResult();
3382
5420
  }
3383
- return runCanonicalWrite({
5421
+ const canonicalWriteStartedAt = performance.now();
5422
+ const result = await runCanonicalWrite({
3384
5423
  vaultRoot,
3385
5424
  operationType: "device_batch_import",
3386
5425
  summary: `Import ${deviceBatchPlan.provider} device batch ${persistedImportId}`,
@@ -3405,12 +5444,16 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3405
5444
  sampleCount: sampleRecords.length,
3406
5445
  skippedDuplicateCount: eventReconciliation.skippedDuplicateCount,
3407
5446
  supersededCount: eventReconciliation.supersededCount,
5447
+ retractedCount: eventReconciliation.retractedCount,
3408
5448
  }),
3409
5449
  occurredAt: deviceBatchPlan.importedAt,
3410
5450
  files: touchedPaths,
3411
5451
  targetIds: [persistedImportId],
3412
5452
  });
3413
5453
  return {
5454
+ ...(affectedEventDayKeys.length > 0
5455
+ ? { affectedEventDayKeys, affectedSparseCalendarTargets }
5456
+ : {}),
3414
5457
  applied: true,
3415
5458
  ingestId: persistedImportId,
3416
5459
  ingestShardPath,
@@ -3419,7 +5462,12 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3419
5462
  importedAt: deviceBatchPlan.importedAt,
3420
5463
  events: canonicalEventRecords,
3421
5464
  samples: sampleRecords,
3422
- eventShardPaths: eventTargetShardPaths,
5465
+ eventShardPaths: [
5466
+ ...new Set([
5467
+ ...eventTargetShardPaths,
5468
+ ...eventAppendPlan.targetShardPaths,
5469
+ ]),
5470
+ ].sort(),
3423
5471
  sampleShardPaths: sampleAppendPlan.targetShardPaths,
3424
5472
  evidencePartCount: deviceBatchPlan.preparedEvidenceParts.length,
3425
5473
  persistedEvidencePartCount: retainedEvidenceParts.length,
@@ -3427,6 +5475,27 @@ export async function importDeviceBatch({ vaultRoot, provider, accountId, import
3427
5475
  };
3428
5476
  },
3429
5477
  });
5478
+ timing.canonicalWriteElapsedMs = Math.max(0, performance.now() - canonicalWriteStartedAt);
5479
+ if (eventAppendPlan.appendedRecordIds.length > 0) {
5480
+ const currentSessionState = readDeviceBatchImportSessionVaultState(options.session, vaultRoot);
5481
+ if (currentSessionState) {
5482
+ const eventLedgerFingerprint = await tryBuildDeviceEventLedgerFingerprint(vaultRoot);
5483
+ if (eventLedgerFingerprint) {
5484
+ replaceDeviceBatchImportSessionVaultState(options.session, vaultRoot, {
5485
+ ...currentSessionState,
5486
+ dependencyChanges: [
5487
+ ...currentSessionState.dependencyChanges,
5488
+ buildDeviceEventIdentityDependency(deviceBatchPlan, eventReconciliation.records.map((record) => record.id)),
5489
+ ],
5490
+ eventLedgerFingerprint,
5491
+ });
5492
+ }
5493
+ else {
5494
+ clearDeviceBatchImportSessionVaultState(options.session, vaultRoot);
5495
+ }
5496
+ }
5497
+ }
5498
+ return result;
3430
5499
  }
3431
5500
  const EVENT_BATCH_FAILURE_REPORT_LIMIT = 20;
3432
5501
  // importEventBatch is public API surface, so the batch-shape invariants live
@@ -3471,6 +5540,12 @@ export async function importEventBatch(input) {
3471
5540
  if (usesPayloads === usesDecisions) {
3472
5541
  throw new VaultError("EVENT_BATCH_INVALID", "Event batch must define exactly one of payloads or decisions.");
3473
5542
  }
5543
+ const sourceRawRef = usesPayloads
5544
+ ? input.rejectIfSourceRawRefAlreadyImported?.trim()
5545
+ : undefined;
5546
+ if (usesPayloads && input.rejectIfSourceRawRefAlreadyImported !== undefined && !sourceRawRef) {
5547
+ throw new VaultError("EVENT_BATCH_INVALID", "Event batch source raw reference must not be empty.");
5548
+ }
3474
5549
  const normalizedRows = usesDecisions
3475
5550
  ? normalizeImportEventBatchDecisions(input.decisions, signal)
3476
5551
  : normalizeImportEventBatchPayloads(input.payloads, signal);
@@ -3519,11 +5594,15 @@ export async function importEventBatch(input) {
3519
5594
  });
3520
5595
  return;
3521
5596
  }
3522
- const record = buildPublicEventImportRecord({ ...decision.payload }, vault.metadata.timezone);
5597
+ // Decisions are the trusted importer-owner path. Their contract permits
5598
+ // verified workout CSV evidence to retain an unknown duration, while the
5599
+ // generic public payload path above remains stricter.
5600
+ const record = buildEventImportDecisionRecord({ ...decision.payload }, vault.metadata.timezone);
3523
5601
  decisions.push({
3524
5602
  action: "upsert",
3525
5603
  allowsKindReplacement: true,
3526
5604
  entry: { relativePath: toEventLedgerFile(record.occurredAt), record },
5605
+ ...(decision.expectedLatest ? { expectedLatest: decision.expectedLatest } : {}),
3527
5606
  });
3528
5607
  }
3529
5608
  catch (error) {
@@ -3539,6 +5618,29 @@ export async function importEventBatch(input) {
3539
5618
  failures: failures.slice(0, EVENT_BATCH_FAILURE_REPORT_LIMIT),
3540
5619
  });
3541
5620
  }
5621
+ let sourceCompletionTargetId = null;
5622
+ if (sourceRawRef) {
5623
+ const invalidSourceIndexes = decisions.flatMap((decision, index) => decision.action === "upsert"
5624
+ && decision.entry.record.kind === "activity_session"
5625
+ && decision.entry.record.externalRef === undefined
5626
+ && collectEventRawReferencePaths(decision.entry.record).includes(sourceRawRef)
5627
+ ? []
5628
+ : [index]);
5629
+ if (invalidSourceIndexes.length > 0) {
5630
+ throw new VaultError("EVENT_BATCH_SOURCE_ROW_INVALID", "Every event in a source-guarded batch must be an externalRef-free activity session that references the guarded raw source; nothing was imported.", { indexes: invalidSourceIndexes.slice(0, EVENT_BATCH_FAILURE_REPORT_LIMIT) });
5631
+ }
5632
+ const sourceState = await inspectWorkoutSourceImportStatus({
5633
+ vaultRoot,
5634
+ rawRef: sourceRawRef,
5635
+ });
5636
+ if (sourceState.status === "completed") {
5637
+ throw new VaultError("EVENT_BATCH_SOURCE_ALREADY_IMPORTED", "The atomic workout import for this exact source already completed; nothing was imported.");
5638
+ }
5639
+ if (sourceState.status === "partial_conflict") {
5640
+ throw new VaultError("EVENT_BATCH_SOURCE_PARTIAL_CONFLICT", "This exact source has workout history without a whole-source completion receipt; nothing was imported. Resolve the partial import before retrying.");
5641
+ }
5642
+ sourceCompletionTargetId = sourceState.completionTargetId;
5643
+ }
3542
5644
  signal?.throwIfAborted();
3543
5645
  const reconciliation = await reconcileEventImportDecisionsByExternalRef(vaultRoot, decisions, signal);
3544
5646
  const appendPlan = await buildJsonlAppendPlan(vaultRoot, reconciliation.appendEntries, {
@@ -3581,14 +5683,19 @@ export async function importEventBatch(input) {
3581
5683
  vaultRoot,
3582
5684
  batch,
3583
5685
  action: "event_upsert",
3584
- commandName: "core.importEventBatch",
5686
+ commandName: sourceCompletionTargetId
5687
+ ? WORKOUT_SOURCE_IMPORT_AUDIT_COMMAND
5688
+ : "core.importEventBatch",
3585
5689
  summary: `Imported event batch: ${counts.createdCount} created, ` +
3586
5690
  `${counts.supersededCount} superseded, ` +
3587
5691
  `${counts.retractedCount} retracted, ` +
3588
5692
  `${counts.skippedExistingCount} skipped existing of ${counts.receivedCount} received.`,
3589
5693
  occurredAt,
3590
5694
  files: appendPlan.appendedShardPaths,
3591
- targetIds: [...new Set(appendPlan.appendedRecordIds)].slice(0, AUDIT_TARGET_ID_LIMIT),
5695
+ targetIds: [
5696
+ ...(sourceCompletionTargetId ? [sourceCompletionTargetId] : []),
5697
+ ...new Set(appendPlan.appendedRecordIds),
5698
+ ].slice(0, AUDIT_TARGET_ID_LIMIT),
3592
5699
  });
3593
5700
  return {
3594
5701
  applied: true,