@murphai/hosted-execution 0.1.15 → 0.1.18

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 (656) hide show
  1. package/LICENSE +201 -674
  2. package/README.md +15 -14
  3. package/dist/auth.d.ts +11 -25
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js +32 -76
  6. package/dist/auth.js.map +1 -1
  7. package/dist/builders.d.ts +3 -4
  8. package/dist/builders.d.ts.map +1 -1
  9. package/dist/builders.js +24 -24
  10. package/dist/builders.js.map +1 -1
  11. package/dist/bundles.d.ts +3 -13
  12. package/dist/bundles.d.ts.map +1 -1
  13. package/dist/bundles.js +1 -16
  14. package/dist/bundles.js.map +1 -1
  15. package/dist/client.d.ts +2 -26
  16. package/dist/client.d.ts.map +1 -1
  17. package/dist/client.js +38 -212
  18. package/dist/client.js.map +1 -1
  19. package/dist/contracts.d.ts +49 -118
  20. package/dist/contracts.d.ts.map +1 -1
  21. package/dist/contracts.js +15 -58
  22. package/dist/contracts.js.map +1 -1
  23. package/dist/dispatch-ref.d.ts +1 -2
  24. package/dist/dispatch-ref.d.ts.map +1 -1
  25. package/dist/dispatch-ref.js +16 -30
  26. package/dist/dispatch-ref.js.map +1 -1
  27. package/dist/env.d.ts +0 -38
  28. package/dist/env.d.ts.map +1 -1
  29. package/dist/env.js +1 -87
  30. package/dist/env.js.map +1 -1
  31. package/dist/index.d.ts +0 -2
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +0 -2
  34. package/dist/index.js.map +1 -1
  35. package/dist/observability.d.ts +3 -1
  36. package/dist/observability.d.ts.map +1 -1
  37. package/dist/observability.js +76 -53
  38. package/dist/observability.js.map +1 -1
  39. package/dist/outbox-payload.d.ts +7 -5
  40. package/dist/outbox-payload.d.ts.map +1 -1
  41. package/dist/outbox-payload.js +75 -38
  42. package/dist/outbox-payload.js.map +1 -1
  43. package/dist/parsers.d.ts +10 -10
  44. package/dist/parsers.d.ts.map +1 -1
  45. package/dist/parsers.js +192 -139
  46. package/dist/parsers.js.map +1 -1
  47. package/dist/routes.d.ts +4 -9
  48. package/dist/routes.d.ts.map +1 -1
  49. package/dist/routes.js +7 -18
  50. package/dist/routes.js.map +1 -1
  51. package/node_modules/@murphai/core/README.md +3 -0
  52. package/node_modules/@murphai/core/dist/assessment/index.d.ts +5 -0
  53. package/node_modules/@murphai/core/dist/assessment/index.d.ts.map +1 -0
  54. package/node_modules/@murphai/core/dist/assessment/index.js +4 -0
  55. package/node_modules/@murphai/core/dist/assessment/index.js.map +1 -0
  56. package/node_modules/@murphai/core/dist/assessment/project.d.ts +9 -0
  57. package/node_modules/@murphai/core/dist/assessment/project.d.ts.map +1 -0
  58. package/node_modules/@murphai/core/dist/assessment/project.js +353 -0
  59. package/node_modules/@murphai/core/dist/assessment/project.js.map +1 -0
  60. package/node_modules/@murphai/core/dist/assessment/storage.d.ts +13 -0
  61. package/node_modules/@murphai/core/dist/assessment/storage.d.ts.map +1 -0
  62. package/node_modules/@murphai/core/dist/assessment/storage.js +202 -0
  63. package/node_modules/@murphai/core/dist/assessment/storage.js.map +1 -0
  64. package/node_modules/@murphai/core/dist/assessment/types.d.ts +112 -0
  65. package/node_modules/@murphai/core/dist/assessment/types.d.ts.map +1 -0
  66. package/node_modules/@murphai/core/dist/assessment/types.js +5 -0
  67. package/node_modules/@murphai/core/dist/assessment/types.js.map +1 -0
  68. package/node_modules/@murphai/core/dist/atomic-write.d.ts +5 -0
  69. package/node_modules/@murphai/core/dist/atomic-write.d.ts.map +1 -0
  70. package/node_modules/@murphai/core/dist/atomic-write.js +120 -0
  71. package/node_modules/@murphai/core/dist/atomic-write.js.map +1 -0
  72. package/node_modules/@murphai/core/dist/audit.d.ts +27 -0
  73. package/node_modules/@murphai/core/dist/audit.d.ts.map +1 -0
  74. package/node_modules/@murphai/core/dist/audit.js +94 -0
  75. package/node_modules/@murphai/core/dist/audit.js.map +1 -0
  76. package/node_modules/@murphai/core/dist/automation.d.ts +55 -0
  77. package/node_modules/@murphai/core/dist/automation.d.ts.map +1 -0
  78. package/node_modules/@murphai/core/dist/automation.js +411 -0
  79. package/node_modules/@murphai/core/dist/automation.js.map +1 -0
  80. package/node_modules/@murphai/core/dist/bank/allergies.d.ts +5 -0
  81. package/node_modules/@murphai/core/dist/bank/allergies.d.ts.map +1 -0
  82. package/node_modules/@murphai/core/dist/bank/allergies.js +209 -0
  83. package/node_modules/@murphai/core/dist/bank/allergies.js.map +1 -0
  84. package/node_modules/@murphai/core/dist/bank/conditions.d.ts +5 -0
  85. package/node_modules/@murphai/core/dist/bank/conditions.d.ts.map +1 -0
  86. package/node_modules/@murphai/core/dist/bank/conditions.js +249 -0
  87. package/node_modules/@murphai/core/dist/bank/conditions.js.map +1 -0
  88. package/node_modules/@murphai/core/dist/bank/foods.d.ts +8 -0
  89. package/node_modules/@murphai/core/dist/bank/foods.d.ts.map +1 -0
  90. package/node_modules/@murphai/core/dist/bank/foods.js +255 -0
  91. package/node_modules/@murphai/core/dist/bank/foods.js.map +1 -0
  92. package/node_modules/@murphai/core/dist/bank/goals.d.ts +5 -0
  93. package/node_modules/@murphai/core/dist/bank/goals.d.ts.map +1 -0
  94. package/node_modules/@murphai/core/dist/bank/goals.js +289 -0
  95. package/node_modules/@murphai/core/dist/bank/goals.js.map +1 -0
  96. package/node_modules/@murphai/core/dist/bank/index.d.ts +10 -0
  97. package/node_modules/@murphai/core/dist/bank/index.d.ts.map +1 -0
  98. package/node_modules/@murphai/core/dist/bank/index.js +10 -0
  99. package/node_modules/@murphai/core/dist/bank/index.js.map +1 -0
  100. package/node_modules/@murphai/core/dist/bank/protocols.d.ts +8 -0
  101. package/node_modules/@murphai/core/dist/bank/protocols.d.ts.map +1 -0
  102. package/node_modules/@murphai/core/dist/bank/protocols.js +466 -0
  103. package/node_modules/@murphai/core/dist/bank/protocols.js.map +1 -0
  104. package/node_modules/@murphai/core/dist/bank/providers.d.ts +46 -0
  105. package/node_modules/@murphai/core/dist/bank/providers.d.ts.map +1 -0
  106. package/node_modules/@murphai/core/dist/bank/providers.js +160 -0
  107. package/node_modules/@murphai/core/dist/bank/providers.js.map +1 -0
  108. package/node_modules/@murphai/core/dist/bank/recipes.d.ts +8 -0
  109. package/node_modules/@murphai/core/dist/bank/recipes.d.ts.map +1 -0
  110. package/node_modules/@murphai/core/dist/bank/recipes.js +287 -0
  111. package/node_modules/@murphai/core/dist/bank/recipes.js.map +1 -0
  112. package/node_modules/@murphai/core/dist/bank/shared.d.ts +39 -0
  113. package/node_modules/@murphai/core/dist/bank/shared.d.ts.map +1 -0
  114. package/node_modules/@murphai/core/dist/bank/shared.js +150 -0
  115. package/node_modules/@murphai/core/dist/bank/shared.js.map +1 -0
  116. package/node_modules/@murphai/core/dist/bank/types.d.ts +469 -0
  117. package/node_modules/@murphai/core/dist/bank/types.d.ts.map +1 -0
  118. package/node_modules/@murphai/core/dist/bank/types.js +35 -0
  119. package/node_modules/@murphai/core/dist/bank/types.js.map +1 -0
  120. package/node_modules/@murphai/core/dist/bank/workout-formats.d.ts +5 -0
  121. package/node_modules/@murphai/core/dist/bank/workout-formats.d.ts.map +1 -0
  122. package/node_modules/@murphai/core/dist/bank/workout-formats.js +204 -0
  123. package/node_modules/@murphai/core/dist/bank/workout-formats.js.map +1 -0
  124. package/node_modules/@murphai/core/dist/canonical-mutations.d.ts +54 -0
  125. package/node_modules/@murphai/core/dist/canonical-mutations.d.ts.map +1 -0
  126. package/node_modules/@murphai/core/dist/canonical-mutations.js +196 -0
  127. package/node_modules/@murphai/core/dist/canonical-mutations.js.map +1 -0
  128. package/node_modules/@murphai/core/dist/constants.d.ts +125 -0
  129. package/node_modules/@murphai/core/dist/constants.d.ts.map +1 -0
  130. package/node_modules/@murphai/core/dist/constants.js +132 -0
  131. package/node_modules/@murphai/core/dist/constants.js.map +1 -0
  132. package/node_modules/@murphai/core/dist/domains/events.d.ts +100 -0
  133. package/node_modules/@murphai/core/dist/domains/events.d.ts.map +1 -0
  134. package/node_modules/@murphai/core/dist/domains/events.js +593 -0
  135. package/node_modules/@murphai/core/dist/domains/events.js.map +1 -0
  136. package/node_modules/@murphai/core/dist/domains/experiments.d.ts +71 -0
  137. package/node_modules/@murphai/core/dist/domains/experiments.d.ts.map +1 -0
  138. package/node_modules/@murphai/core/dist/domains/experiments.js +275 -0
  139. package/node_modules/@murphai/core/dist/domains/experiments.js.map +1 -0
  140. package/node_modules/@murphai/core/dist/domains/journal.d.ts +52 -0
  141. package/node_modules/@murphai/core/dist/domains/journal.d.ts.map +1 -0
  142. package/node_modules/@murphai/core/dist/domains/journal.js +173 -0
  143. package/node_modules/@murphai/core/dist/domains/journal.js.map +1 -0
  144. package/node_modules/@murphai/core/dist/domains/shared.d.ts +37 -0
  145. package/node_modules/@murphai/core/dist/domains/shared.d.ts.map +1 -0
  146. package/node_modules/@murphai/core/dist/domains/shared.js +101 -0
  147. package/node_modules/@murphai/core/dist/domains/shared.js.map +1 -0
  148. package/node_modules/@murphai/core/dist/domains/vault-summary.d.ts +15 -0
  149. package/node_modules/@murphai/core/dist/domains/vault-summary.d.ts.map +1 -0
  150. package/node_modules/@murphai/core/dist/domains/vault-summary.js +58 -0
  151. package/node_modules/@murphai/core/dist/domains/vault-summary.js.map +1 -0
  152. package/node_modules/@murphai/core/dist/errors.d.ts +8 -0
  153. package/node_modules/@murphai/core/dist/errors.d.ts.map +1 -0
  154. package/node_modules/@murphai/core/dist/errors.js +14 -0
  155. package/node_modules/@murphai/core/dist/errors.js.map +1 -0
  156. package/node_modules/@murphai/core/dist/event-attachments.d.ts +69 -0
  157. package/node_modules/@murphai/core/dist/event-attachments.d.ts.map +1 -0
  158. package/node_modules/@murphai/core/dist/event-attachments.js +202 -0
  159. package/node_modules/@murphai/core/dist/event-attachments.js.map +1 -0
  160. package/node_modules/@murphai/core/dist/event-links.d.ts +15 -0
  161. package/node_modules/@murphai/core/dist/event-links.d.ts.map +1 -0
  162. package/node_modules/@murphai/core/dist/event-links.js +54 -0
  163. package/node_modules/@murphai/core/dist/event-links.js.map +1 -0
  164. package/node_modules/@murphai/core/dist/family/api.d.ts +5 -0
  165. package/node_modules/@murphai/core/dist/family/api.d.ts.map +1 -0
  166. package/node_modules/@murphai/core/dist/family/api.js +221 -0
  167. package/node_modules/@murphai/core/dist/family/api.js.map +1 -0
  168. package/node_modules/@murphai/core/dist/family/index.d.ts +3 -0
  169. package/node_modules/@murphai/core/dist/family/index.d.ts.map +1 -0
  170. package/node_modules/@murphai/core/dist/family/index.js +3 -0
  171. package/node_modules/@murphai/core/dist/family/index.js.map +1 -0
  172. package/node_modules/@murphai/core/dist/family/types.d.ts +34 -0
  173. package/node_modules/@murphai/core/dist/family/types.d.ts.map +1 -0
  174. package/node_modules/@murphai/core/dist/family/types.js +2 -0
  175. package/node_modules/@murphai/core/dist/family/types.js.map +1 -0
  176. package/node_modules/@murphai/core/dist/frontmatter.d.ts +4 -0
  177. package/node_modules/@murphai/core/dist/frontmatter.d.ts.map +1 -0
  178. package/node_modules/@murphai/core/dist/frontmatter.js +99 -0
  179. package/node_modules/@murphai/core/dist/frontmatter.js.map +1 -0
  180. package/node_modules/@murphai/core/dist/fs.d.ts +22 -0
  181. package/node_modules/@murphai/core/dist/fs.d.ts.map +1 -0
  182. package/node_modules/@murphai/core/dist/fs.js +172 -0
  183. package/node_modules/@murphai/core/dist/fs.js.map +1 -0
  184. package/node_modules/@murphai/core/dist/genetics/api.d.ts +5 -0
  185. package/node_modules/@murphai/core/dist/genetics/api.d.ts.map +1 -0
  186. package/node_modules/@murphai/core/dist/genetics/api.js +226 -0
  187. package/node_modules/@murphai/core/dist/genetics/api.js.map +1 -0
  188. package/node_modules/@murphai/core/dist/genetics/index.d.ts +3 -0
  189. package/node_modules/@murphai/core/dist/genetics/index.d.ts.map +1 -0
  190. package/node_modules/@murphai/core/dist/genetics/index.js +3 -0
  191. package/node_modules/@murphai/core/dist/genetics/index.js.map +1 -0
  192. package/node_modules/@murphai/core/dist/genetics/types.d.ts +40 -0
  193. package/node_modules/@murphai/core/dist/genetics/types.d.ts.map +1 -0
  194. package/node_modules/@murphai/core/dist/genetics/types.js +4 -0
  195. package/node_modules/@murphai/core/dist/genetics/types.js.map +1 -0
  196. package/node_modules/@murphai/core/dist/history/api.d.ts +7 -0
  197. package/node_modules/@murphai/core/dist/history/api.d.ts.map +1 -0
  198. package/node_modules/@murphai/core/dist/history/api.js +473 -0
  199. package/node_modules/@murphai/core/dist/history/api.js.map +1 -0
  200. package/node_modules/@murphai/core/dist/history/event-spine.d.ts +41 -0
  201. package/node_modules/@murphai/core/dist/history/event-spine.d.ts.map +1 -0
  202. package/node_modules/@murphai/core/dist/history/event-spine.js +111 -0
  203. package/node_modules/@murphai/core/dist/history/event-spine.js.map +1 -0
  204. package/node_modules/@murphai/core/dist/history/index.d.ts +3 -0
  205. package/node_modules/@murphai/core/dist/history/index.d.ts.map +1 -0
  206. package/node_modules/@murphai/core/dist/history/index.js +3 -0
  207. package/node_modules/@murphai/core/dist/history/index.js.map +1 -0
  208. package/node_modules/@murphai/core/dist/history/shared.d.ts +25 -0
  209. package/node_modules/@murphai/core/dist/history/shared.d.ts.map +1 -0
  210. package/node_modules/@murphai/core/dist/history/shared.js +144 -0
  211. package/node_modules/@murphai/core/dist/history/shared.js.map +1 -0
  212. package/node_modules/@murphai/core/dist/history/types.d.ts +127 -0
  213. package/node_modules/@murphai/core/dist/history/types.d.ts.map +1 -0
  214. package/node_modules/@murphai/core/dist/history/types.js +8 -0
  215. package/node_modules/@murphai/core/dist/history/types.js.map +1 -0
  216. package/node_modules/@murphai/core/dist/ids.d.ts +3 -0
  217. package/node_modules/@murphai/core/dist/ids.d.ts.map +1 -0
  218. package/node_modules/@murphai/core/dist/ids.js +20 -0
  219. package/node_modules/@murphai/core/dist/ids.js.map +1 -0
  220. package/node_modules/@murphai/core/dist/index.d.ts +30 -0
  221. package/node_modules/@murphai/core/dist/index.d.ts.map +1 -0
  222. package/node_modules/@murphai/core/dist/index.js +23 -0
  223. package/node_modules/@murphai/core/dist/index.js.map +1 -0
  224. package/node_modules/@murphai/core/dist/jsonl.d.ts +12 -0
  225. package/node_modules/@murphai/core/dist/jsonl.d.ts.map +1 -0
  226. package/node_modules/@murphai/core/dist/jsonl.js +40 -0
  227. package/node_modules/@murphai/core/dist/jsonl.js.map +1 -0
  228. package/node_modules/@murphai/core/dist/memory.d.ts +17 -0
  229. package/node_modules/@murphai/core/dist/memory.d.ts.map +1 -0
  230. package/node_modules/@murphai/core/dist/memory.js +72 -0
  231. package/node_modules/@murphai/core/dist/memory.js.map +1 -0
  232. package/node_modules/@murphai/core/dist/mutations.d.ts +150 -0
  233. package/node_modules/@murphai/core/dist/mutations.d.ts.map +1 -0
  234. package/node_modules/@murphai/core/dist/mutations.js +1109 -0
  235. package/node_modules/@murphai/core/dist/mutations.js.map +1 -0
  236. package/node_modules/@murphai/core/dist/operations/canonical-write-lock.d.ts +29 -0
  237. package/node_modules/@murphai/core/dist/operations/canonical-write-lock.d.ts.map +1 -0
  238. package/node_modules/@murphai/core/dist/operations/canonical-write-lock.js +164 -0
  239. package/node_modules/@murphai/core/dist/operations/canonical-write-lock.js.map +1 -0
  240. package/node_modules/@murphai/core/dist/operations/index.d.ts +5 -0
  241. package/node_modules/@murphai/core/dist/operations/index.d.ts.map +1 -0
  242. package/node_modules/@murphai/core/dist/operations/index.js +3 -0
  243. package/node_modules/@murphai/core/dist/operations/index.js.map +1 -0
  244. package/node_modules/@murphai/core/dist/operations/raw-manifests.d.ts +33 -0
  245. package/node_modules/@murphai/core/dist/operations/raw-manifests.d.ts.map +1 -0
  246. package/node_modules/@murphai/core/dist/operations/raw-manifests.js +105 -0
  247. package/node_modules/@murphai/core/dist/operations/raw-manifests.js.map +1 -0
  248. package/node_modules/@murphai/core/dist/operations/write-batch.d.ts +166 -0
  249. package/node_modules/@murphai/core/dist/operations/write-batch.d.ts.map +1 -0
  250. package/node_modules/@murphai/core/dist/operations/write-batch.js +886 -0
  251. package/node_modules/@murphai/core/dist/operations/write-batch.js.map +1 -0
  252. package/node_modules/@murphai/core/dist/path-safety.d.ts +19 -0
  253. package/node_modules/@murphai/core/dist/path-safety.d.ts.map +1 -0
  254. package/node_modules/@murphai/core/dist/path-safety.js +193 -0
  255. package/node_modules/@murphai/core/dist/path-safety.js.map +1 -0
  256. package/node_modules/@murphai/core/dist/profile/index.d.ts +4 -0
  257. package/node_modules/@murphai/core/dist/profile/index.d.ts.map +1 -0
  258. package/node_modules/@murphai/core/dist/profile/index.js +3 -0
  259. package/node_modules/@murphai/core/dist/profile/index.js.map +1 -0
  260. package/node_modules/@murphai/core/dist/profile/storage.d.ts +41 -0
  261. package/node_modules/@murphai/core/dist/profile/storage.d.ts.map +1 -0
  262. package/node_modules/@murphai/core/dist/profile/storage.js +225 -0
  263. package/node_modules/@murphai/core/dist/profile/storage.js.map +1 -0
  264. package/node_modules/@murphai/core/dist/profile/types.d.ts +29 -0
  265. package/node_modules/@murphai/core/dist/profile/types.d.ts.map +1 -0
  266. package/node_modules/@murphai/core/dist/profile/types.js +8 -0
  267. package/node_modules/@murphai/core/dist/profile/types.js.map +1 -0
  268. package/node_modules/@murphai/core/dist/public-mutations.d.ts +120 -0
  269. package/node_modules/@murphai/core/dist/public-mutations.d.ts.map +1 -0
  270. package/node_modules/@murphai/core/dist/public-mutations.js +275 -0
  271. package/node_modules/@murphai/core/dist/public-mutations.js.map +1 -0
  272. package/node_modules/@murphai/core/dist/raw.d.ts +28 -0
  273. package/node_modules/@murphai/core/dist/raw.d.ts.map +1 -0
  274. package/node_modules/@murphai/core/dist/raw.js +107 -0
  275. package/node_modules/@murphai/core/dist/raw.js.map +1 -0
  276. package/node_modules/@murphai/core/dist/registry/api.d.ts +80 -0
  277. package/node_modules/@murphai/core/dist/registry/api.d.ts.map +1 -0
  278. package/node_modules/@murphai/core/dist/registry/api.js +113 -0
  279. package/node_modules/@murphai/core/dist/registry/api.js.map +1 -0
  280. package/node_modules/@murphai/core/dist/registry/id-or-slug.d.ts +15 -0
  281. package/node_modules/@murphai/core/dist/registry/id-or-slug.d.ts.map +1 -0
  282. package/node_modules/@murphai/core/dist/registry/id-or-slug.js +9 -0
  283. package/node_modules/@murphai/core/dist/registry/id-or-slug.js.map +1 -0
  284. package/node_modules/@murphai/core/dist/registry/markdown.d.ts +101 -0
  285. package/node_modules/@murphai/core/dist/registry/markdown.d.ts.map +1 -0
  286. package/node_modules/@murphai/core/dist/registry/markdown.js +136 -0
  287. package/node_modules/@murphai/core/dist/registry/markdown.js.map +1 -0
  288. package/node_modules/@murphai/core/dist/shares.d.ts +36 -0
  289. package/node_modules/@murphai/core/dist/shares.d.ts.map +1 -0
  290. package/node_modules/@murphai/core/dist/shares.js +333 -0
  291. package/node_modules/@murphai/core/dist/shares.js.map +1 -0
  292. package/node_modules/@murphai/core/dist/storage-spine.d.ts +3 -0
  293. package/node_modules/@murphai/core/dist/storage-spine.d.ts.map +1 -0
  294. package/node_modules/@murphai/core/dist/storage-spine.js +3 -0
  295. package/node_modules/@murphai/core/dist/storage-spine.js.map +1 -0
  296. package/node_modules/@murphai/core/dist/time.d.ts +11 -0
  297. package/node_modules/@murphai/core/dist/time.d.ts.map +1 -0
  298. package/node_modules/@murphai/core/dist/time.js +72 -0
  299. package/node_modules/@murphai/core/dist/time.js.map +1 -0
  300. package/node_modules/@murphai/core/dist/types.d.ts +18 -0
  301. package/node_modules/@murphai/core/dist/types.d.ts.map +1 -0
  302. package/node_modules/@murphai/core/dist/types.js +7 -0
  303. package/node_modules/@murphai/core/dist/types.js.map +1 -0
  304. package/node_modules/@murphai/core/dist/vault-core-document.d.ts +8 -0
  305. package/node_modules/@murphai/core/dist/vault-core-document.d.ts.map +1 -0
  306. package/node_modules/@murphai/core/dist/vault-core-document.js +16 -0
  307. package/node_modules/@murphai/core/dist/vault-core-document.js.map +1 -0
  308. package/node_modules/@murphai/core/dist/vault-metadata.d.ts +17 -0
  309. package/node_modules/@murphai/core/dist/vault-metadata.d.ts.map +1 -0
  310. package/node_modules/@murphai/core/dist/vault-metadata.js +44 -0
  311. package/node_modules/@murphai/core/dist/vault-metadata.js.map +1 -0
  312. package/node_modules/@murphai/core/dist/vault-upgrade.d.ts +24 -0
  313. package/node_modules/@murphai/core/dist/vault-upgrade.d.ts.map +1 -0
  314. package/node_modules/@murphai/core/dist/vault-upgrade.js +44 -0
  315. package/node_modules/@murphai/core/dist/vault-upgrade.js.map +1 -0
  316. package/node_modules/@murphai/core/dist/vault.d.ts +40 -0
  317. package/node_modules/@murphai/core/dist/vault.d.ts.map +1 -0
  318. package/node_modules/@murphai/core/dist/vault.js +649 -0
  319. package/node_modules/@murphai/core/dist/vault.js.map +1 -0
  320. package/node_modules/@murphai/core/dist/write-policy.d.ts +63 -0
  321. package/node_modules/@murphai/core/dist/write-policy.d.ts.map +1 -0
  322. package/node_modules/@murphai/core/dist/write-policy.js +146 -0
  323. package/node_modules/@murphai/core/dist/write-policy.js.map +1 -0
  324. package/node_modules/@murphai/core/package.json +27 -0
  325. package/node_modules/@murphai/device-syncd/README.md +123 -0
  326. package/node_modules/@murphai/device-syncd/dist/bin.d.ts +2 -0
  327. package/node_modules/@murphai/device-syncd/dist/bin.d.ts.map +1 -0
  328. package/node_modules/@murphai/device-syncd/dist/bin.js +29 -0
  329. package/node_modules/@murphai/device-syncd/dist/bin.js.map +1 -0
  330. package/node_modules/@murphai/device-syncd/dist/client.d.ts +124 -0
  331. package/node_modules/@murphai/device-syncd/dist/client.d.ts.map +1 -0
  332. package/node_modules/@murphai/device-syncd/dist/client.js +199 -0
  333. package/node_modules/@murphai/device-syncd/dist/client.js.map +1 -0
  334. package/node_modules/@murphai/device-syncd/dist/config.d.ts +18 -0
  335. package/node_modules/@murphai/device-syncd/dist/config.d.ts.map +1 -0
  336. package/node_modules/@murphai/device-syncd/dist/config.js +279 -0
  337. package/node_modules/@murphai/device-syncd/dist/config.js.map +1 -0
  338. package/node_modules/@murphai/device-syncd/dist/crypto.d.ts +6 -0
  339. package/node_modules/@murphai/device-syncd/dist/crypto.d.ts.map +1 -0
  340. package/node_modules/@murphai/device-syncd/dist/crypto.js +27 -0
  341. package/node_modules/@murphai/device-syncd/dist/crypto.js.map +1 -0
  342. package/node_modules/@murphai/device-syncd/dist/errors.d.ts +21 -0
  343. package/node_modules/@murphai/device-syncd/dist/errors.d.ts.map +1 -0
  344. package/node_modules/@murphai/device-syncd/dist/errors.js +32 -0
  345. package/node_modules/@murphai/device-syncd/dist/errors.js.map +1 -0
  346. package/node_modules/@murphai/device-syncd/dist/hosted-hints.d.ts +3 -0
  347. package/node_modules/@murphai/device-syncd/dist/hosted-hints.d.ts.map +1 -0
  348. package/node_modules/@murphai/device-syncd/dist/hosted-hints.js +110 -0
  349. package/node_modules/@murphai/device-syncd/dist/hosted-hints.js.map +1 -0
  350. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts +139 -0
  351. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.d.ts.map +1 -0
  352. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js +336 -0
  353. package/node_modules/@murphai/device-syncd/dist/hosted-runtime.js.map +1 -0
  354. package/node_modules/@murphai/device-syncd/dist/http.d.ts +34 -0
  355. package/node_modules/@murphai/device-syncd/dist/http.d.ts.map +1 -0
  356. package/node_modules/@murphai/device-syncd/dist/http.js +644 -0
  357. package/node_modules/@murphai/device-syncd/dist/http.js.map +1 -0
  358. package/node_modules/@murphai/device-syncd/dist/index.d.ts +23 -0
  359. package/node_modules/@murphai/device-syncd/dist/index.d.ts.map +1 -0
  360. package/node_modules/@murphai/device-syncd/dist/index.js +15 -0
  361. package/node_modules/@murphai/device-syncd/dist/index.js.map +1 -0
  362. package/node_modules/@murphai/device-syncd/dist/providers/garmin.d.ts +15 -0
  363. package/node_modules/@murphai/device-syncd/dist/providers/garmin.d.ts.map +1 -0
  364. package/node_modules/@murphai/device-syncd/dist/providers/garmin.js +485 -0
  365. package/node_modules/@murphai/device-syncd/dist/providers/garmin.js.map +1 -0
  366. package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.d.ts +49 -0
  367. package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.d.ts.map +1 -0
  368. package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.js +401 -0
  369. package/node_modules/@murphai/device-syncd/dist/providers/oura-webhooks.js.map +1 -0
  370. package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts +20 -0
  371. package/node_modules/@murphai/device-syncd/dist/providers/oura.d.ts.map +1 -0
  372. package/node_modules/@murphai/device-syncd/dist/providers/oura.js +804 -0
  373. package/node_modules/@murphai/device-syncd/dist/providers/oura.js.map +1 -0
  374. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts +104 -0
  375. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.d.ts.map +1 -0
  376. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js +214 -0
  377. package/node_modules/@murphai/device-syncd/dist/providers/shared-oauth.js.map +1 -0
  378. package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts +15 -0
  379. package/node_modules/@murphai/device-syncd/dist/providers/whoop.d.ts.map +1 -0
  380. package/node_modules/@murphai/device-syncd/dist/providers/whoop.js +551 -0
  381. package/node_modules/@murphai/device-syncd/dist/providers/whoop.js.map +1 -0
  382. package/node_modules/@murphai/device-syncd/dist/public-account.d.ts +4 -0
  383. package/node_modules/@murphai/device-syncd/dist/public-account.d.ts.map +1 -0
  384. package/node_modules/@murphai/device-syncd/dist/public-account.js +13 -0
  385. package/node_modules/@murphai/device-syncd/dist/public-account.js.map +1 -0
  386. package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts +43 -0
  387. package/node_modules/@murphai/device-syncd/dist/public-ingress.d.ts.map +1 -0
  388. package/node_modules/@murphai/device-syncd/dist/public-ingress.js +353 -0
  389. package/node_modules/@murphai/device-syncd/dist/public-ingress.js.map +1 -0
  390. package/node_modules/@murphai/device-syncd/dist/registry.d.ts +3 -0
  391. package/node_modules/@murphai/device-syncd/dist/registry.d.ts.map +1 -0
  392. package/node_modules/@murphai/device-syncd/dist/registry.js +5 -0
  393. package/node_modules/@murphai/device-syncd/dist/registry.js.map +1 -0
  394. package/node_modules/@murphai/device-syncd/dist/service.d.ts +61 -0
  395. package/node_modules/@murphai/device-syncd/dist/service.d.ts.map +1 -0
  396. package/node_modules/@murphai/device-syncd/dist/service.js +496 -0
  397. package/node_modules/@murphai/device-syncd/dist/service.js.map +1 -0
  398. package/node_modules/@murphai/device-syncd/dist/shared.d.ts +26 -0
  399. package/node_modules/@murphai/device-syncd/dist/shared.d.ts.map +1 -0
  400. package/node_modules/@murphai/device-syncd/dist/shared.js +182 -0
  401. package/node_modules/@murphai/device-syncd/dist/shared.js.map +1 -0
  402. package/node_modules/@murphai/device-syncd/dist/store.d.ts +105 -0
  403. package/node_modules/@murphai/device-syncd/dist/store.d.ts.map +1 -0
  404. package/node_modules/@murphai/device-syncd/dist/store.js +965 -0
  405. package/node_modules/@murphai/device-syncd/dist/store.js.map +1 -0
  406. package/node_modules/@murphai/device-syncd/dist/types.d.ts +287 -0
  407. package/node_modules/@murphai/device-syncd/dist/types.d.ts.map +1 -0
  408. package/node_modules/@murphai/device-syncd/dist/types.js +2 -0
  409. package/node_modules/@murphai/device-syncd/dist/types.js.map +1 -0
  410. package/node_modules/@murphai/device-syncd/dist/webhook-verification.d.ts +14 -0
  411. package/node_modules/@murphai/device-syncd/dist/webhook-verification.d.ts.map +1 -0
  412. package/node_modules/@murphai/device-syncd/dist/webhook-verification.js +16 -0
  413. package/node_modules/@murphai/device-syncd/dist/webhook-verification.js.map +1 -0
  414. package/node_modules/@murphai/device-syncd/package.json +85 -0
  415. package/node_modules/@murphai/importers/README.md +34 -0
  416. package/node_modules/@murphai/importers/dist/assessment/core-port.d.ts +13 -0
  417. package/node_modules/@murphai/importers/dist/assessment/core-port.d.ts.map +1 -0
  418. package/node_modules/@murphai/importers/dist/assessment/core-port.js +13 -0
  419. package/node_modules/@murphai/importers/dist/assessment/core-port.js.map +1 -0
  420. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.d.ts +15 -0
  421. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.d.ts.map +1 -0
  422. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js +32 -0
  423. package/node_modules/@murphai/importers/dist/assessment/import-assessment-response.js.map +1 -0
  424. package/node_modules/@murphai/importers/dist/assessment/index.d.ts +4 -0
  425. package/node_modules/@murphai/importers/dist/assessment/index.d.ts.map +1 -0
  426. package/node_modules/@murphai/importers/dist/assessment/index.js +2 -0
  427. package/node_modules/@murphai/importers/dist/assessment/index.js.map +1 -0
  428. package/node_modules/@murphai/importers/dist/core-port.d.ts +119 -0
  429. package/node_modules/@murphai/importers/dist/core-port.d.ts.map +1 -0
  430. package/node_modules/@murphai/importers/dist/core-port.js +22 -0
  431. package/node_modules/@murphai/importers/dist/core-port.js.map +1 -0
  432. package/node_modules/@murphai/importers/dist/create-importers.d.ts +17 -0
  433. package/node_modules/@murphai/importers/dist/create-importers.d.ts.map +1 -0
  434. package/node_modules/@murphai/importers/dist/create-importers.js +68 -0
  435. package/node_modules/@murphai/importers/dist/create-importers.js.map +1 -0
  436. package/node_modules/@murphai/importers/dist/csv-sample-importer.d.ts +22 -0
  437. package/node_modules/@murphai/importers/dist/csv-sample-importer.d.ts.map +1 -0
  438. package/node_modules/@murphai/importers/dist/csv-sample-importer.js +153 -0
  439. package/node_modules/@murphai/importers/dist/csv-sample-importer.js.map +1 -0
  440. package/node_modules/@murphai/importers/dist/device-providers/defaults.d.ts +5 -0
  441. package/node_modules/@murphai/importers/dist/device-providers/defaults.d.ts.map +1 -0
  442. package/node_modules/@murphai/importers/dist/device-providers/defaults.js +11 -0
  443. package/node_modules/@murphai/importers/dist/device-providers/defaults.js.map +1 -0
  444. package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.d.ts +9 -0
  445. package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.d.ts.map +1 -0
  446. package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.js +172 -0
  447. package/node_modules/@murphai/importers/dist/device-providers/garmin-activity-normalizers.js.map +1 -0
  448. package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.d.ts +12 -0
  449. package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.d.ts.map +1 -0
  450. package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.js +619 -0
  451. package/node_modules/@murphai/importers/dist/device-providers/garmin-health-normalizers.js.map +1 -0
  452. package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.d.ts +40 -0
  453. package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.d.ts.map +1 -0
  454. package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.js +295 -0
  455. package/node_modules/@murphai/importers/dist/device-providers/garmin-helpers.js.map +1 -0
  456. package/node_modules/@murphai/importers/dist/device-providers/garmin.d.ts +19 -0
  457. package/node_modules/@murphai/importers/dist/device-providers/garmin.d.ts.map +1 -0
  458. package/node_modules/@murphai/importers/dist/device-providers/garmin.js +150 -0
  459. package/node_modules/@murphai/importers/dist/device-providers/garmin.js.map +1 -0
  460. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts +14 -0
  461. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.d.ts.map +1 -0
  462. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js +37 -0
  463. package/node_modules/@murphai/importers/dist/device-providers/import-device-provider-snapshot.js.map +1 -0
  464. package/node_modules/@murphai/importers/dist/device-providers/index.d.ts +10 -0
  465. package/node_modules/@murphai/importers/dist/device-providers/index.d.ts.map +1 -0
  466. package/node_modules/@murphai/importers/dist/device-providers/index.js +8 -0
  467. package/node_modules/@murphai/importers/dist/device-providers/index.js.map +1 -0
  468. package/node_modules/@murphai/importers/dist/device-providers/oura.d.ts +20 -0
  469. package/node_modules/@murphai/importers/dist/device-providers/oura.d.ts.map +1 -0
  470. package/node_modules/@murphai/importers/dist/device-providers/oura.js +602 -0
  471. package/node_modules/@murphai/importers/dist/device-providers/oura.js.map +1 -0
  472. package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts +491 -0
  473. package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.d.ts.map +1 -0
  474. package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.js +326 -0
  475. package/node_modules/@murphai/importers/dist/device-providers/provider-descriptors.js.map +1 -0
  476. package/node_modules/@murphai/importers/dist/device-providers/registry.d.ts +9 -0
  477. package/node_modules/@murphai/importers/dist/device-providers/registry.d.ts.map +1 -0
  478. package/node_modules/@murphai/importers/dist/device-providers/registry.js +5 -0
  479. package/node_modules/@murphai/importers/dist/device-providers/registry.js.map +1 -0
  480. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.d.ts +81 -0
  481. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.d.ts.map +1 -0
  482. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js +215 -0
  483. package/node_modules/@murphai/importers/dist/device-providers/shared-normalization.js.map +1 -0
  484. package/node_modules/@murphai/importers/dist/device-providers/types.d.ts +12 -0
  485. package/node_modules/@murphai/importers/dist/device-providers/types.d.ts.map +1 -0
  486. package/node_modules/@murphai/importers/dist/device-providers/types.js +2 -0
  487. package/node_modules/@murphai/importers/dist/device-providers/types.js.map +1 -0
  488. package/node_modules/@murphai/importers/dist/device-providers/whoop.d.ts +16 -0
  489. package/node_modules/@murphai/importers/dist/device-providers/whoop.d.ts.map +1 -0
  490. package/node_modules/@murphai/importers/dist/device-providers/whoop.js +410 -0
  491. package/node_modules/@murphai/importers/dist/device-providers/whoop.js.map +1 -0
  492. package/node_modules/@murphai/importers/dist/document-importer.d.ts +15 -0
  493. package/node_modules/@murphai/importers/dist/document-importer.d.ts.map +1 -0
  494. package/node_modules/@murphai/importers/dist/document-importer.js +31 -0
  495. package/node_modules/@murphai/importers/dist/document-importer.js.map +1 -0
  496. package/node_modules/@murphai/importers/dist/index.d.ts +10 -0
  497. package/node_modules/@murphai/importers/dist/index.d.ts.map +1 -0
  498. package/node_modules/@murphai/importers/dist/index.js +9 -0
  499. package/node_modules/@murphai/importers/dist/index.js.map +1 -0
  500. package/node_modules/@murphai/importers/dist/meal-importer.d.ts +15 -0
  501. package/node_modules/@murphai/importers/dist/meal-importer.d.ts.map +1 -0
  502. package/node_modules/@murphai/importers/dist/meal-importer.js +39 -0
  503. package/node_modules/@murphai/importers/dist/meal-importer.js.map +1 -0
  504. package/node_modules/@murphai/importers/dist/preset-registry.d.ts +31 -0
  505. package/node_modules/@murphai/importers/dist/preset-registry.d.ts.map +1 -0
  506. package/node_modules/@murphai/importers/dist/preset-registry.js +96 -0
  507. package/node_modules/@murphai/importers/dist/preset-registry.js.map +1 -0
  508. package/node_modules/@murphai/importers/dist/shared.d.ts +31 -0
  509. package/node_modules/@murphai/importers/dist/shared.d.ts.map +1 -0
  510. package/node_modules/@murphai/importers/dist/shared.js +154 -0
  511. package/node_modules/@murphai/importers/dist/shared.js.map +1 -0
  512. package/node_modules/@murphai/importers/package.json +36 -0
  513. package/node_modules/@murphai/runtime-state/README.md +37 -0
  514. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.d.ts +3 -0
  515. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.d.ts.map +1 -0
  516. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js +80 -0
  517. package/node_modules/@murphai/runtime-state/dist/assistant-local-state-descriptors.js.map +1 -0
  518. package/node_modules/@murphai/runtime-state/dist/assistant-state-security.d.ts +29 -0
  519. package/node_modules/@murphai/runtime-state/dist/assistant-state-security.d.ts.map +1 -0
  520. package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js +159 -0
  521. package/node_modules/@murphai/runtime-state/dist/assistant-state-security.js.map +1 -0
  522. package/node_modules/@murphai/runtime-state/dist/assistant-state.d.ts +33 -0
  523. package/node_modules/@murphai/runtime-state/dist/assistant-state.d.ts.map +1 -0
  524. package/node_modules/@murphai/runtime-state/dist/assistant-state.js +47 -0
  525. package/node_modules/@murphai/runtime-state/dist/assistant-state.js.map +1 -0
  526. package/node_modules/@murphai/runtime-state/dist/assistant-usage.d.ts +56 -0
  527. package/node_modules/@murphai/runtime-state/dist/assistant-usage.d.ts.map +1 -0
  528. package/node_modules/@murphai/runtime-state/dist/assistant-usage.js +189 -0
  529. package/node_modules/@murphai/runtime-state/dist/assistant-usage.js.map +1 -0
  530. package/node_modules/@murphai/runtime-state/dist/atomic-write.d.ts +7 -0
  531. package/node_modules/@murphai/runtime-state/dist/atomic-write.d.ts.map +1 -0
  532. package/node_modules/@murphai/runtime-state/dist/atomic-write.js +27 -0
  533. package/node_modules/@murphai/runtime-state/dist/atomic-write.js.map +1 -0
  534. package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.d.ts +3 -0
  535. package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.d.ts.map +1 -0
  536. package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.js +12 -0
  537. package/node_modules/@murphai/runtime-state/dist/device-sync-local-state-descriptors.js.map +1 -0
  538. package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.d.ts +3 -0
  539. package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.d.ts.map +1 -0
  540. package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.js +13 -0
  541. package/node_modules/@murphai/runtime-state/dist/gateway-local-state-descriptors.js.map +1 -0
  542. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.d.ts +43 -0
  543. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.d.ts.map +1 -0
  544. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.js +203 -0
  545. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-node.js.map +1 -0
  546. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.d.ts +13 -0
  547. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.d.ts.map +1 -0
  548. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.js +46 -0
  549. package/node_modules/@murphai/runtime-state/dist/hosted-bundle-ref.js.map +1 -0
  550. package/node_modules/@murphai/runtime-state/dist/hosted-bundle.d.ts +67 -0
  551. package/node_modules/@murphai/runtime-state/dist/hosted-bundle.d.ts.map +1 -0
  552. package/node_modules/@murphai/runtime-state/dist/hosted-bundle.js +261 -0
  553. package/node_modules/@murphai/runtime-state/dist/hosted-bundle.js.map +1 -0
  554. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts +31 -0
  555. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.d.ts.map +1 -0
  556. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js +211 -0
  557. package/node_modules/@murphai/runtime-state/dist/hosted-bundles.js.map +1 -0
  558. package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts +50 -0
  559. package/node_modules/@murphai/runtime-state/dist/hosted-email.d.ts.map +1 -0
  560. package/node_modules/@murphai/runtime-state/dist/hosted-email.js +191 -0
  561. package/node_modules/@murphai/runtime-state/dist/hosted-email.js.map +1 -0
  562. package/node_modules/@murphai/runtime-state/dist/hosted-user-env.d.ts +14 -0
  563. package/node_modules/@murphai/runtime-state/dist/hosted-user-env.d.ts.map +1 -0
  564. package/node_modules/@murphai/runtime-state/dist/hosted-user-env.js +59 -0
  565. package/node_modules/@murphai/runtime-state/dist/hosted-user-env.js.map +1 -0
  566. package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.d.ts +83 -0
  567. package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.d.ts.map +1 -0
  568. package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.js +308 -0
  569. package/node_modules/@murphai/runtime-state/dist/hosted-user-keys.js.map +1 -0
  570. package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.d.ts +3 -0
  571. package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.d.ts.map +1 -0
  572. package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.js +18 -0
  573. package/node_modules/@murphai/runtime-state/dist/inbox-local-state-descriptors.js.map +1 -0
  574. package/node_modules/@murphai/runtime-state/dist/index.d.ts +7 -0
  575. package/node_modules/@murphai/runtime-state/dist/index.d.ts.map +1 -0
  576. package/node_modules/@murphai/runtime-state/dist/index.js +7 -0
  577. package/node_modules/@murphai/runtime-state/dist/index.js.map +1 -0
  578. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.d.ts +31 -0
  579. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.d.ts.map +1 -0
  580. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.js +120 -0
  581. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-helpers.js.map +1 -0
  582. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.d.ts +3 -0
  583. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.d.ts.map +1 -0
  584. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js +17 -0
  585. package/node_modules/@murphai/runtime-state/dist/local-state-descriptor-manifests.js.map +1 -0
  586. package/node_modules/@murphai/runtime-state/dist/local-state-files.d.ts +10 -0
  587. package/node_modules/@murphai/runtime-state/dist/local-state-files.d.ts.map +1 -0
  588. package/node_modules/@murphai/runtime-state/dist/local-state-files.js +27 -0
  589. package/node_modules/@murphai/runtime-state/dist/local-state-files.js.map +1 -0
  590. package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.d.ts +29 -0
  591. package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.d.ts.map +1 -0
  592. package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.js +82 -0
  593. package/node_modules/@murphai/runtime-state/dist/local-state-taxonomy.js.map +1 -0
  594. package/node_modules/@murphai/runtime-state/dist/locks.d.ts +46 -0
  595. package/node_modules/@murphai/runtime-state/dist/locks.d.ts.map +1 -0
  596. package/node_modules/@murphai/runtime-state/dist/locks.js +187 -0
  597. package/node_modules/@murphai/runtime-state/dist/locks.js.map +1 -0
  598. package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.d.ts +4 -0
  599. package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.d.ts.map +1 -0
  600. package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.js +35 -0
  601. package/node_modules/@murphai/runtime-state/dist/loopback-control-plane.js.map +1 -0
  602. package/node_modules/@murphai/runtime-state/dist/node/index.d.ts +22 -0
  603. package/node_modules/@murphai/runtime-state/dist/node/index.d.ts.map +1 -0
  604. package/node_modules/@murphai/runtime-state/dist/node/index.js +22 -0
  605. package/node_modules/@murphai/runtime-state/dist/node/index.js.map +1 -0
  606. package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.d.ts +3 -0
  607. package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.d.ts.map +1 -0
  608. package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.js +12 -0
  609. package/node_modules/@murphai/runtime-state/dist/parser-local-state-descriptors.js.map +1 -0
  610. package/node_modules/@murphai/runtime-state/dist/process-env.d.ts +4 -0
  611. package/node_modules/@murphai/runtime-state/dist/process-env.d.ts.map +1 -0
  612. package/node_modules/@murphai/runtime-state/dist/process-env.js +124 -0
  613. package/node_modules/@murphai/runtime-state/dist/process-env.js.map +1 -0
  614. package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.d.ts +3 -0
  615. package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.d.ts.map +1 -0
  616. package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.js +13 -0
  617. package/node_modules/@murphai/runtime-state/dist/query-local-state-descriptors.js.map +1 -0
  618. package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts +48 -0
  619. package/node_modules/@murphai/runtime-state/dist/runtime-paths.d.ts.map +1 -0
  620. package/node_modules/@murphai/runtime-state/dist/runtime-paths.js +93 -0
  621. package/node_modules/@murphai/runtime-state/dist/runtime-paths.js.map +1 -0
  622. package/node_modules/@murphai/runtime-state/dist/shared.d.ts +14 -0
  623. package/node_modules/@murphai/runtime-state/dist/shared.d.ts.map +1 -0
  624. package/node_modules/@murphai/runtime-state/dist/shared.js +46 -0
  625. package/node_modules/@murphai/runtime-state/dist/shared.js.map +1 -0
  626. package/node_modules/@murphai/runtime-state/dist/sqlite.d.ts +26 -0
  627. package/node_modules/@murphai/runtime-state/dist/sqlite.d.ts.map +1 -0
  628. package/node_modules/@murphai/runtime-state/dist/sqlite.js +110 -0
  629. package/node_modules/@murphai/runtime-state/dist/sqlite.js.map +1 -0
  630. package/node_modules/@murphai/runtime-state/dist/ulid.d.ts +5 -0
  631. package/node_modules/@murphai/runtime-state/dist/ulid.d.ts.map +1 -0
  632. package/node_modules/@murphai/runtime-state/dist/ulid.js +31 -0
  633. package/node_modules/@murphai/runtime-state/dist/ulid.js.map +1 -0
  634. package/node_modules/@murphai/runtime-state/dist/versioned-json-files.d.ts +24 -0
  635. package/node_modules/@murphai/runtime-state/dist/versioned-json-files.d.ts.map +1 -0
  636. package/node_modules/@murphai/runtime-state/dist/versioned-json-files.js +30 -0
  637. package/node_modules/@murphai/runtime-state/dist/versioned-json-files.js.map +1 -0
  638. package/node_modules/@murphai/runtime-state/dist/versioned-json-state.d.ts +18 -0
  639. package/node_modules/@murphai/runtime-state/dist/versioned-json-state.d.ts.map +1 -0
  640. package/node_modules/@murphai/runtime-state/dist/versioned-json-state.js +25 -0
  641. package/node_modules/@murphai/runtime-state/dist/versioned-json-state.js.map +1 -0
  642. package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.d.ts +3 -0
  643. package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.d.ts.map +1 -0
  644. package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.js +12 -0
  645. package/node_modules/@murphai/runtime-state/dist/write-operation-local-state-descriptors.js.map +1 -0
  646. package/node_modules/@murphai/runtime-state/package.json +30 -0
  647. package/package.json +45 -11
  648. package/dist/.tsbuildinfo +0 -1
  649. package/dist/callback-hosts.d.ts +0 -19
  650. package/dist/callback-hosts.d.ts.map +0 -1
  651. package/dist/callback-hosts.js +0 -19
  652. package/dist/callback-hosts.js.map +0 -1
  653. package/dist/web-control-plane.d.ts +0 -105
  654. package/dist/web-control-plane.d.ts.map +0 -1
  655. package/dist/web-control-plane.js +0 -358
  656. package/dist/web-control-plane.js.map +0 -1
@@ -0,0 +1,886 @@
1
+ import path from "node:path";
2
+ import { createHash, randomUUID } from "node:crypto";
3
+ import { promises as fs } from "node:fs";
4
+ import { copyFileAtomic, copyFileAtomicExclusive, writeTextFileAtomic, } from "../atomic-write.js";
5
+ import { VaultError } from "../errors.js";
6
+ import { ensureDirectory, pathExists, walkVaultFiles } from "../fs.js";
7
+ import { VAULT_LAYOUT } from "../constants.js";
8
+ import { normalizeRelativeVaultPath, normalizeVaultRoot, resolveVaultPath, } from "../path-safety.js";
9
+ import { toIsoTimestamp } from "../time.js";
10
+ import { isErrnoException, isPlainRecord } from "../types.js";
11
+ import { applyImmutableWriteTarget, applyJsonlAppendTarget, applyTextWriteTarget, assertWriteTargetPolicy, prepareVerifiedWriteTarget, } from "../write-policy.js";
12
+ import { acquireCanonicalWriteLock } from "./canonical-write-lock.js";
13
+ export const WRITE_OPERATION_SCHEMA_VERSION = "murph.write-operation.v1";
14
+ export const WRITE_OPERATION_DIRECTORY = ".runtime/operations";
15
+ const PROTECTED_CANONICAL_ROOT_FILES = new Set([VAULT_LAYOUT.metadata, VAULT_LAYOUT.coreDocument]);
16
+ const CANONICAL_WRITE_GUARD_RECEIPT_DIRECTORY_ENV = "MURPH_CANONICAL_WRITE_GUARD_RECEIPT_DIR";
17
+ const WRITE_OPERATION_GUARD_RECEIPT_SCHEMA_VERSION = "murph.write-operation-guard-receipt.v1";
18
+ function isStoredWriteOperationStatus(value) {
19
+ return (value === "staged" ||
20
+ value === "committing" ||
21
+ value === "committed" ||
22
+ value === "rolled_back" ||
23
+ value === "failed");
24
+ }
25
+ function parseWriteOperationActionState(value) {
26
+ return value === "staged" || value === "applied" || value === "reused" || value === "rolled_back"
27
+ ? value
28
+ : null;
29
+ }
30
+ function nowIso() {
31
+ return toIsoTimestamp(new Date(), "updatedAt");
32
+ }
33
+ function generateOperationId() {
34
+ return `op_${randomUUID().replace(/-/g, "")}`;
35
+ }
36
+ function createCommittedPayloadReceipt(content) {
37
+ const buffer = Buffer.from(content);
38
+ return {
39
+ sha256: createHash("sha256").update(buffer).digest("hex"),
40
+ byteLength: buffer.byteLength,
41
+ };
42
+ }
43
+ function normalizeStoredRelativePath(candidate) {
44
+ if (typeof candidate !== "string") {
45
+ return null;
46
+ }
47
+ try {
48
+ const normalized = normalizeRelativeVaultPath(candidate);
49
+ return normalized === candidate ? normalized : null;
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ function parseStoredOptionalBackupRelativePath(record) {
56
+ if (!("backupRelativePath" in record) || record.backupRelativePath === undefined) {
57
+ return undefined;
58
+ }
59
+ return normalizeStoredRelativePath(record.backupRelativePath);
60
+ }
61
+ function parseStoredRequiredStageRelativePath(record) {
62
+ return normalizeStoredRelativePath(record.stageRelativePath);
63
+ }
64
+ function parseStoredActionBase(record) {
65
+ const state = parseWriteOperationActionState(record.state);
66
+ const targetRelativePath = normalizeStoredRelativePath(record.targetRelativePath);
67
+ if (!state || !targetRelativePath) {
68
+ return null;
69
+ }
70
+ return {
71
+ appliedAt: typeof record.appliedAt === "string" ? record.appliedAt : undefined,
72
+ existedBefore: typeof record.existedBefore === "boolean" ? record.existedBefore : undefined,
73
+ rolledBackAt: typeof record.rolledBackAt === "string" ? record.rolledBackAt : undefined,
74
+ state,
75
+ targetRelativePath,
76
+ };
77
+ }
78
+ function parseCommittedPayloadReceipt(value) {
79
+ if (value === undefined) {
80
+ return undefined;
81
+ }
82
+ if (!isPlainRecord(value)) {
83
+ return null;
84
+ }
85
+ const record = value;
86
+ if (typeof record.sha256 !== "string" ||
87
+ !/^[a-f0-9]{64}$/u.test(record.sha256) ||
88
+ typeof record.byteLength !== "number" ||
89
+ !Number.isInteger(record.byteLength) ||
90
+ record.byteLength < 0) {
91
+ return null;
92
+ }
93
+ return {
94
+ sha256: record.sha256,
95
+ byteLength: record.byteLength,
96
+ };
97
+ }
98
+ function resolveGuardReceiptDirectoryFromEnv(env = process.env) {
99
+ const candidate = typeof env[CANONICAL_WRITE_GUARD_RECEIPT_DIRECTORY_ENV] === "string"
100
+ ? env[CANONICAL_WRITE_GUARD_RECEIPT_DIRECTORY_ENV]?.trim()
101
+ : "";
102
+ return candidate ? path.resolve(candidate) : null;
103
+ }
104
+ function metadataRelativePath(operationId) {
105
+ return `${WRITE_OPERATION_DIRECTORY}/${operationId}.json`;
106
+ }
107
+ function stageRootRelativePath(operationId) {
108
+ return `${WRITE_OPERATION_DIRECTORY}/${operationId}`;
109
+ }
110
+ function stageArtifactRelativePath(operationId, fileName) {
111
+ return `${stageRootRelativePath(operationId)}/payloads/${fileName}`;
112
+ }
113
+ function backupArtifactRelativePath(operationId, fileName) {
114
+ return `${stageRootRelativePath(operationId)}/backups/${fileName}`;
115
+ }
116
+ function toStoredOperationError(error) {
117
+ if (error instanceof VaultError) {
118
+ return {
119
+ code: error.code,
120
+ message: error.message,
121
+ };
122
+ }
123
+ if (error instanceof Error) {
124
+ return {
125
+ message: error.message,
126
+ };
127
+ }
128
+ return {
129
+ message: String(error),
130
+ };
131
+ }
132
+ async function readText(absolutePath) {
133
+ return fs.readFile(absolutePath, "utf8");
134
+ }
135
+ async function safeUnlink(absolutePath) {
136
+ try {
137
+ await fs.unlink(absolutePath);
138
+ }
139
+ catch (error) {
140
+ if (isErrnoException(error) && error.code === "ENOENT") {
141
+ return;
142
+ }
143
+ throw error;
144
+ }
145
+ }
146
+ export function isTerminalWriteOperationStatus(status) {
147
+ return status === "committed" || status === "rolled_back";
148
+ }
149
+ export async function listWriteOperationMetadataPaths(vaultRoot) {
150
+ const operationFiles = await walkVaultFiles(vaultRoot, WRITE_OPERATION_DIRECTORY, {
151
+ extension: ".json",
152
+ });
153
+ return operationFiles.filter((relativePath) => path.posix.dirname(relativePath) === WRITE_OPERATION_DIRECTORY);
154
+ }
155
+ function parseStoredAction(value) {
156
+ if (!isPlainRecord(value) || typeof value.kind !== "string") {
157
+ return null;
158
+ }
159
+ const record = value;
160
+ const base = parseStoredActionBase(record);
161
+ if (!base) {
162
+ return null;
163
+ }
164
+ switch (record.kind) {
165
+ case "delete": {
166
+ const backupRelativePath = parseStoredOptionalBackupRelativePath(record);
167
+ if (backupRelativePath === null) {
168
+ return null;
169
+ }
170
+ return {
171
+ kind: "delete",
172
+ ...base,
173
+ backupRelativePath,
174
+ effect: record.effect === "delete" ? record.effect : undefined,
175
+ };
176
+ }
177
+ case "raw_copy": {
178
+ const stageRelativePath = parseStoredRequiredStageRelativePath(record);
179
+ if (!stageRelativePath) {
180
+ return null;
181
+ }
182
+ return {
183
+ kind: "raw_copy",
184
+ ...base,
185
+ allowExistingMatch: record.allowExistingMatch === true,
186
+ effect: record.effect === "copy" || record.effect === "reuse" ? record.effect : undefined,
187
+ mediaType: typeof record.mediaType === "string" ? record.mediaType : "",
188
+ originalFileName: typeof record.originalFileName === "string" ? record.originalFileName : "",
189
+ stageRelativePath,
190
+ };
191
+ }
192
+ case "text_write": {
193
+ const stageRelativePath = parseStoredRequiredStageRelativePath(record);
194
+ if (!stageRelativePath) {
195
+ return null;
196
+ }
197
+ const backupRelativePath = parseStoredOptionalBackupRelativePath(record);
198
+ if (backupRelativePath === null) {
199
+ return null;
200
+ }
201
+ const committedPayloadReceipt = parseCommittedPayloadReceipt(record.committedPayloadReceipt);
202
+ if (committedPayloadReceipt === null) {
203
+ return null;
204
+ }
205
+ return {
206
+ kind: "text_write",
207
+ ...base,
208
+ allowExistingMatch: record.allowExistingMatch === true,
209
+ allowRaw: record.allowRaw === true,
210
+ backupRelativePath,
211
+ committedPayloadReceipt,
212
+ effect: record.effect === "create" || record.effect === "update" || record.effect === "reuse"
213
+ ? record.effect
214
+ : undefined,
215
+ overwrite: record.overwrite !== false,
216
+ stageRelativePath,
217
+ };
218
+ }
219
+ case "jsonl_append": {
220
+ const stageRelativePath = parseStoredRequiredStageRelativePath(record);
221
+ if (!stageRelativePath) {
222
+ return null;
223
+ }
224
+ const committedPayloadReceipt = parseCommittedPayloadReceipt(record.committedPayloadReceipt);
225
+ if (committedPayloadReceipt === null) {
226
+ return null;
227
+ }
228
+ return {
229
+ kind: "jsonl_append",
230
+ ...base,
231
+ committedPayloadReceipt,
232
+ effect: record.effect === "append" ? record.effect : undefined,
233
+ originalSize: typeof record.originalSize === "number" && Number.isFinite(record.originalSize)
234
+ ? record.originalSize
235
+ : undefined,
236
+ stageRelativePath,
237
+ };
238
+ }
239
+ default:
240
+ return null;
241
+ }
242
+ }
243
+ export function isProtectedCanonicalPath(relativePath) {
244
+ let normalizedRelativePath;
245
+ try {
246
+ normalizedRelativePath = normalizeRelativeVaultPath(relativePath);
247
+ }
248
+ catch {
249
+ return false;
250
+ }
251
+ // Raw artifacts stay outside the protected canonical-write set; assistant turns
252
+ // rely on the shared Murph runtime/tool boundary rather than a second workspace guard.
253
+ return (PROTECTED_CANONICAL_ROOT_FILES.has(normalizedRelativePath) ||
254
+ normalizedRelativePath.startsWith(`${VAULT_LAYOUT.journalDirectory}/`) ||
255
+ normalizedRelativePath.startsWith("bank/") ||
256
+ (normalizedRelativePath.startsWith("ledger/") && normalizedRelativePath.endsWith(".jsonl")) ||
257
+ (normalizedRelativePath.startsWith(`${VAULT_LAYOUT.auditDirectory}/`) &&
258
+ normalizedRelativePath.endsWith(".jsonl")));
259
+ }
260
+ export async function listProtectedCanonicalPaths(vaultRoot) {
261
+ const matches = new Set();
262
+ await Promise.all([...PROTECTED_CANONICAL_ROOT_FILES].map(async (relativePath) => {
263
+ if (await pathExists(resolveVaultPath(vaultRoot, relativePath).absolutePath)) {
264
+ matches.add(relativePath);
265
+ }
266
+ }));
267
+ for (const relativeDirectory of [VAULT_LAYOUT.journalDirectory, "bank", "ledger", VAULT_LAYOUT.auditDirectory]) {
268
+ await walkProtectedCanonicalFiles(vaultRoot, relativeDirectory, matches);
269
+ }
270
+ return [...matches].sort();
271
+ }
272
+ async function walkProtectedCanonicalFiles(vaultRoot, relativeDirectory, matches) {
273
+ const absoluteDirectory = resolveVaultPath(vaultRoot, relativeDirectory).absolutePath;
274
+ if (!(await pathExists(absoluteDirectory))) {
275
+ return;
276
+ }
277
+ const entries = await fs.readdir(absoluteDirectory, { withFileTypes: true });
278
+ entries.sort((left, right) => left.name.localeCompare(right.name));
279
+ for (const entry of entries) {
280
+ const childRelativePath = path.posix.join(relativeDirectory, entry.name);
281
+ if (entry.isDirectory()) {
282
+ await walkProtectedCanonicalFiles(vaultRoot, childRelativePath, matches);
283
+ continue;
284
+ }
285
+ if (entry.isFile() && isProtectedCanonicalPath(childRelativePath)) {
286
+ matches.add(childRelativePath);
287
+ }
288
+ }
289
+ }
290
+ function parseStoredActions(value) {
291
+ if (!Array.isArray(value)) {
292
+ return null;
293
+ }
294
+ const actions = [];
295
+ for (const candidate of value) {
296
+ const action = parseStoredAction(candidate);
297
+ if (!action) {
298
+ return null;
299
+ }
300
+ actions.push(action);
301
+ }
302
+ return actions;
303
+ }
304
+ function hasMissingCommittedPayloadReceipts(status, actions) {
305
+ return (status === "committed" &&
306
+ actions.some((action) => (action.kind === "text_write" || action.kind === "jsonl_append") &&
307
+ action.committedPayloadReceipt === undefined));
308
+ }
309
+ function parseStoredOperationError(value) {
310
+ return isPlainRecord(value) && typeof value.message === "string"
311
+ ? {
312
+ message: value.message,
313
+ code: typeof value.code === "string" ? value.code : undefined,
314
+ }
315
+ : undefined;
316
+ }
317
+ function parseStrictStoredWriteOperation(raw) {
318
+ const actions = parseStoredActions(raw.actions);
319
+ if (raw.schemaVersion !== WRITE_OPERATION_SCHEMA_VERSION ||
320
+ typeof raw.operationId !== "string" ||
321
+ typeof raw.operationType !== "string" ||
322
+ typeof raw.summary !== "string" ||
323
+ !isStoredWriteOperationStatus(raw.status) ||
324
+ typeof raw.createdAt !== "string" ||
325
+ typeof raw.updatedAt !== "string" ||
326
+ typeof raw.occurredAt !== "string" ||
327
+ !actions) {
328
+ return null;
329
+ }
330
+ return {
331
+ schemaVersion: WRITE_OPERATION_SCHEMA_VERSION,
332
+ operationId: raw.operationId,
333
+ operationType: raw.operationType,
334
+ summary: raw.summary,
335
+ status: raw.status,
336
+ createdAt: raw.createdAt,
337
+ updatedAt: raw.updatedAt,
338
+ occurredAt: raw.occurredAt,
339
+ actions,
340
+ error: parseStoredOperationError(raw.error),
341
+ };
342
+ }
343
+ function parseRecoverableStoredWriteOperationRecord(raw) {
344
+ const actions = parseStoredActions(raw.actions);
345
+ if (typeof raw.operationId !== "string" ||
346
+ typeof raw.createdAt !== "string" ||
347
+ typeof raw.updatedAt !== "string" ||
348
+ typeof raw.status !== "string" ||
349
+ !actions) {
350
+ return null;
351
+ }
352
+ if (hasMissingCommittedPayloadReceipts(raw.status, actions)) {
353
+ return null;
354
+ }
355
+ return {
356
+ operationId: raw.operationId,
357
+ status: raw.status,
358
+ createdAt: raw.createdAt,
359
+ updatedAt: raw.updatedAt,
360
+ actions,
361
+ };
362
+ }
363
+ export async function readStoredWriteOperation(vaultRoot, relativePath) {
364
+ const resolved = resolveVaultPath(vaultRoot, relativePath);
365
+ const raw = JSON.parse(await readText(resolved.absolutePath));
366
+ if (!isPlainRecord(raw)) {
367
+ throw new VaultError("OPERATION_INVALID", "Write operation metadata must be a JSON object.", {
368
+ relativePath,
369
+ });
370
+ }
371
+ const operation = parseStrictStoredWriteOperation(raw);
372
+ if (!operation) {
373
+ throw new VaultError("OPERATION_INVALID", "Write operation metadata has an unexpected shape.", {
374
+ relativePath,
375
+ });
376
+ }
377
+ if (hasMissingCommittedPayloadReceipts(operation.status, operation.actions)) {
378
+ throw new VaultError("OPERATION_INVALID", "Committed write operation metadata is missing committed payload receipts.", {
379
+ relativePath,
380
+ });
381
+ }
382
+ return operation;
383
+ }
384
+ export async function readRecoverableStoredWriteOperation(vaultRoot, relativePath) {
385
+ try {
386
+ const resolved = resolveVaultPath(vaultRoot, relativePath);
387
+ const raw = JSON.parse(await readText(resolved.absolutePath));
388
+ return isPlainRecord(raw) ? parseRecoverableStoredWriteOperationRecord(raw) : null;
389
+ }
390
+ catch {
391
+ return null;
392
+ }
393
+ }
394
+ export async function runCanonicalWrite({ vaultRoot, operationType, summary, occurredAt = new Date(), mutate, }) {
395
+ const batch = await WriteBatch.create({
396
+ vaultRoot,
397
+ operationType,
398
+ summary,
399
+ occurredAt,
400
+ });
401
+ let result;
402
+ try {
403
+ result = await mutate({
404
+ batch,
405
+ vaultRoot: batch.vaultRoot,
406
+ });
407
+ }
408
+ catch (error) {
409
+ await batch.rollback();
410
+ throw error;
411
+ }
412
+ await batch.commit();
413
+ return result;
414
+ }
415
+ export class WriteBatch {
416
+ vaultRoot;
417
+ operationId;
418
+ metadataRelativePath;
419
+ stageRootRelativePath;
420
+ metadataAbsolutePath;
421
+ stageRootAbsolutePath;
422
+ record;
423
+ constructor(vaultRoot, record) {
424
+ this.vaultRoot = vaultRoot;
425
+ this.operationId = record.operationId;
426
+ this.metadataRelativePath = metadataRelativePath(record.operationId);
427
+ this.stageRootRelativePath = stageRootRelativePath(record.operationId);
428
+ this.metadataAbsolutePath = resolveVaultPath(vaultRoot, this.metadataRelativePath).absolutePath;
429
+ this.stageRootAbsolutePath = resolveVaultPath(vaultRoot, this.stageRootRelativePath).absolutePath;
430
+ this.record = record;
431
+ }
432
+ static async create({ vaultRoot, operationType, summary, occurredAt = new Date(), }) {
433
+ const absoluteRoot = normalizeVaultRoot(vaultRoot);
434
+ const operationId = generateOperationId();
435
+ const createdAt = nowIso();
436
+ const record = {
437
+ schemaVersion: WRITE_OPERATION_SCHEMA_VERSION,
438
+ operationId,
439
+ operationType: String(operationType).trim() || "write_batch",
440
+ summary: String(summary).trim() || "write_batch",
441
+ status: "staged",
442
+ createdAt,
443
+ updatedAt: createdAt,
444
+ occurredAt: toIsoTimestamp(occurredAt, "occurredAt"),
445
+ actions: [],
446
+ };
447
+ const batch = new WriteBatch(absoluteRoot, record);
448
+ await ensureDirectory(path.dirname(batch.metadataAbsolutePath));
449
+ await ensureDirectory(batch.stageRootAbsolutePath);
450
+ await batch.persist();
451
+ return batch;
452
+ }
453
+ async stageRawCopy({ sourcePath, targetRelativePath, allowExistingMatch = false, originalFileName, mediaType, }) {
454
+ this.assertMutable();
455
+ const normalizedTarget = normalizeRelativeVaultPath(targetRelativePath);
456
+ assertWriteTargetPolicy(normalizedTarget, {
457
+ kind: "raw",
458
+ messages: {
459
+ rawRequired: "Raw copies must target the raw/ tree.",
460
+ },
461
+ });
462
+ const sourceAbsolutePath = path.resolve(String(sourcePath ?? "").trim());
463
+ if (!(await pathExists(sourceAbsolutePath))) {
464
+ throw new VaultError("VAULT_SOURCE_MISSING", "Raw source file does not exist.");
465
+ }
466
+ const sourceStats = await fs.stat(sourceAbsolutePath);
467
+ if (!sourceStats.isFile()) {
468
+ throw new VaultError("VAULT_SOURCE_INVALID", "Raw source path must point to a file.");
469
+ }
470
+ const stageRelativePath = stageArtifactRelativePath(this.operationId, `${String(this.record.actions.length).padStart(4, "0")}.raw`);
471
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, stageRelativePath).absolutePath;
472
+ await ensureDirectory(path.dirname(stageAbsolutePath));
473
+ await fs.copyFile(sourceAbsolutePath, stageAbsolutePath);
474
+ this.record.actions.push({
475
+ kind: "raw_copy",
476
+ state: "staged",
477
+ targetRelativePath: normalizedTarget,
478
+ stageRelativePath,
479
+ allowExistingMatch,
480
+ originalFileName,
481
+ mediaType,
482
+ });
483
+ await this.persist();
484
+ return {
485
+ relativePath: normalizedTarget,
486
+ originalFileName,
487
+ mediaType,
488
+ stagedAbsolutePath: stageAbsolutePath,
489
+ };
490
+ }
491
+ async stageRawText({ targetRelativePath, originalFileName, mediaType, content, allowExistingMatch = false, }) {
492
+ return this.stageRawContent({
493
+ targetRelativePath,
494
+ originalFileName,
495
+ mediaType,
496
+ content,
497
+ allowExistingMatch,
498
+ });
499
+ }
500
+ async stageRawBytes({ targetRelativePath, originalFileName, mediaType, content, allowExistingMatch = false, }) {
501
+ return this.stageRawContent({
502
+ targetRelativePath,
503
+ originalFileName,
504
+ mediaType,
505
+ content,
506
+ allowExistingMatch,
507
+ });
508
+ }
509
+ async stageRawContent({ targetRelativePath, originalFileName, mediaType, content, allowExistingMatch = false, }) {
510
+ this.assertMutable();
511
+ const normalizedTarget = normalizeRelativeVaultPath(targetRelativePath);
512
+ assertWriteTargetPolicy(normalizedTarget, {
513
+ kind: "raw",
514
+ messages: {
515
+ rawRequired: "Raw copies must target the raw/ tree.",
516
+ },
517
+ });
518
+ const stageRelativePath = stageArtifactRelativePath(this.operationId, `${String(this.record.actions.length).padStart(4, "0")}.raw`);
519
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, stageRelativePath).absolutePath;
520
+ await ensureDirectory(path.dirname(stageAbsolutePath));
521
+ if (typeof content === "string") {
522
+ await fs.writeFile(stageAbsolutePath, content, "utf8");
523
+ }
524
+ else {
525
+ await fs.writeFile(stageAbsolutePath, content);
526
+ }
527
+ this.record.actions.push({
528
+ kind: "raw_copy",
529
+ state: "staged",
530
+ targetRelativePath: normalizedTarget,
531
+ stageRelativePath,
532
+ allowExistingMatch,
533
+ originalFileName,
534
+ mediaType,
535
+ });
536
+ await this.persist();
537
+ return {
538
+ relativePath: normalizedTarget,
539
+ originalFileName,
540
+ mediaType,
541
+ stagedAbsolutePath: stageAbsolutePath,
542
+ };
543
+ }
544
+ async stageTextWrite(targetRelativePath, content, options = {}) {
545
+ this.assertMutable();
546
+ const normalizedTarget = normalizeRelativeVaultPath(targetRelativePath);
547
+ assertWriteTargetPolicy(normalizedTarget, {
548
+ kind: "text",
549
+ allowAppendOnlyJsonl: options.allowAppendOnlyJsonl,
550
+ allowRaw: options.allowRaw,
551
+ messages: {
552
+ appendOnlyDisallowed: "Use stageJsonlAppend for ledger and audit shards.",
553
+ rawDisallowed: "Use stageRawCopy for raw artifacts.",
554
+ },
555
+ });
556
+ const stageRelativePath = stageArtifactRelativePath(this.operationId, `${String(this.record.actions.length).padStart(4, "0")}.txt`);
557
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, stageRelativePath).absolutePath;
558
+ await ensureDirectory(path.dirname(stageAbsolutePath));
559
+ await fs.writeFile(stageAbsolutePath, content, "utf8");
560
+ this.record.actions.push({
561
+ kind: "text_write",
562
+ state: "staged",
563
+ targetRelativePath: normalizedTarget,
564
+ stageRelativePath,
565
+ overwrite: options.overwrite ?? true,
566
+ allowExistingMatch: options.allowExistingMatch ?? false,
567
+ allowRaw: options.allowRaw ?? false,
568
+ });
569
+ await this.persist();
570
+ return normalizedTarget;
571
+ }
572
+ async stageJsonlAppend(targetRelativePath, content) {
573
+ this.assertMutable();
574
+ const normalizedTarget = normalizeRelativeVaultPath(targetRelativePath);
575
+ assertWriteTargetPolicy(normalizedTarget, {
576
+ kind: "jsonl_append",
577
+ messages: {
578
+ appendOnlyDisallowed: "Append-only writes are restricted to JSONL ledger and audit shards.",
579
+ rawDisallowed: "Raw files are immutable once written.",
580
+ },
581
+ });
582
+ const stageRelativePath = stageArtifactRelativePath(this.operationId, `${String(this.record.actions.length).padStart(4, "0")}.jsonl`);
583
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, stageRelativePath).absolutePath;
584
+ await ensureDirectory(path.dirname(stageAbsolutePath));
585
+ await fs.writeFile(stageAbsolutePath, content, "utf8");
586
+ this.record.actions.push({
587
+ kind: "jsonl_append",
588
+ state: "staged",
589
+ targetRelativePath: normalizedTarget,
590
+ stageRelativePath,
591
+ });
592
+ await this.persist();
593
+ return normalizedTarget;
594
+ }
595
+ async stageDelete(targetRelativePath, options = {}) {
596
+ this.assertMutable();
597
+ const normalizedTarget = normalizeRelativeVaultPath(targetRelativePath);
598
+ assertWriteTargetPolicy(normalizedTarget, {
599
+ kind: "delete",
600
+ allowAppendOnlyJsonl: options.allowAppendOnlyJsonl,
601
+ messages: {
602
+ appendOnlyDisallowed: "Use stageJsonlAppend for ledger and audit shards.",
603
+ rawDisallowed: "Use stageRawCopy for raw artifacts.",
604
+ },
605
+ });
606
+ this.record.actions.push({
607
+ kind: "delete",
608
+ state: "staged",
609
+ targetRelativePath: normalizedTarget,
610
+ });
611
+ await this.persist();
612
+ return normalizedTarget;
613
+ }
614
+ async commit() {
615
+ this.assertMutable();
616
+ const lock = await acquireCanonicalWriteLock(this.vaultRoot);
617
+ try {
618
+ this.record.status = "committing";
619
+ this.record.updatedAt = nowIso();
620
+ this.record.error = undefined;
621
+ await this.persist();
622
+ for (const [index, action] of this.record.actions.entries()) {
623
+ if (action.state === "applied" || action.state === "reused") {
624
+ continue;
625
+ }
626
+ await this.applyAction(index, action);
627
+ }
628
+ this.record.status = "committed";
629
+ this.record.updatedAt = nowIso();
630
+ await this.persist();
631
+ await this.persistGuardReceiptIfConfigured();
632
+ await this.cleanupStageArtifacts();
633
+ }
634
+ catch (error) {
635
+ this.record.error = toStoredOperationError(error);
636
+ this.record.updatedAt = nowIso();
637
+ await this.persist();
638
+ try {
639
+ await this.rollbackAppliedActions();
640
+ this.record.status = "rolled_back";
641
+ this.record.updatedAt = nowIso();
642
+ await this.persist();
643
+ await this.cleanupStageArtifacts();
644
+ }
645
+ catch (rollbackError) {
646
+ this.record.status = "failed";
647
+ this.record.error = toStoredOperationError(rollbackError);
648
+ this.record.updatedAt = nowIso();
649
+ await this.persist();
650
+ }
651
+ throw error;
652
+ }
653
+ finally {
654
+ await lock.release();
655
+ }
656
+ }
657
+ async rollback() {
658
+ this.assertMutable();
659
+ const lock = await acquireCanonicalWriteLock(this.vaultRoot);
660
+ try {
661
+ await this.rollbackAppliedActions();
662
+ this.record.status = "rolled_back";
663
+ this.record.updatedAt = nowIso();
664
+ this.record.error = undefined;
665
+ await this.persist();
666
+ await this.cleanupStageArtifacts();
667
+ }
668
+ finally {
669
+ await lock.release();
670
+ }
671
+ }
672
+ assertMutable() {
673
+ if (isTerminalWriteOperationStatus(this.record.status) || this.record.status === "failed") {
674
+ throw new VaultError("OPERATION_STATE_INVALID", `Write batch "${this.operationId}" can no longer be modified after status "${this.record.status}".`);
675
+ }
676
+ }
677
+ async persist() {
678
+ await writeTextFileAtomic(this.metadataAbsolutePath, `${JSON.stringify(this.record, null, 2)}\n`);
679
+ }
680
+ async cleanupStageArtifacts() {
681
+ await fs.rm(this.stageRootAbsolutePath, { recursive: true, force: true });
682
+ }
683
+ async persistGuardReceiptIfConfigured() {
684
+ const receiptRoot = resolveGuardReceiptDirectoryFromEnv();
685
+ if (!receiptRoot) {
686
+ return;
687
+ }
688
+ const actions = [];
689
+ await ensureDirectory(receiptRoot);
690
+ for (const [index, action] of this.record.actions.entries()) {
691
+ if (!isProtectedCanonicalPath(action.targetRelativePath)) {
692
+ continue;
693
+ }
694
+ if (action.kind === "delete") {
695
+ actions.push({
696
+ kind: "delete",
697
+ targetRelativePath: action.targetRelativePath,
698
+ });
699
+ continue;
700
+ }
701
+ if (action.kind !== "text_write" && action.kind !== "jsonl_append") {
702
+ continue;
703
+ }
704
+ const payloadReceipt = action.committedPayloadReceipt;
705
+ if (!payloadReceipt) {
706
+ continue;
707
+ }
708
+ const payloadDirectory = path.join(receiptRoot, this.operationId);
709
+ const payloadFileName = `${String(index).padStart(4, "0")}.${action.kind === "text_write" ? "txt" : "jsonl"}`;
710
+ const payloadAbsolutePath = path.join(payloadDirectory, payloadFileName);
711
+ const payloadRelativePath = path.posix.join(this.operationId, payloadFileName);
712
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, action.stageRelativePath).absolutePath;
713
+ await ensureDirectory(payloadDirectory);
714
+ await fs.copyFile(stageAbsolutePath, payloadAbsolutePath);
715
+ actions.push({
716
+ kind: action.kind,
717
+ targetRelativePath: action.targetRelativePath,
718
+ committedPayloadReceipt: payloadReceipt,
719
+ payloadRelativePath,
720
+ });
721
+ }
722
+ if (actions.length === 0) {
723
+ return;
724
+ }
725
+ const receipt = {
726
+ schemaVersion: WRITE_OPERATION_GUARD_RECEIPT_SCHEMA_VERSION,
727
+ operationId: this.operationId,
728
+ createdAt: this.record.createdAt,
729
+ updatedAt: this.record.updatedAt,
730
+ actions,
731
+ };
732
+ await fs.writeFile(path.join(receiptRoot, `${this.operationId}.json`), `${JSON.stringify(receipt, null, 2)}\n`, "utf8");
733
+ }
734
+ async applyAction(index, action) {
735
+ if (action.kind === "raw_copy") {
736
+ await this.applyRawCopy(action);
737
+ return;
738
+ }
739
+ if (action.kind === "text_write") {
740
+ await this.applyTextWrite(index, action);
741
+ return;
742
+ }
743
+ if (action.kind === "jsonl_append") {
744
+ await this.applyJsonlAppend(action);
745
+ return;
746
+ }
747
+ await this.applyDelete(index, action);
748
+ }
749
+ async applyRawCopy(action) {
750
+ const target = await prepareVerifiedWriteTarget(this.vaultRoot, action.targetRelativePath);
751
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, action.stageRelativePath).absolutePath;
752
+ const stagedContent = await fs.readFile(stageAbsolutePath);
753
+ const result = await applyImmutableWriteTarget({
754
+ allowExistingMatch: action.allowExistingMatch,
755
+ createEffect: "copy",
756
+ createTarget: () => copyFileAtomicExclusive(stageAbsolutePath, target.absolutePath),
757
+ existsErrorMessage: "Raw target already exists and may not be overwritten.",
758
+ matchesExistingContent: async () => {
759
+ const existingContent = await fs.readFile(target.absolutePath);
760
+ return existingContent.equals(stagedContent);
761
+ },
762
+ target,
763
+ });
764
+ action.state = result.effect === "reuse" ? "reused" : "applied";
765
+ action.effect = result.effect === "reuse" ? "reuse" : "copy";
766
+ action.existedBefore = result.existedBefore;
767
+ action.appliedAt = nowIso();
768
+ this.record.updatedAt = action.appliedAt;
769
+ await this.persist();
770
+ }
771
+ async applyTextWrite(index, action) {
772
+ const target = await prepareVerifiedWriteTarget(this.vaultRoot, action.targetRelativePath);
773
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, action.stageRelativePath).absolutePath;
774
+ const stagedContent = await readText(stageAbsolutePath);
775
+ const result = await applyTextWriteTarget({
776
+ allowExistingMatch: action.allowExistingMatch,
777
+ backupExisting: action.overwrite
778
+ ? async () => {
779
+ const backupRelativePath = action.backupRelativePath ??
780
+ backupArtifactRelativePath(this.operationId, `${String(index).padStart(4, "0")}.bak`);
781
+ await this.ensureBackupArtifactExists(target.absolutePath, backupRelativePath);
782
+ action.backupRelativePath = backupRelativePath;
783
+ }
784
+ : undefined,
785
+ createTarget: () => copyFileAtomicExclusive(stageAbsolutePath, target.absolutePath),
786
+ matchesExistingContent: async () => {
787
+ const existingContent = await readText(target.absolutePath);
788
+ return existingContent === stagedContent;
789
+ },
790
+ overwrite: action.overwrite,
791
+ replaceTarget: () => copyFileAtomic(stageAbsolutePath, target.absolutePath),
792
+ target,
793
+ });
794
+ action.state = result.effect === "reuse" ? "reused" : "applied";
795
+ action.effect = result.effect;
796
+ action.existedBefore = result.existedBefore;
797
+ action.committedPayloadReceipt = createCommittedPayloadReceipt(stagedContent);
798
+ action.appliedAt = nowIso();
799
+ this.record.updatedAt = action.appliedAt;
800
+ await this.persist();
801
+ }
802
+ async applyJsonlAppend(action) {
803
+ const target = await prepareVerifiedWriteTarget(this.vaultRoot, action.targetRelativePath);
804
+ const stageAbsolutePath = resolveVaultPath(this.vaultRoot, action.stageRelativePath).absolutePath;
805
+ const payload = await readText(stageAbsolutePath);
806
+ const result = await applyJsonlAppendTarget({
807
+ appendPayload: (payload) => fs.appendFile(target.absolutePath, payload, "utf8"),
808
+ readPayload: async () => payload,
809
+ target,
810
+ });
811
+ action.state = "applied";
812
+ action.effect = result.effect;
813
+ action.existedBefore = result.existedBefore;
814
+ action.originalSize = result.originalSize;
815
+ action.committedPayloadReceipt = createCommittedPayloadReceipt(payload);
816
+ action.appliedAt = nowIso();
817
+ this.record.updatedAt = action.appliedAt;
818
+ await this.persist();
819
+ }
820
+ async applyDelete(index, action) {
821
+ const target = await prepareVerifiedWriteTarget(this.vaultRoot, action.targetRelativePath);
822
+ const existedBefore = await pathExists(target.absolutePath);
823
+ if (!existedBefore) {
824
+ action.state = "reused";
825
+ action.effect = "delete";
826
+ action.existedBefore = false;
827
+ action.appliedAt = nowIso();
828
+ this.record.updatedAt = action.appliedAt;
829
+ await this.persist();
830
+ return;
831
+ }
832
+ const backupRelativePath = backupArtifactRelativePath(this.operationId, `${String(index).padStart(4, "0")}.bak`);
833
+ await this.ensureBackupArtifactExists(target.absolutePath, backupRelativePath);
834
+ await fs.unlink(target.absolutePath);
835
+ action.state = "applied";
836
+ action.effect = "delete";
837
+ action.existedBefore = true;
838
+ action.backupRelativePath = backupRelativePath;
839
+ action.appliedAt = nowIso();
840
+ this.record.updatedAt = action.appliedAt;
841
+ await this.persist();
842
+ }
843
+ async rollbackAppliedActions() {
844
+ for (const action of [...this.record.actions].reverse()) {
845
+ if (action.state !== "applied") {
846
+ continue;
847
+ }
848
+ if (action.kind === "raw_copy") {
849
+ await safeUnlink(resolveVaultPath(this.vaultRoot, action.targetRelativePath).absolutePath);
850
+ }
851
+ else if (action.kind === "text_write") {
852
+ if (action.effect === "create") {
853
+ await safeUnlink(resolveVaultPath(this.vaultRoot, action.targetRelativePath).absolutePath);
854
+ }
855
+ else if (action.backupRelativePath) {
856
+ const targetAbsolutePath = resolveVaultPath(this.vaultRoot, action.targetRelativePath).absolutePath;
857
+ const backupAbsolutePath = resolveVaultPath(this.vaultRoot, action.backupRelativePath).absolutePath;
858
+ await copyFileAtomic(backupAbsolutePath, targetAbsolutePath);
859
+ }
860
+ }
861
+ else if (action.kind === "jsonl_append") {
862
+ const targetAbsolutePath = resolveVaultPath(this.vaultRoot, action.targetRelativePath).absolutePath;
863
+ if (!action.existedBefore) {
864
+ await safeUnlink(targetAbsolutePath);
865
+ }
866
+ else {
867
+ await fs.truncate(targetAbsolutePath, action.originalSize ?? 0);
868
+ }
869
+ }
870
+ else if (action.kind === "delete" && action.backupRelativePath) {
871
+ const targetAbsolutePath = resolveVaultPath(this.vaultRoot, action.targetRelativePath).absolutePath;
872
+ const backupAbsolutePath = resolveVaultPath(this.vaultRoot, action.backupRelativePath).absolutePath;
873
+ await copyFileAtomic(backupAbsolutePath, targetAbsolutePath);
874
+ }
875
+ action.state = "rolled_back";
876
+ action.rolledBackAt = nowIso();
877
+ }
878
+ }
879
+ async ensureBackupArtifactExists(sourceAbsolutePath, backupRelativePath) {
880
+ const backupAbsolutePath = resolveVaultPath(this.vaultRoot, backupRelativePath).absolutePath;
881
+ if (!(await pathExists(backupAbsolutePath))) {
882
+ await copyFileAtomicExclusive(sourceAbsolutePath, backupAbsolutePath);
883
+ }
884
+ }
885
+ }
886
+ //# sourceMappingURL=write-batch.js.map