@powerhousedao/shared 6.2.3-dev.7 → 6.2.3-dev.71

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 (317) hide show
  1. package/dist/analytics/index.d.ts +4 -4
  2. package/dist/analytics/index.d.ts.map +1 -1
  3. package/dist/analytics/index.js +25 -24
  4. package/dist/analytics/index.js.map +1 -1
  5. package/dist/clis/args/{access-token-To5LaIfL.mjs → access-token-3Hqv_U8I.mjs} +2 -2
  6. package/dist/clis/args/{access-token-To5LaIfL.mjs.map → access-token-3Hqv_U8I.mjs.map} +1 -1
  7. package/dist/clis/args/access-token-C5sKsH2O.d.mts +16 -0
  8. package/dist/clis/args/access-token-C5sKsH2O.d.mts.map +1 -0
  9. package/dist/clis/args/access-token.d.mts +3 -2
  10. package/dist/clis/args/access-token.mjs +1 -1
  11. package/dist/clis/args/{common-CcYbXrBx.mjs → common-BXabdhiO.mjs} +30 -7
  12. package/dist/clis/args/common-BXabdhiO.mjs.map +1 -0
  13. package/dist/clis/args/common-Bnm859xU.d.mts +186 -0
  14. package/dist/clis/args/common-Bnm859xU.d.mts.map +1 -0
  15. package/dist/clis/args/common.d.mts +3 -2
  16. package/dist/clis/args/common.mjs +1 -1
  17. package/dist/clis/args/{connect-BVVvCmL9.mjs → connect-BLAht4dO.mjs} +9 -4
  18. package/dist/clis/args/connect-BLAht4dO.mjs.map +1 -0
  19. package/dist/clis/args/connect-DjeiqXus.d.mts +450 -0
  20. package/dist/clis/args/connect-DjeiqXus.d.mts.map +1 -0
  21. package/dist/clis/args/connect.d.mts +3 -2
  22. package/dist/clis/args/connect.mjs +1 -1
  23. package/dist/clis/args/dist-CorQTQL-.mjs +1533 -0
  24. package/dist/clis/args/dist-CorQTQL-.mjs.map +1 -0
  25. package/dist/clis/args/{generate-CA916Fvj.mjs → generate-BOItUNvP.mjs} +40 -2
  26. package/dist/clis/args/generate-BOItUNvP.mjs.map +1 -0
  27. package/dist/clis/args/generate-BPBBLeUD.d.mts +103 -0
  28. package/dist/clis/args/generate-BPBBLeUD.d.mts.map +1 -0
  29. package/dist/clis/args/generate.d.mts +3 -2
  30. package/dist/clis/args/generate.mjs +1 -1
  31. package/dist/clis/args/{help-Bqbgbalu.mjs → help-Dejwe6Bz.mjs} +43 -16
  32. package/dist/clis/args/help-Dejwe6Bz.mjs.map +1 -0
  33. package/dist/clis/args/help-KuqI-EEG.d.mts +203 -0
  34. package/dist/clis/args/help-KuqI-EEG.d.mts.map +1 -0
  35. package/dist/clis/args/help.d.mts +3 -2
  36. package/dist/clis/args/help.mjs +1 -1
  37. package/dist/clis/args/index.d.mts +20 -19
  38. package/dist/clis/args/index.mjs +18 -18
  39. package/dist/clis/args/init-CTaK80wE.d.mts +55 -0
  40. package/dist/clis/args/init-CTaK80wE.d.mts.map +1 -0
  41. package/dist/clis/args/{init-rz9Ei7nq.mjs → init-xlCNZ8Oe.mjs} +7 -2
  42. package/dist/clis/args/{init-rz9Ei7nq.mjs.map → init-xlCNZ8Oe.mjs.map} +1 -1
  43. package/dist/clis/args/init.d.mts +3 -2
  44. package/dist/clis/args/init.mjs +1 -1
  45. package/dist/clis/args/inspect-BjRmtB86.d.mts +13 -0
  46. package/dist/clis/args/inspect-BjRmtB86.d.mts.map +1 -0
  47. package/dist/clis/args/{inspect-tckH8mSw.mjs → inspect-UNQgtuR0.mjs} +2 -2
  48. package/dist/clis/args/{inspect-tckH8mSw.mjs.map → inspect-UNQgtuR0.mjs.map} +1 -1
  49. package/dist/clis/args/inspect.d.mts +3 -2
  50. package/dist/clis/args/inspect.mjs +1 -1
  51. package/dist/clis/args/install-B0tMyUMw.d.mts +37 -0
  52. package/dist/clis/args/install-B0tMyUMw.d.mts.map +1 -0
  53. package/dist/clis/args/{install-Sz2DlCHh.mjs → install-F-27kF6m.mjs} +2 -2
  54. package/dist/clis/args/{install-Sz2DlCHh.mjs.map → install-F-27kF6m.mjs.map} +1 -1
  55. package/dist/clis/args/install.d.mts +3 -2
  56. package/dist/clis/args/install.mjs +1 -1
  57. package/dist/clis/args/{list-DM2d6f1m.mjs → list-Bkfn8Yuo.mjs} +2 -2
  58. package/dist/clis/args/{list-DM2d6f1m.mjs.map → list-Bkfn8Yuo.mjs.map} +1 -1
  59. package/dist/clis/args/list-DrbxA7JJ.d.mts +10 -0
  60. package/dist/clis/args/list-DrbxA7JJ.d.mts.map +1 -0
  61. package/dist/clis/args/list.d.mts +3 -2
  62. package/dist/clis/args/list.mjs +1 -1
  63. package/dist/clis/args/{login-DiKT5Jfu.mjs → login-CIFkQExi.mjs} +2 -2
  64. package/dist/clis/args/{login-DiKT5Jfu.mjs.map → login-CIFkQExi.mjs.map} +1 -1
  65. package/dist/clis/args/login-CXRJXg71.d.mts +25 -0
  66. package/dist/clis/args/login-CXRJXg71.d.mts.map +1 -0
  67. package/dist/clis/args/login.d.mts +3 -2
  68. package/dist/clis/args/login.mjs +1 -1
  69. package/dist/clis/args/migrate-DkCQRL2D.d.mts +19 -0
  70. package/dist/clis/args/migrate-DkCQRL2D.d.mts.map +1 -0
  71. package/dist/clis/args/{migrate-CG_gWc4k.mjs → migrate-DwJGhc2d.mjs} +2 -2
  72. package/dist/clis/args/{migrate-CG_gWc4k.mjs.map → migrate-DwJGhc2d.mjs.map} +1 -1
  73. package/dist/clis/args/migrate.d.mts +3 -2
  74. package/dist/clis/args/migrate.mjs +1 -1
  75. package/dist/clis/args/publish-CeW4bOrl.d.mts +16 -0
  76. package/dist/clis/args/publish-CeW4bOrl.d.mts.map +1 -0
  77. package/dist/clis/args/{publish-DDZYsUfV.mjs → publish-DHqlGWmL.mjs} +2 -2
  78. package/dist/clis/args/{publish-DDZYsUfV.mjs.map → publish-DHqlGWmL.mjs.map} +1 -1
  79. package/dist/clis/args/publish.d.mts +3 -2
  80. package/dist/clis/args/publish.mjs +1 -1
  81. package/dist/clis/args/{registry-C_OVFQmI.mjs → registry-DIwES3l2.mjs} +2 -2
  82. package/dist/clis/args/{registry-C_OVFQmI.mjs.map → registry-DIwES3l2.mjs.map} +1 -1
  83. package/dist/clis/args/registry-DNH8xuaE.d.mts +17 -0
  84. package/dist/clis/args/registry-DNH8xuaE.d.mts.map +1 -0
  85. package/dist/clis/args/registry.d.mts +3 -2
  86. package/dist/clis/args/registry.mjs +1 -1
  87. package/dist/clis/args/run-l_LiMplO.mjs +28 -0
  88. package/dist/clis/args/run-l_LiMplO.mjs.map +1 -0
  89. package/dist/clis/args/run.d.mts +18 -0
  90. package/dist/clis/args/run.d.mts.map +1 -0
  91. package/dist/clis/args/run.mjs +2 -0
  92. package/dist/clis/args/{service-CHOOr0Gg.mjs → service-Cpjlyeu5.mjs} +2 -2
  93. package/dist/clis/args/{service-CHOOr0Gg.mjs.map → service-Cpjlyeu5.mjs.map} +1 -1
  94. package/dist/clis/args/service-DiTFThbn.d.mts +27 -0
  95. package/dist/clis/args/service-DiTFThbn.d.mts.map +1 -0
  96. package/dist/clis/args/service.d.mts +3 -2
  97. package/dist/clis/args/service.mjs +1 -1
  98. package/dist/clis/args/{switchboard-Dsp7nosi.mjs → switchboard-CCaAtU56.mjs} +2 -2
  99. package/dist/clis/args/{switchboard-Dsp7nosi.mjs.map → switchboard-CCaAtU56.mjs.map} +1 -1
  100. package/dist/clis/args/switchboard-RrNb1fUH.d.mts +70 -0
  101. package/dist/clis/args/switchboard-RrNb1fUH.d.mts.map +1 -0
  102. package/dist/clis/args/switchboard.d.mts +3 -2
  103. package/dist/clis/args/switchboard.mjs +1 -1
  104. package/dist/clis/args/{uninstall-CTwTX0u_.mjs → uninstall-3U0B8g5c.mjs} +2 -2
  105. package/dist/clis/args/{uninstall-CTwTX0u_.mjs.map → uninstall-3U0B8g5c.mjs.map} +1 -1
  106. package/dist/clis/args/uninstall-CDx7lwxn.d.mts +28 -0
  107. package/dist/clis/args/uninstall-CDx7lwxn.d.mts.map +1 -0
  108. package/dist/clis/args/uninstall.d.mts +3 -2
  109. package/dist/clis/args/uninstall.mjs +1 -1
  110. package/dist/clis/args/unpublish-CEDsk6uv.d.mts +22 -0
  111. package/dist/clis/args/unpublish-CEDsk6uv.d.mts.map +1 -0
  112. package/dist/clis/args/{unpublish-BPMkGEg5.mjs → unpublish-s9zUh6Gw.mjs} +2 -2
  113. package/dist/clis/args/{unpublish-BPMkGEg5.mjs.map → unpublish-s9zUh6Gw.mjs.map} +1 -1
  114. package/dist/clis/args/unpublish.d.mts +3 -2
  115. package/dist/clis/args/unpublish.mjs +1 -1
  116. package/dist/clis/args/{vetra-b4KUu1Ax.mjs → vetra-BUNlAAPp.mjs} +2 -2
  117. package/dist/clis/args/{vetra-b4KUu1Ax.mjs.map → vetra-BUNlAAPp.mjs.map} +1 -1
  118. package/dist/clis/args/vetra-DkDaWFPi.d.mts +111 -0
  119. package/dist/clis/args/vetra-DkDaWFPi.d.mts.map +1 -0
  120. package/dist/clis/args/vetra-ports.test.d.mts +2 -1
  121. package/dist/clis/args/vetra-ports.test.mjs +7366 -5728
  122. package/dist/clis/args/vetra-ports.test.mjs.map +1 -1
  123. package/dist/clis/args/vetra.d.mts +3 -2
  124. package/dist/clis/args/vetra.mjs +1 -1
  125. package/dist/clis/build-config-tJhHVdPm.mjs +277 -0
  126. package/dist/clis/build-config-tJhHVdPm.mjs.map +1 -0
  127. package/dist/clis/build-config.d.mts +56 -10616
  128. package/dist/clis/build-config.d.mts.map +1 -1
  129. package/dist/clis/build-config.mjs +2 -88
  130. package/dist/clis/build-pieces.d.mts +160 -0
  131. package/dist/clis/build-pieces.d.mts.map +1 -0
  132. package/dist/clis/build-pieces.mjs +549 -0
  133. package/dist/clis/build-pieces.mjs.map +1 -0
  134. package/dist/clis/command-names.d.mts +2 -2
  135. package/dist/clis/command-names.d.mts.map +1 -1
  136. package/dist/clis/command-names.mjs +1 -0
  137. package/dist/clis/command-names.mjs.map +1 -1
  138. package/dist/clis/constants.d.mts +3 -462
  139. package/dist/clis/constants.mjs +46 -13
  140. package/dist/clis/constants.mjs.map +1 -1
  141. package/dist/clis/feature-flags.d.mts +17 -0
  142. package/dist/clis/feature-flags.d.mts.map +1 -0
  143. package/dist/clis/feature-flags.mjs +21 -0
  144. package/dist/clis/feature-flags.mjs.map +1 -0
  145. package/dist/clis/index-DnZYG-8g.d.mts +11154 -0
  146. package/dist/clis/index-DnZYG-8g.d.mts.map +1 -0
  147. package/dist/clis/index.d.mts +3390 -1963
  148. package/dist/clis/index.d.mts.map +1 -1
  149. package/dist/clis/index.mjs +1052 -854
  150. package/dist/clis/index.mjs.map +1 -1
  151. package/dist/clis/package-style.d.mts +32 -0
  152. package/dist/clis/package-style.d.mts.map +1 -0
  153. package/dist/clis/package-style.mjs +102 -0
  154. package/dist/clis/package-style.mjs.map +1 -0
  155. package/dist/clis/ph-dir.d.mts +26 -0
  156. package/dist/clis/ph-dir.d.mts.map +1 -0
  157. package/dist/clis/ph-dir.mjs +37 -0
  158. package/dist/clis/ph-dir.mjs.map +1 -0
  159. package/dist/clis/project-env.d.mts +4 -4
  160. package/dist/clis/project-env.d.mts.map +1 -1
  161. package/dist/clis/project-env.mjs.map +1 -1
  162. package/dist/clis/project-ports.d.mts +5 -5
  163. package/dist/clis/project-ports.d.mts.map +1 -1
  164. package/dist/clis/project-ports.mjs +1 -1
  165. package/dist/clis/project-ports.mjs.map +1 -1
  166. package/dist/clis/rolldown-runtime-B4iAMlE-.mjs +35 -0
  167. package/dist/clis/services/telemetry.d.mts +7 -7
  168. package/dist/clis/services/telemetry.d.mts.map +1 -1
  169. package/dist/clis/services/telemetry.mjs.map +1 -1
  170. package/dist/clis/types-DT6KawYx.d.mts +2317 -0
  171. package/dist/clis/types-DT6KawYx.d.mts.map +1 -0
  172. package/dist/clis/utils.d.mts +4 -4
  173. package/dist/clis/utils.d.mts.map +1 -1
  174. package/dist/clis/utils.mjs.map +1 -1
  175. package/dist/{config-loader-B845Hidf.js → config-loader-BWt0c0eU.js} +48 -11
  176. package/dist/config-loader-BWt0c0eU.js.map +1 -0
  177. package/dist/connect/config-loader.d.ts +21 -8
  178. package/dist/connect/config-loader.d.ts.map +1 -1
  179. package/dist/connect/config-loader.js +2 -2
  180. package/dist/connect/connect-config-schema.d.ts +3 -0
  181. package/dist/connect/connect-config-schema.js +445 -0
  182. package/dist/connect/connect-config-schema.js.map +1 -0
  183. package/dist/connect/image-ref.d.ts +32 -0
  184. package/dist/connect/image-ref.d.ts.map +1 -0
  185. package/dist/connect/image-ref.js +80 -0
  186. package/dist/connect/image-ref.js.map +1 -0
  187. package/dist/connect/index.d.ts +220 -643
  188. package/dist/connect/index.d.ts.map +1 -1
  189. package/dist/connect/index.js +432 -507
  190. package/dist/connect/index.js.map +1 -1
  191. package/dist/connect/json-adapter.d.ts +3 -4
  192. package/dist/connect/json-adapter.d.ts.map +1 -1
  193. package/dist/connect/json-adapter.js.map +1 -1
  194. package/dist/connect-config-schema-1-O1CQ4v.d.ts +1731 -0
  195. package/dist/connect-config-schema-1-O1CQ4v.d.ts.map +1 -0
  196. package/dist/constants-CcaK3k1D.d.ts +9 -0
  197. package/dist/constants-CcaK3k1D.d.ts.map +1 -0
  198. package/dist/constants.d.ts +3 -2
  199. package/dist/constants.js +15 -5
  200. package/dist/constants.js.map +1 -1
  201. package/dist/document-drive/index.d.ts +103 -101
  202. package/dist/document-drive/index.d.ts.map +1 -1
  203. package/dist/document-drive/index.js +40 -31
  204. package/dist/document-drive/index.js.map +1 -1
  205. package/dist/document-model/errors.d.ts +3 -0
  206. package/dist/document-model/errors.js +152 -0
  207. package/dist/document-model/errors.js.map +1 -0
  208. package/dist/document-model/index.d.ts +5 -4
  209. package/dist/document-model/index.js +298 -391
  210. package/dist/document-model/index.js.map +1 -1
  211. package/dist/document-model/mock.d.ts +2 -3
  212. package/dist/document-model/mock.d.ts.map +1 -1
  213. package/dist/document-model/mock.js +2 -1
  214. package/dist/document-model/mock.js.map +1 -1
  215. package/dist/document-model/utils.d.ts +3 -2
  216. package/dist/document-model/utils.js +1 -1
  217. package/dist/document-model/version.d.ts +3 -0
  218. package/dist/document-model/version.js +8 -0
  219. package/dist/document-model/version.js.map +1 -0
  220. package/dist/host-tokens/index.d.ts +3 -0
  221. package/dist/host-tokens/index.js +278 -0
  222. package/dist/host-tokens/index.js.map +1 -0
  223. package/dist/index-DIM6qtzj.d.ts +227 -0
  224. package/dist/index-DIM6qtzj.d.ts.map +1 -0
  225. package/dist/index-DvbhwImT.d.ts +36 -0
  226. package/dist/index-DvbhwImT.d.ts.map +1 -0
  227. package/dist/index.d.ts +7 -6
  228. package/dist/index.js.map +1 -1
  229. package/dist/processors/index.d.ts +3 -2
  230. package/dist/processors/index.js +63 -4
  231. package/dist/processors/index.js.map +1 -1
  232. package/dist/purge-v06m_oGz.js +381 -0
  233. package/dist/purge-v06m_oGz.js.map +1 -0
  234. package/dist/registry/index.d.ts +15 -15
  235. package/dist/registry/index.d.ts.map +1 -1
  236. package/dist/registry/index.js +25 -7
  237. package/dist/registry/index.js.map +1 -1
  238. package/dist/registry/manifest-slim.d.ts +4 -3
  239. package/dist/registry/manifest-slim.d.ts.map +1 -1
  240. package/dist/registry/manifest-slim.js +21 -0
  241. package/dist/registry/manifest-slim.js.map +1 -1
  242. package/dist/registry/updates.d.ts +3 -3
  243. package/dist/registry/updates.d.ts.map +1 -1
  244. package/dist/registry/updates.js.map +1 -1
  245. package/dist/registry/urls.d.ts +2 -2
  246. package/dist/registry/urls.d.ts.map +1 -1
  247. package/dist/registry/urls.js.map +1 -1
  248. package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  249. package/dist/{types-CpnWmiFY.d.ts → types-BpO4LIKj.d.ts} +2149 -985
  250. package/dist/types-BpO4LIKj.d.ts.map +1 -0
  251. package/dist/{types-C1in4fl3.d.ts → types-Bsp8VL2y.d.ts} +2 -2
  252. package/dist/types-Bsp8VL2y.d.ts.map +1 -0
  253. package/dist/{types-YqLqb0Zb.d.ts → types-OXIqeH8W.d.ts} +39 -43
  254. package/dist/types-OXIqeH8W.d.ts.map +1 -0
  255. package/dist/{utils-DP122OSS.d.ts → utils-BrKxCmKx.d.ts} +2 -2
  256. package/dist/utils-BrKxCmKx.d.ts.map +1 -0
  257. package/dist/{utils-aaTmfxFW.js → utils-CSF716ux.js} +10 -3
  258. package/dist/utils-CSF716ux.js.map +1 -0
  259. package/dist/version-BxLITo9P.d.ts +6 -0
  260. package/dist/version-BxLITo9P.d.ts.map +1 -0
  261. package/package.json +28 -7
  262. package/dist/clis/args/access-token--9H57y8J.d.mts +0 -18
  263. package/dist/clis/args/access-token--9H57y8J.d.mts.map +0 -1
  264. package/dist/clis/args/common-CcYbXrBx.mjs.map +0 -1
  265. package/dist/clis/args/common-zPBoTNJF.d.mts +0 -183
  266. package/dist/clis/args/common-zPBoTNJF.d.mts.map +0 -1
  267. package/dist/clis/args/connect-BVVvCmL9.mjs.map +0 -1
  268. package/dist/clis/args/connect-BtU0MTTc.d.mts +0 -443
  269. package/dist/clis/args/connect-BtU0MTTc.d.mts.map +0 -1
  270. package/dist/clis/args/generate-CA916Fvj.mjs.map +0 -1
  271. package/dist/clis/args/generate-DnV-bfXt.d.mts +0 -87
  272. package/dist/clis/args/generate-DnV-bfXt.d.mts.map +0 -1
  273. package/dist/clis/args/help-Bqbgbalu.mjs.map +0 -1
  274. package/dist/clis/args/help-CjAsudUn.d.mts +0 -193
  275. package/dist/clis/args/help-CjAsudUn.d.mts.map +0 -1
  276. package/dist/clis/args/init-CUXyfquF.d.mts +0 -55
  277. package/dist/clis/args/init-CUXyfquF.d.mts.map +0 -1
  278. package/dist/clis/args/inspect-DtZeoA5c.d.mts +0 -15
  279. package/dist/clis/args/inspect-DtZeoA5c.d.mts.map +0 -1
  280. package/dist/clis/args/install-CkP8zcHb.d.mts +0 -40
  281. package/dist/clis/args/install-CkP8zcHb.d.mts.map +0 -1
  282. package/dist/clis/args/list-BGf8s_gj.d.mts +0 -12
  283. package/dist/clis/args/list-BGf8s_gj.d.mts.map +0 -1
  284. package/dist/clis/args/login-DNsHwvqk.d.mts +0 -27
  285. package/dist/clis/args/login-DNsHwvqk.d.mts.map +0 -1
  286. package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs +0 -1013
  287. package/dist/clis/args/magic-string.es-h_0HDQBQ.mjs.map +0 -1
  288. package/dist/clis/args/migrate-sixkWhxm.d.mts +0 -21
  289. package/dist/clis/args/migrate-sixkWhxm.d.mts.map +0 -1
  290. package/dist/clis/args/publish-Dqe5DUst.d.mts +0 -18
  291. package/dist/clis/args/publish-Dqe5DUst.d.mts.map +0 -1
  292. package/dist/clis/args/registry-C_RfTsKB.d.mts +0 -19
  293. package/dist/clis/args/registry-C_RfTsKB.d.mts.map +0 -1
  294. package/dist/clis/args/service-DhIkf8-O.d.mts +0 -22
  295. package/dist/clis/args/service-DhIkf8-O.d.mts.map +0 -1
  296. package/dist/clis/args/switchboard-BlPaq2at.d.mts +0 -72
  297. package/dist/clis/args/switchboard-BlPaq2at.d.mts.map +0 -1
  298. package/dist/clis/args/uninstall-BpA3YYbw.d.mts +0 -31
  299. package/dist/clis/args/uninstall-BpA3YYbw.d.mts.map +0 -1
  300. package/dist/clis/args/unpublish-CvwaIimG.d.mts +0 -24
  301. package/dist/clis/args/unpublish-CvwaIimG.d.mts.map +0 -1
  302. package/dist/clis/args/vetra-CoMvTJK7.d.mts +0 -113
  303. package/dist/clis/args/vetra-CoMvTJK7.d.mts.map +0 -1
  304. package/dist/clis/build-config.mjs.map +0 -1
  305. package/dist/clis/constants.d.mts.map +0 -1
  306. package/dist/config-loader-B845Hidf.js.map +0 -1
  307. package/dist/constants-BP_gjn8g.d.ts +0 -8
  308. package/dist/constants-BP_gjn8g.d.ts.map +0 -1
  309. package/dist/index-C_iVZe7f.d.ts +0 -7
  310. package/dist/index-C_iVZe7f.d.ts.map +0 -1
  311. package/dist/index-DyYIJtVy.d.ts +0 -836
  312. package/dist/index-DyYIJtVy.d.ts.map +0 -1
  313. package/dist/types-C1in4fl3.d.ts.map +0 -1
  314. package/dist/types-CpnWmiFY.d.ts.map +0 -1
  315. package/dist/types-YqLqb0Zb.d.ts.map +0 -1
  316. package/dist/utils-DP122OSS.d.ts.map +0 -1
  317. package/dist/utils-aaTmfxFW.js.map +0 -1
@@ -1,26 +1,24 @@
1
- import { f as IAnalyticsStore } from "./types-C1in4fl3.js";
2
- import { ZodRawShape, z } from "zod";
1
+ import { f as IAnalyticsStore } from "./types-Bsp8VL2y.js";
2
+ import { A as connectPwaCacheStrategySchema, B as connectRenownAdaptersSchema, C as connectHomeSchema, D as connectLoaderSchema, E as connectLengthSchema, G as connectRuntimeInstanceSchema, H as connectRenownRainbowAdapterSchema, I as connectPwaUrlPatternSchema, J as connectSchemedColorSchema, K as connectRuntimePwaManifestSchema, L as connectReactorClientModeSchema, M as connectPwaIconSchema, O as connectOpenPanelSchema, P as connectPwaRuntimeCachingSchema, R as connectReactorFeatureFlagsSchema, S as connectExplorerIconsSchema, U as connectRenownSchema, V as connectRenownPrivyAdapterSchema, W as connectRuntimeConfigSchema, X as connectSentrySchema, Y as connectSchemedImageSchema, Z as connect_config_schema_d_exports, a as connectAiSchema, b as connectDrivesSchema, c as connectBackgroundLayersSchema, d as connectCompositionEntrySchema, g as connectDefaultDriveSchema, h as connectDefaultDriveRemoteSchema, j as connectPwaFileHandlerSchema, k as connectPackagesSchema, l as connectBackgroundSchema, m as connectDefaultDriveLocalSchema, o as connectAppSchema, q as connectRuntimePwaSchema, s as connectBackgroundLayerSchema, u as connectBrandingSchema, v as connectDriveSectionSchema, w as connectImageRefSchema, x as connectEdgesSchema, y as connectDriveSectionsSchema, z as connectReactorSchema } from "./connect-config-schema-1-O1CQ4v.js";
3
+ import "./utils-BrKxCmKx.js";
4
+ import { ZodIssue, ZodRawShape, z } from "zod";
3
5
  import { Draft } from "mutative";
4
- import * as cmd_ts_dist_cjs_argparser_js0 from "cmd-ts/dist/cjs/argparser.js";
6
+ import { Kysely, QueryCreator } from "kysely";
5
7
  import { ArgParser } from "cmd-ts/dist/cjs/argparser.js";
6
- import * as cmd_ts_dist_cjs_helpdoc_js0 from "cmd-ts/dist/cjs/helpdoc.js";
7
- import * as cmd_ts_dist_cjs_runner_js0 from "cmd-ts/dist/cjs/runner.js";
8
8
  import { Agent } from "package-manager-detector";
9
9
  import { OperationWithContext } from "@powerhousedao/shared/document-model";
10
- import { Kysely, QueryCreator } from "kysely";
11
10
  import { IncomingMessage, ServerResponse } from "node:http";
12
11
  import { FC, ReactNode } from "react";
13
-
14
12
  //#region clis/args/common.d.ts
15
- declare const getPackageManagerCommand: Partial<cmd_ts_dist_cjs_argparser_js0.Register> & {
16
- parse(context: cmd_ts_dist_cjs_argparser_js0.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js0.ParsingResult<{
13
+ declare const getPackageManagerCommand: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
14
+ parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
17
15
  packageManager: Agent | undefined;
18
16
  npm: boolean | undefined;
19
17
  pnpm: boolean | undefined;
20
18
  yarn: boolean | undefined;
21
19
  bun: boolean | undefined;
22
20
  }>>;
23
- } & cmd_ts_dist_cjs_helpdoc_js0.PrintHelp & cmd_ts_dist_cjs_helpdoc_js0.ProvidesHelp & cmd_ts_dist_cjs_helpdoc_js0.Named & Partial<cmd_ts_dist_cjs_helpdoc_js0.Versioned> & cmd_ts_dist_cjs_argparser_js0.Register & cmd_ts_dist_cjs_runner_js0.Handling<{
21
+ } & import("cmd-ts/dist/cjs/helpdoc.js").PrintHelp & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/helpdoc.js").Named & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned> & import("cmd-ts/dist/cjs/argparser.js").Register & import("cmd-ts/dist/cjs/runner.js").Handling<{
24
22
  packageManager: Agent | undefined;
25
23
  npm: boolean | undefined;
26
24
  pnpm: boolean | undefined;
@@ -33,14 +31,14 @@ declare const getPackageManagerCommand: Partial<cmd_ts_dist_cjs_argparser_js0.Re
33
31
  yarn: boolean | undefined;
34
32
  bun: boolean | undefined;
35
33
  }> & {
36
- run(context: cmd_ts_dist_cjs_argparser_js0.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js0.ParsingResult<{
34
+ run(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<{
37
35
  packageManager: Agent | undefined;
38
36
  npm: boolean | undefined;
39
37
  pnpm: boolean | undefined;
40
38
  yarn: boolean | undefined;
41
39
  bun: boolean | undefined;
42
40
  }>>;
43
- } & Partial<cmd_ts_dist_cjs_helpdoc_js0.Versioned & cmd_ts_dist_cjs_helpdoc_js0.Descriptive & cmd_ts_dist_cjs_helpdoc_js0.Aliased>;
41
+ } & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Versioned & import("cmd-ts/dist/cjs/helpdoc.js").Descriptive & import("cmd-ts/dist/cjs/helpdoc.js").Aliased>;
44
42
  //#endregion
45
43
  //#region processors/constants.d.ts
46
44
  declare const PROCESSOR_APPS: readonly ["connect", "switchboard"];
@@ -79,7 +77,8 @@ type PHDocumentSignatureInfo = {
79
77
  /**
80
78
  * The public key of the document creator.
81
79
  **/
82
- publicKey: JsonWebKey; /** The nonce that was appended to the message to create the signature. */
80
+ publicKey: JsonWebKey;
81
+ /** The nonce that was appended to the message to create the signature. */
83
82
  nonce: string;
84
83
  };
85
84
  /** Joins a signature's params for transport. Already-joined input passes through. */
@@ -96,11 +95,200 @@ declare function deserializeSignature(signature: Signature | string): Signature;
96
95
  * Configuration for hashing document state in operations.
97
96
  */
98
97
  type HashConfig = {
99
- /** The hashing algorithm to use (e.g., "sha1", "sha256") */algorithm: string; /** The encoding format for the hash output (e.g., "base64", "hex") */
100
- encoding: string; /** Optional algorithm-specific parameters */
98
+ /** The hashing algorithm to use (e.g., "sha1", "sha256") */
99
+ algorithm: string;
100
+ /** The encoding format for the hash output (e.g., "base64", "hex") */
101
+ encoding: string;
102
+ /** Optional algorithm-specific parameters */
101
103
  params?: Record<string, unknown>;
102
104
  };
103
105
  //#endregion
106
+ //#region document-model/operations.d.ts
107
+ declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, input: {
108
+ name: string;
109
+ }): TDocument & {
110
+ header: {
111
+ name: string;
112
+ id: string;
113
+ sig: PHDocumentSignatureInfo;
114
+ documentType: string;
115
+ createdAtUtcIso: string;
116
+ slug: string;
117
+ branch: string;
118
+ revision: {
119
+ [scope: string]: number;
120
+ };
121
+ lastModifiedAtUtcIso: string;
122
+ protocolVersions?: {
123
+ [key: string]: number;
124
+ };
125
+ meta?: PHDocumentMeta;
126
+ };
127
+ };
128
+ declare function setPreferredEditorOperation<TDocument extends PHDocument>(document: TDocument, input: {
129
+ preferredEditor: string | null;
130
+ }): TDocument;
131
+ declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
132
+ document: TDocument;
133
+ action: Action;
134
+ skip: number;
135
+ reuseLastOperationIndex: boolean;
136
+ };
137
+ /**
138
+ * V2 of undoOperation for protocol version 2+.
139
+ * Key differences from undoOperation:
140
+ * - Never reuses operation index (always increments)
141
+ * - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
142
+ * - No complex skip calculation - simpler model where each UNDO is independent
143
+ */
144
+ declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
145
+ document: TDocument;
146
+ action: Action;
147
+ skip: number;
148
+ reuseLastOperationIndex: false;
149
+ };
150
+ declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
151
+ document: TDocument;
152
+ action: Action;
153
+ skip: number;
154
+ reuseLastOperationIndex: boolean;
155
+ };
156
+ /**
157
+ * An operation that was applied to a {@link BaseDocument}.
158
+ *
159
+ * @remarks
160
+ * Wraps an action with an index, to be added to the operations history of a Document.
161
+ * The `index` field is used to keep all operations in order and enable replaying the
162
+ * document's history from the beginning. Note that indices and skips are relative to
163
+ * a specific reactor. Example below:
164
+ *
165
+ * For (index, skip, ts, action)
166
+ * A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
167
+ * B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
168
+ * ...
169
+ * B gets A's Operations Scenario:
170
+ * B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
171
+ * Then A needs to end up with:
172
+ * A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
173
+ * So that both A and B end up with the stream of actions (action):
174
+ * [("B0"), ("A0"), ("A1"), ("B1")]
175
+ *
176
+ * @typeParam A - The type of the action.
177
+ */
178
+ type Operation = {
179
+ /**
180
+ * This is a stable id, derived from various document and action properties
181
+ * in deriveOperationId().
182
+ *
183
+ * It _cannot_ be an arbitrary string.
184
+ *
185
+ * It it also not unique per operation, as reshuffled operations will keep'
186
+ * the same id they had before they were reshuffled. This means that the
187
+ * IOperationStore may have multiple operations with the same operation id.
188
+ **/
189
+ id: string;
190
+ /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
191
+ index: number;
192
+ /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
193
+ skip: number;
194
+ /** Timestamp of when the operation was added */
195
+ timestampUtcMs: string;
196
+ /** Hash of the resulting document data after the operation */
197
+ hash: string;
198
+ /** Error message for a failed action */
199
+ error?: string;
200
+ /**
201
+ * If authorization rejected the action, this records the reason why.
202
+ */
203
+ deniedReason?: string;
204
+ /** The resulting state after the operation */
205
+ resultingState?: string;
206
+ /**
207
+ * The action that was applied to the document to produce this operation.
208
+ */
209
+ action: Action;
210
+ };
211
+ /**
212
+ * The operations history of the document by scope.
213
+ *
214
+ * This will be removed in a future release.
215
+ *
216
+ * TODO: Type should be Partial<Record<string, Operation[]>>,
217
+ * but that is a breaking change for codegen + external doc models.
218
+ */
219
+ type DocumentOperations = Record<string, Operation[]>;
220
+ /**
221
+ * What happened to an operation. An operation that is not `applied` still
222
+ * occupies its index but contributes nothing to the document's state.
223
+ */
224
+ type OperationOutcome = {
225
+ kind: "applied";
226
+ } | {
227
+ kind: "reducer-error";
228
+ message: string;
229
+ } | {
230
+ kind: "denied";
231
+ reason: string;
232
+ };
233
+ /**
234
+ * Reads an operation's outcome. A denial takes precedence over a reducer
235
+ * error, since a denied operation never reaches its reducer.
236
+ */
237
+ declare function operationOutcome(operation: Operation): OperationOutcome;
238
+ type OperationContext = {
239
+ documentId: string;
240
+ documentType: string;
241
+ scope: string;
242
+ branch: string;
243
+ resultingState?: string;
244
+ ordinal: number;
245
+ };
246
+ type OperationWithContext$1 = {
247
+ operation: Operation;
248
+ context: OperationContext;
249
+ };
250
+ //#endregion
251
+ //#region document-model/signature-policy.d.ts
252
+ /** The `protocolVersions` key that fixes a document's signature requirement. */
253
+ declare const SIGNATURE_PROTOCOL = "signature";
254
+ /** `protocolVersions.signature` of a document that requires v2 tuples. */
255
+ declare const SIGNATURE_PROTOCOL_V2 = 2;
256
+ /** `v2-required`: v2 tuples only and a content-addressed id. */
257
+ type SignaturePolicy$1 = "legacy" | "v2-required";
258
+ /** What a new document is created as unless the caller or host says otherwise. */
259
+ declare const DEFAULT_SIGNATURE_POLICY: SignaturePolicy$1;
260
+ declare function isSignaturePolicy(value: unknown): value is SignaturePolicy$1;
261
+ type ProtocolVersions = {
262
+ [protocol: string]: number;
263
+ };
264
+ /** Read from a header, a CREATE_DOCUMENT input or a bare map. */
265
+ declare function signaturePolicyOf(source: {
266
+ protocolVersions?: ProtocolVersions | null;
267
+ } | ProtocolVersions | null | undefined): SignaturePolicy$1;
268
+ /** `protocolVersions` for a new v2-required document. */
269
+ declare function v2RequiredProtocolVersions(base?: ProtocolVersions): ProtocolVersions;
270
+ /**
271
+ * The policy a create call asks for: `signaturePolicy`, else the `signature`
272
+ * key of its `protocolVersions`, else `fallback`, the host's default.
273
+ */
274
+ declare function requestedSignaturePolicy(request: {
275
+ signaturePolicy?: SignaturePolicy$1;
276
+ protocolVersions?: ProtocolVersions;
277
+ } | undefined, fallback: SignaturePolicy$1): SignaturePolicy$1;
278
+ /** `protocolVersions` for a new document under `policy`, over `base`. */
279
+ declare function protocolVersionsFor(policy: SignaturePolicy$1, base?: ProtocolVersions): ProtocolVersions;
280
+ /** What the id of a v2-required document is a hash of. */
281
+ type DocumentIdParams = {
282
+ documentType: string;
283
+ createdAtUtcIso: string;
284
+ nonce: string;
285
+ protocolVersions: ProtocolVersions;
286
+ };
287
+ /** `base64url(sha256(canonicalJson(params)))`, unpadded. */
288
+ declare function deriveDocumentId(params: DocumentIdParams): string;
289
+ /** Whether `id` has the shape `deriveDocumentId` produces. */
290
+ declare function isDerivedDocumentId(id: string): boolean;
291
+ //#endregion
104
292
  //#region document-model/state.d.ts
105
293
  /**
106
294
  * Creates a default PHAuthState
@@ -140,11 +328,16 @@ type PHDocumentState = {
140
328
  * with the UPGRADE_DOCUMENT operation to specify the DocumentModelModule
141
329
  * version to use for reducer execution.
142
330
  */
143
- version: number; /** Hash configuration for operation state verification */
144
- hash: HashConfig; /** True if and only if the document has been deleted */
145
- isDeleted?: boolean; /** The timestamp when the document was deleted, in UTC ISO format */
146
- deletedAtUtcIso?: string; /** Optional: who deleted the document */
147
- deletedBy?: string; /** Optional: reason for deletion */
331
+ version: number;
332
+ /** Hash configuration for operation state verification */
333
+ hash: HashConfig;
334
+ /** True if and only if the document has been deleted */
335
+ isDeleted?: boolean;
336
+ /** The timestamp when the document was deleted, in UTC ISO format */
337
+ deletedAtUtcIso?: string;
338
+ /** Optional: who deleted the document */
339
+ deletedBy?: string;
340
+ /** Optional: reason for deletion */
148
341
  deletionReason?: string;
149
342
  };
150
343
  /**
@@ -167,7 +360,8 @@ type PHAuthState = {
167
360
  creator?: string;
168
361
  };
169
362
  type Grant = {
170
- /** Stable id. */id: string;
363
+ /** Stable id. */
364
+ id: string;
171
365
  description: string;
172
366
  effect: "allow" | "deny";
173
367
  principal: Principal;
@@ -252,7 +446,9 @@ type Operand = {
252
446
  * The base state of the document.
253
447
  */
254
448
  type PHBaseState = {
255
- /** Carries authentication information. */auth: PHAuthState; /** Carries information about the document. */
449
+ /** Carries authentication information. */
450
+ auth: PHAuthState;
451
+ /** Carries information about the document. */
256
452
  document: PHDocumentState;
257
453
  };
258
454
  declare function defaultGlobalState(): DocumentModelGlobalState;
@@ -262,183 +458,47 @@ declare function createGlobalState(state?: Partial<DocumentModelGlobalState>): D
262
458
  declare function createLocalState(state?: Partial<DocumentModelLocalState>): DocumentModelLocalState;
263
459
  declare function createState(baseState?: Partial<PHBaseState>, globalState?: Partial<DocumentModelGlobalState>, localState?: Partial<DocumentModelLocalState>): DocumentModelPHState;
264
460
  //#endregion
265
- //#region document-model/operations.d.ts
266
- declare function setNameOperation<TDocument extends PHDocument>(document: TDocument, input: {
267
- name: string;
268
- }): TDocument & {
269
- header: {
270
- name: string;
271
- id: string;
272
- sig: PHDocumentSignatureInfo;
273
- documentType: string;
274
- createdAtUtcIso: string;
275
- slug: string;
276
- branch: string;
277
- revision: {
278
- [scope: string]: number;
279
- };
280
- lastModifiedAtUtcIso: string;
281
- protocolVersions?: {
282
- [key: string]: number;
283
- };
284
- meta?: PHDocumentMeta;
285
- };
286
- };
287
- declare function setPreferredEditorOperation<TDocument extends PHDocument>(document: TDocument, input: {
288
- preferredEditor: string | null;
289
- }): TDocument;
290
- declare function undoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
291
- document: TDocument;
292
- action: Action;
293
- skip: number;
294
- reuseLastOperationIndex: boolean;
295
- };
296
- /**
297
- * V2 of undoOperation for protocol version 2+.
298
- * Key differences from undoOperation:
299
- * - Never reuses operation index (always increments)
300
- * - Always sets skip=1 (consecutive NOOPs are handled during rebuild/GC)
301
- * - No complex skip calculation - simpler model where each UNDO is independent
302
- */
303
- declare function undoOperationV2<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
304
- document: TDocument;
305
- action: Action;
306
- skip: number;
307
- reuseLastOperationIndex: false;
308
- };
309
- declare function redoOperation<TDocument extends PHDocument>(document: TDocument, action: Action, skip: number): {
310
- document: TDocument;
311
- action: Action;
312
- skip: number;
313
- reuseLastOperationIndex: boolean;
461
+ //#region document-model/documents.d.ts
462
+ /** Meta information about the document. */
463
+ type PHDocumentMeta = {
464
+ /** The preferred editor for the document. */
465
+ preferredEditor?: string;
314
466
  };
315
- declare function loadStateOperation<TState extends PHBaseState>(document: PHDocument<TState>, action: LoadStateActionInput): PHDocument<TState>;
316
467
  /**
317
- * An operation that was applied to a {@link BaseDocument}.
318
- *
319
- * @remarks
320
- * Wraps an action with an index, to be added to the operations history of a Document.
321
- * The `index` field is used to keep all operations in order and enable replaying the
322
- * document's history from the beginning. Note that indices and skips are relative to
323
- * a specific reactor. Example below:
324
- *
325
- * For (index, skip, ts, action)
326
- * A - [(0, 0, 1, "A0"), (1, 0, 2, "A1")]
327
- * B - [(0, 0, 0, "B0"), (1, 0, 3, "B1")]
328
- * ...
329
- * B gets A's Operations Scenario:
330
- * B' - [(0, 0, 0, "B0"), (1, 0, 3, "B1"), (2, 1, 1, "A0"), (3, 0, 2, "A1"), (4, 0, 3, "B1")]
331
- * Then A needs to end up with:
332
- * A' - [(0, 0, 1, "A0"), (1, 0, 2, "A1"), (2, 2, 0, "B0"), (3, 0, 1, "A0"), (4, 0, 2, "A1"), (5, 0, 3, "B1")]
333
- * So that both A and B end up with the stream of actions (action):
334
- * [("B0"), ("A0"), ("A1"), ("B1")]
335
- *
336
- * @typeParam A - The type of the action.
468
+ * The header of a document.
337
469
  */
338
- type Operation = {
470
+ type PHDocumentHeader = {
339
471
  /**
340
- * This is a stable id, derived from various document and action properties
341
- * in deriveOperationId().
472
+ * The id of the document.
342
473
  *
343
- * It _cannot_ be an arbitrary string.
474
+ * This is a Ed25519 signature and is immutable.
475
+ **/
476
+ id: string;
477
+ /**
478
+ * Information to verify the document creator.
344
479
  *
345
- * It it also not unique per operation, as reshuffled operations will keep'
346
- * the same id they had before they were reshuffled. This means that the
347
- * IOperationStore may have multiple operations with the same operation id.
480
+ * This is immutable.
348
481
  **/
349
- id: string; /** Position of the operation in the history. This is relative to a specific reactor -- they may not all agree on this value. */
350
- index: number; /** The number of operations skipped with this Operation. This is relative to a specific reactor -- they may not all agree on this value. */
351
- skip: number; /** Timestamp of when the operation was added */
352
- timestampUtcMs: string; /** Hash of the resulting document data after the operation */
353
- hash: string; /** Error message for a failed action */
354
- error?: string;
482
+ sig: PHDocumentSignatureInfo;
355
483
  /**
356
- * If authorization rejected the action, this records the reason why.
357
- */
358
- deniedReason?: string; /** The resulting state after the operation */
359
- resultingState?: string;
360
- /**
361
- * The action that was applied to the document to produce this operation.
362
- */
363
- action: Action;
364
- };
365
- /**
366
- * The operations history of the document by scope.
367
- *
368
- * This will be removed in a future release.
369
- *
370
- * TODO: Type should be Partial<Record<string, Operation[]>>,
371
- * but that is a breaking change for codegen + external doc models.
372
- */
373
- type DocumentOperations = Record<string, Operation[]>;
374
- /**
375
- * What happened to an operation. An operation that is not `applied` still
376
- * occupies its index but contributes nothing to the document's state.
377
- */
378
- type OperationOutcome = {
379
- kind: "applied";
380
- } | {
381
- kind: "reducer-error";
382
- message: string;
383
- } | {
384
- kind: "denied";
385
- reason: string;
386
- };
387
- /**
388
- * Reads an operation's outcome. A denial takes precedence over a reducer
389
- * error, since a denied operation never reaches its reducer.
390
- */
391
- declare function operationOutcome(operation: Operation): OperationOutcome;
392
- type OperationContext = {
393
- documentId: string;
394
- documentType: string;
395
- scope: string;
396
- branch: string;
397
- resultingState?: string;
398
- ordinal: number;
399
- };
400
- type OperationWithContext$1 = {
401
- operation: Operation;
402
- context: OperationContext;
403
- };
404
- //#endregion
405
- //#region document-model/documents.d.ts
406
- /** Meta information about the document. */
407
- type PHDocumentMeta = {
408
- /** The preferred editor for the document. */preferredEditor?: string;
409
- };
410
- /**
411
- * The header of a document.
412
- */
413
- type PHDocumentHeader = {
414
- /**
415
- * The id of the document.
416
- *
417
- * This is a Ed25519 signature and is immutable.
418
- **/
419
- id: string;
420
- /**
421
- * Information to verify the document creator.
422
- *
423
- * This is immutable.
424
- **/
425
- sig: PHDocumentSignatureInfo;
426
- /**
427
- * The type of the document.
428
- *
429
- * This is used as part of the signature payload and thus, cannot be changed
430
- * after the document header has been created.
431
- **/
432
- documentType: string;
484
+ * The type of the document.
485
+ *
486
+ * This is used as part of the signature payload and thus, cannot be changed
487
+ * after the document header has been created.
488
+ **/
489
+ documentType: string;
433
490
  /**
434
491
  * The timestamp of the creation date of the document, in UTC ISO format.
435
492
  *
436
493
  * This is used as part of the signature payload and thus, cannot be changed
437
494
  * after the document header has been created.
438
495
  **/
439
- createdAtUtcIso: string; /** The slug of the document. */
440
- slug: string; /** The name of the document. */
441
- name: string; /** The branch of this document. */
496
+ createdAtUtcIso: string;
497
+ /** The slug of the document. */
498
+ slug: string;
499
+ /** The name of the document. */
500
+ name: string;
501
+ /** The branch of this document. */
442
502
  branch: string;
443
503
  /**
444
504
  * The revision of each scope of the document. This object is updated every
@@ -461,7 +521,8 @@ type PHDocumentHeader = {
461
521
  */
462
522
  protocolVersions?: {
463
523
  [key: string]: number;
464
- }; /** Meta information about the document. */
524
+ };
525
+ /** Meta information about the document. */
465
526
  meta?: PHDocumentMeta;
466
527
  };
467
528
  /**
@@ -473,7 +534,9 @@ type PHDocumentHeader = {
473
534
  * @typeParam TState - The type of the document state.
474
535
  */
475
536
  type PHDocument<TState extends PHBaseState = PHBaseState> = {
476
- /** The header of the document. */header: PHDocumentHeader; /** The document model specific state. */
537
+ /** The header of the document. */
538
+ header: PHDocumentHeader;
539
+ /** The document model specific state. */
477
540
  state: TState;
478
541
  /**
479
542
  * The initial state of the document, enabling replaying operations.
@@ -504,9 +567,23 @@ declare function isUndo(action: Action): action is UndoAction;
504
567
  declare function isDocumentAction(action: Action): action is DocumentAction;
505
568
  /**
506
569
  * Creates a new document. When `documentType` is given the header is stamped
507
- * with it and the document-scope operations are seeded.
570
+ * with it and the document-scope operations are seeded. Without
571
+ * `protocolVersions` the document is v2-required and takes a derived id; with
572
+ * them it is v2-required only if they say so (see {@link protocolVersionsFor}).
573
+ */
574
+ declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string, protocolVersions?: ProtocolVersions): PHDocument<TState>;
575
+ /**
576
+ * `document`, not yet created, under a fresh header for `policy`. A legacy
577
+ * header takes `id` when given; a v2-required one ignores `id` and derives its
578
+ * own, so a caller that needs a fixed id must ask for legacy.
579
+ * `protocolVersions` are merged over the document's. Name, slug, branch and
580
+ * meta carry over. A document already under `policy` is returned as is unless
581
+ * a legacy `id` or `protocolVersions` are given.
508
582
  */
509
- declare function baseCreateDocument<TState extends PHBaseState = PHBaseState>(createState: CreateState<TState>, initialState?: Partial<TState>, documentType?: string): PHDocument<TState>;
583
+ declare function withSignaturePolicy<TDocument extends PHDocument>(document: TDocument, policy: SignaturePolicy$1, options?: {
584
+ id?: string;
585
+ protocolVersions?: ProtocolVersions;
586
+ }): TDocument;
510
587
  declare function hashDocumentStateForScope(document: {
511
588
  state: {
512
589
  [key: string]: unknown;
@@ -670,31 +747,6 @@ declare const undo: (count?: number, scope?: string) => UndoAction;
670
747
  * @category Actions
671
748
  */
672
749
  declare const redo: (count?: number, scope?: string) => RedoAction;
673
- /**
674
- * Joins multiple operations into a single {@link loadState | LOAD_STATE} operation.
675
- *
676
- * @remarks
677
- * Useful to keep operations history smaller. Operations to prune are selected by index,
678
- * similar to the {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice | slice} method in Arrays.
679
- *
680
- * @param start - Index of the first operation to prune
681
- * @param end - Index of the last operation to prune
682
- * @category Actions
683
- */
684
- declare const prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
685
- /**
686
- * Replaces the state of the document.
687
- *
688
- * @remarks
689
- * This action shouldn't be used directly. It is dispatched by the {@link prune} action.
690
- *
691
- * @param state - State to be set in the document.
692
- * @param operations - Number of operations that were removed from the previous state.
693
- * @category Actions
694
- */
695
- declare const loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
696
- name: string;
697
- }, operations: number) => LoadStateAction;
698
750
  declare const noop: (scope?: string) => NOOPAction;
699
751
  /**
700
752
  * Helper function to be used by action creators.
@@ -730,7 +782,9 @@ declare const operationWithContext: (operation: Operation, context: ActionContex
730
782
  declare const actionContext: () => ActionContext;
731
783
  declare const actionSigner: (user: UserActionSigner, app: AppActionSigner, signatures?: Signature[]) => ActionSigner;
732
784
  declare function buildOperationSignature(context: ActionSignatureContext, signMethod: ActionSigningHandler): Promise<Signature>;
785
+ /** @deprecated Emits a legacy SHA-1 tuple; sign through `ISigner.signAction`. */
733
786
  declare function buildSignedAction<TState extends PHBaseState = PHBaseState>(action: Action, reducer: Reducer<TState>, document: PHDocument<TState>, signer: ActionSigner, signHandler: ActionSigningHandler): Promise<Operation>;
787
+ /** @deprecated Use `verifyActionSignature` from `@powerhousedao/reactor`. */
734
788
  declare function verifyOperationSignature(signature: Signature, signer: Omit<ActionSigner, "signatures">, verifyHandler: ActionVerificationHandler): Promise<boolean>;
735
789
  /**
736
790
  * Changes the name of the document.
@@ -784,10 +838,10 @@ declare const updateOperationExample: (input: UpdateOperationExampleInput) => Up
784
838
  declare const deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
785
839
  declare const reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
786
840
  declare const operationExampleCreators: {
787
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
788
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
789
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
790
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
841
+ addOperationExample: typeof addOperationExample;
842
+ updateOperationExample: typeof updateOperationExample;
843
+ deleteOperationExample: typeof deleteOperationExample;
844
+ reorderOperationExamples: typeof reorderOperationExamples;
791
845
  };
792
846
  declare const setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
793
847
  declare const setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
@@ -801,531 +855,1115 @@ declare const deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteCh
801
855
  declare const reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
802
856
  declare const releaseNewVersion: () => ReleaseNewVersionAction;
803
857
  declare const baseActions: {
804
- setName: (name: string | {
805
- name: string;
806
- }) => SetNameAction;
807
- setPreferredEditor: (input: string | null | {
808
- preferredEditor: string | null;
809
- }) => SetPreferredEditorAction;
810
- undo: (count?: number, scope?: string) => UndoAction;
811
- redo: (count?: number, scope?: string) => RedoAction;
812
- prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
813
- loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
814
- name: string;
815
- }, operations: number) => LoadStateAction;
816
- noop: (scope?: string) => NOOPAction;
858
+ setName: typeof setName;
859
+ setPreferredEditor: typeof setPreferredEditor;
860
+ undo: typeof undo;
861
+ redo: typeof redo;
862
+ noop: typeof noop;
817
863
  };
818
864
  declare const documentModelActions: {
819
- setModelName: (input: SetModelNameInput) => SetModelNameAction;
820
- setModelId: (input: SetModelIdInput) => SetModelIdAction;
821
- setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
822
- setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
823
- setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
824
- setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
825
- addModule: (input: AddModuleInput) => AddModuleAction;
826
- setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
827
- setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
828
- deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
829
- reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
830
- addOperation: (input: AddOperationInput) => AddOperationAction;
831
- setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
832
- setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
833
- setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
834
- setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
835
- setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
836
- setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
837
- moveOperation: (input: MoveOperationInput) => MoveOperationAction;
838
- deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
839
- reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
840
- addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
841
- setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
842
- setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
843
- setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
844
- setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
845
- deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
846
- reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
847
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
848
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
849
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
850
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
851
- setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
852
- setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
853
- addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
854
- updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
855
- deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
856
- reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
857
- addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
858
- updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
859
- deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
860
- reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
861
- releaseNewVersion: () => ReleaseNewVersionAction;
865
+ setModelName: typeof setModelName;
866
+ setModelId: typeof setModelId;
867
+ setModelExtension: typeof setModelExtension;
868
+ setModelDescription: typeof setModelDescription;
869
+ setAuthorName: typeof setAuthorName;
870
+ setAuthorWebsite: typeof setAuthorWebsite;
871
+ addModule: typeof addModule;
872
+ setModuleName: typeof setModuleName;
873
+ setModuleDescription: typeof setModuleDescription;
874
+ deleteModule: typeof deleteModule;
875
+ reorderModules: typeof reorderModules;
876
+ addOperation: typeof addOperation;
877
+ setOperationName: typeof setOperationName;
878
+ setOperationScope: typeof setOperationScope;
879
+ setOperationSchema: typeof setOperationSchema;
880
+ setOperationDescription: typeof setOperationDescription;
881
+ setOperationTemplate: typeof setOperationTemplate;
882
+ setOperationReducer: typeof setOperationReducer;
883
+ moveOperation: typeof moveOperation;
884
+ deleteOperation: typeof deleteOperation;
885
+ reorderModuleOperations: typeof reorderModuleOperations;
886
+ addOperationError: typeof addOperationError;
887
+ setOperationErrorCode: typeof setOperationErrorCode;
888
+ setOperationErrorName: typeof setOperationErrorName;
889
+ setOperationErrorDescription: typeof setOperationErrorDescription;
890
+ setOperationErrorTemplate: typeof setOperationErrorTemplate;
891
+ deleteOperationError: typeof deleteOperationError;
892
+ reorderOperationErrors: typeof reorderOperationErrors;
893
+ addOperationExample: typeof addOperationExample;
894
+ updateOperationExample: typeof updateOperationExample;
895
+ deleteOperationExample: typeof deleteOperationExample;
896
+ reorderOperationExamples: typeof reorderOperationExamples;
897
+ setStateSchema: typeof setStateSchema;
898
+ setInitialState: typeof setInitialState;
899
+ addStateExample: typeof addStateExample;
900
+ updateStateExample: typeof updateStateExample;
901
+ deleteStateExample: typeof deleteStateExample;
902
+ reorderStateExamples: typeof reorderStateExamples;
903
+ addChangeLogItem: typeof addChangeLogItem;
904
+ updateChangeLogItem: typeof updateChangeLogItem;
905
+ deleteChangeLogItem: typeof deleteChangeLogItem;
906
+ reorderChangeLogItems: typeof reorderChangeLogItems;
907
+ releaseNewVersion: typeof releaseNewVersion;
862
908
  };
863
909
  declare const actions: {
864
- setModelName: (input: SetModelNameInput) => SetModelNameAction;
865
- setModelId: (input: SetModelIdInput) => SetModelIdAction;
866
- setModelExtension: (input: SetModelExtensionInput) => SetModelExtensionAction;
867
- setModelDescription: (input: SetModelDescriptionInput) => SetModelDescriptionAction;
868
- setAuthorName: (input: SetAuthorNameInput) => SetAuthorNameAction;
869
- setAuthorWebsite: (input: SetAuthorWebsiteInput) => SetAuthorWebsiteAction;
870
- addModule: (input: AddModuleInput) => AddModuleAction;
871
- setModuleName: (input: SetModuleNameInput) => SetModuleNameAction;
872
- setModuleDescription: (input: SetModuleDescriptionInput) => SetModuleDescriptionAction;
873
- deleteModule: (input: DeleteModuleInput) => DeleteModuleAction;
874
- reorderModules: (input: ReorderModulesInput) => ReorderModulesAction;
875
- addOperation: (input: AddOperationInput) => AddOperationAction;
876
- setOperationName: (input: SetOperationNameInput) => SetOperationNameAction;
877
- setOperationScope: (input: SetOperationScopeInput) => SetOperationScopeAction;
878
- setOperationSchema: (input: SetOperationSchemaInput) => SetOperationSchemaAction;
879
- setOperationDescription: (input: SetOperationDescriptionInput) => SetOperationDescriptionAction;
880
- setOperationTemplate: (input: SetOperationTemplateInput) => SetOperationTemplateAction;
881
- setOperationReducer: (input: SetOperationReducerInput) => SetOperationReducerAction;
882
- moveOperation: (input: MoveOperationInput) => MoveOperationAction;
883
- deleteOperation: (input: DeleteOperationInput) => DeleteOperationAction;
884
- reorderModuleOperations: (input: ReorderModuleOperationsInput) => ReorderModuleOperationsAction;
885
- addOperationError: (input: AddOperationErrorInput) => AddOperationErrorAction;
886
- setOperationErrorCode: (input: SetOperationErrorCodeInput) => SetOperationErrorCodeAction;
887
- setOperationErrorName: (input: SetOperationErrorNameInput) => SetOperationErrorNameAction;
888
- setOperationErrorDescription: (input: SetOperationErrorDescriptionInput) => SetOperationErrorDescriptionAction;
889
- setOperationErrorTemplate: (input: SetOperationErrorTemplateInput) => SetOperationErrorTemplateAction;
890
- deleteOperationError: (input: DeleteOperationErrorInput) => DeleteOperationErrorAction;
891
- reorderOperationErrors: (input: ReorderOperationErrorsInput) => ReorderOperationErrorsAction;
892
- addOperationExample: (input: AddOperationExampleInput) => AddOperationExampleAction;
893
- updateOperationExample: (input: UpdateOperationExampleInput) => UpdateOperationExampleAction;
894
- deleteOperationExample: (input: DeleteOperationExampleInput) => DeleteOperationExampleAction;
895
- reorderOperationExamples: (input: ReorderOperationExamplesInput) => ReorderOperationExamplesAction;
896
- setStateSchema: (input: SetStateSchemaInput) => SetStateSchemaAction;
897
- setInitialState: (input: SetInitialStateInput) => SetInitialStateAction;
898
- addStateExample: (input: AddStateExampleInput) => AddStateExampleAction;
899
- updateStateExample: (input: UpdateStateExampleInput) => UpdateStateExampleAction;
900
- deleteStateExample: (input: DeleteStateExampleInput) => DeleteStateExampleAction;
901
- reorderStateExamples: (input: ReorderStateExamplesInput) => ReorderStateExamplesAction;
902
- addChangeLogItem: (input: AddChangeLogItemInput) => AddChangeLogItemAction;
903
- updateChangeLogItem: (input: UpdateChangeLogItemInput) => UpdateChangeLogItemAction;
904
- deleteChangeLogItem: (input: DeleteChangeLogItemInput) => DeleteChangeLogItemAction;
905
- reorderChangeLogItems: (input: ReorderChangeLogItemsInput) => ReorderChangeLogItemsAction;
906
- releaseNewVersion: () => ReleaseNewVersionAction;
907
- setName: (name: string | {
908
- name: string;
909
- }) => SetNameAction;
910
- setPreferredEditor: (input: string | null | {
911
- preferredEditor: string | null;
912
- }) => SetPreferredEditorAction;
913
- undo: (count?: number, scope?: string) => UndoAction;
914
- redo: (count?: number, scope?: string) => RedoAction;
915
- prune: (start?: number, end?: number, scope?: string) => SchemaPruneAction;
916
- loadState: <TState extends PHBaseState = PHBaseState>(state: TState & {
917
- name: string;
918
- }, operations: number) => LoadStateAction;
919
- noop: (scope?: string) => NOOPAction;
910
+ setName: typeof setName;
911
+ setPreferredEditor: typeof setPreferredEditor;
912
+ undo: typeof undo;
913
+ redo: typeof redo;
914
+ noop: typeof noop;
915
+ setModelName: typeof setModelName;
916
+ setModelId: typeof setModelId;
917
+ setModelExtension: typeof setModelExtension;
918
+ setModelDescription: typeof setModelDescription;
919
+ setAuthorName: typeof setAuthorName;
920
+ setAuthorWebsite: typeof setAuthorWebsite;
921
+ addModule: typeof addModule;
922
+ setModuleName: typeof setModuleName;
923
+ setModuleDescription: typeof setModuleDescription;
924
+ deleteModule: typeof deleteModule;
925
+ reorderModules: typeof reorderModules;
926
+ addOperation: typeof addOperation;
927
+ setOperationName: typeof setOperationName;
928
+ setOperationScope: typeof setOperationScope;
929
+ setOperationSchema: typeof setOperationSchema;
930
+ setOperationDescription: typeof setOperationDescription;
931
+ setOperationTemplate: typeof setOperationTemplate;
932
+ setOperationReducer: typeof setOperationReducer;
933
+ moveOperation: typeof moveOperation;
934
+ deleteOperation: typeof deleteOperation;
935
+ reorderModuleOperations: typeof reorderModuleOperations;
936
+ addOperationError: typeof addOperationError;
937
+ setOperationErrorCode: typeof setOperationErrorCode;
938
+ setOperationErrorName: typeof setOperationErrorName;
939
+ setOperationErrorDescription: typeof setOperationErrorDescription;
940
+ setOperationErrorTemplate: typeof setOperationErrorTemplate;
941
+ deleteOperationError: typeof deleteOperationError;
942
+ reorderOperationErrors: typeof reorderOperationErrors;
943
+ addOperationExample: typeof addOperationExample;
944
+ updateOperationExample: typeof updateOperationExample;
945
+ deleteOperationExample: typeof deleteOperationExample;
946
+ reorderOperationExamples: typeof reorderOperationExamples;
947
+ setStateSchema: typeof setStateSchema;
948
+ setInitialState: typeof setInitialState;
949
+ addStateExample: typeof addStateExample;
950
+ updateStateExample: typeof updateStateExample;
951
+ deleteStateExample: typeof deleteStateExample;
952
+ reorderStateExamples: typeof reorderStateExamples;
953
+ addChangeLogItem: typeof addChangeLogItem;
954
+ updateChangeLogItem: typeof updateChangeLogItem;
955
+ deleteChangeLogItem: typeof deleteChangeLogItem;
956
+ reorderChangeLogItems: typeof reorderChangeLogItems;
957
+ releaseNewVersion: typeof releaseNewVersion;
920
958
  };
921
959
  /**
922
960
  * The context of an action.
923
961
  */
924
962
  type ActionContext = {
925
- /** The index of the previous operation, showing intended ordering. */prevOpIndex?: number; /** The hash of the previous operation, showing intended state. */
926
- prevOpHash?: string; /** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
927
- nonce?: string; /** The signer of the action. */
963
+ /** The index of the previous operation, showing intended ordering. */
964
+ prevOpIndex?: number;
965
+ /** The hash of the previous operation, showing intended state. */
966
+ prevOpHash?: string;
967
+ /** A nonce, to cover specific signing attacks and to prevent replay attacks from no-ops. */
968
+ nonce?: string;
969
+ /** The signer of the action. */
928
970
  signer?: ActionSigner;
929
971
  };
930
972
  /**
931
973
  * Defines the basic structure of an action.
932
974
  */
933
975
  type Action = {
934
- /** The id of the action. This is distinct from the operation id. */id: string; /** The name of the action. */
935
- type: string; /** The timestamp of the action. */
936
- timestampUtcMs: string; /** The payload of the action. */
937
- input: unknown; /** The scope of the action */
938
- scope: string; /** The context of the action. */
976
+ /** The id of the action. This is distinct from the operation id. */
977
+ id: string;
978
+ /** The name of the action. */
979
+ type: string;
980
+ /** The timestamp of the action. */
981
+ timestampUtcMs: string;
982
+ /** The payload of the action. */
983
+ input: unknown;
984
+ /** The scope of the action */
985
+ scope: string;
986
+ /** The context of the action. */
939
987
  context?: ActionContext;
940
988
  };
941
989
  //#endregion
942
- //#region processors/http.d.ts
943
- /** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
944
- type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
945
- interface RouteUser {
946
- address: string;
947
- chainId: number;
948
- networkId: string;
949
- appKey: string;
990
+ //#region document-model/action-signature.d.ts
991
+ declare const ACTION_SIGNATURE_V2_PREFIX = "v2:";
992
+ /** The log an operation is stored in, which a v2 tuple is bound to. */
993
+ type ActionSigningTarget = {
994
+ documentId: string;
995
+ branch: string;
996
+ };
997
+ /** Who a v2 tuple attributes the action to; both halves are in the preimage. */
998
+ type ActionSignerIdentity = {
999
+ user: UserActionSigner;
1000
+ app: AppActionSigner;
1001
+ };
1002
+ /** A value that would not survive a JSON store round trip unchanged. */
1003
+ declare class CanonicalJsonError extends Error {
1004
+ constructor(path: string, detail: string);
950
1005
  }
951
- type RouteActor = {
952
- user: RouteUser | undefined;
953
- authEnabled: boolean;
1006
+ /** Sorted-key JSON, as the state hash encodes; drops `undefined` properties. */
1007
+ declare function canonicalJson(value: unknown, label?: string): string;
1008
+ /** Actions the reactor reduces itself, onto the document scope. */
1009
+ declare const DOCUMENT_SCOPE_ACTION_TYPES: ReadonlySet<string>;
1010
+ /** Where a document-scope action writes: `sourceId` or `documentId`. */
1011
+ declare function targetDocumentId(action: {
1012
+ type: string;
1013
+ input: unknown;
1014
+ }, fallback: string): string;
1015
+ /** The log an action submitted to a job on `documentId` is stored in. */
1016
+ declare function actionSigningTarget(action: {
1017
+ type: string;
1018
+ input: unknown;
1019
+ }, documentId: string, branch: string): ActionSigningTarget;
1020
+ /** The identity a signer writes into `context.signer`, and signs over. */
1021
+ declare function actionSignerIdentity(signer: {
1022
+ user?: UserActionSigner;
1023
+ app?: AppActionSigner;
1024
+ }): ActionSignerIdentity;
1025
+ /** The v2 preimage; throws `CanonicalJsonError` on an unsignable action. */
1026
+ declare function actionPreimageV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): string;
1027
+ /** `"v2:" + base64url(sha256(preimage))`, unpadded. */
1028
+ declare function hashActionV2(action: Action, target: ActionSigningTarget, signer: ActionSignerIdentity): Promise<string>;
1029
+ /** Signs `action` as a v2 tuple; the message layout is the legacy one. */
1030
+ declare function signActionV2(params: {
1031
+ action: Action;
1032
+ target: ActionSigningTarget;
1033
+ signer: ActionSignerIdentity;
1034
+ sign: ActionSigningHandler;
1035
+ previousStateHash?: string;
1036
+ }): Promise<Signature>;
1037
+ /** Element [2] carries the v2 prefix, whether or not it is well formed. */
1038
+ declare function isV2ActionHash(hash: string): boolean;
1039
+ /** The strict shape of a v2 tuple, apart from what its hash covers. */
1040
+ declare function v2TupleProblem(tuple: Signature): string | undefined;
1041
+ //#endregion
1042
+ //#region document-model/action-transport.d.ts
1043
+ /**
1044
+ * An action's signer, as the wire declares it: signatures joined into strings,
1045
+ * because GraphQL declares them as a list of strings rather than of lists.
1046
+ */
1047
+ type TransportSigner = {
1048
+ user?: {
1049
+ address: string;
1050
+ networkId: string;
1051
+ chainId: number;
1052
+ };
1053
+ app?: {
1054
+ name: string;
1055
+ key: string;
1056
+ };
1057
+ signatures: string[];
954
1058
  };
955
- type AuthorizerResult = {
956
- authorized: true;
957
- } /** Refused; the scope answers with its own JSON error envelope. */ | {
958
- authorized: false;
959
- status: number;
960
- message: string;
1059
+ /** An action's context, as the wire declares it. */
1060
+ type TransportActionContext = {
1061
+ prevOpIndex?: number;
1062
+ prevOpHash?: string;
1063
+ nonce?: string;
1064
+ signer?: TransportSigner;
1065
+ };
1066
+ /** An action projected onto exactly the fields the wire declares. */
1067
+ type TransportAction = {
1068
+ id: string;
1069
+ type: string;
1070
+ timestampUtcMs: string;
1071
+ /**
1072
+ * Non-nullable, because the wire declares it so. An action's own type says
1073
+ * `unknown`, which admits the absent input an action creator called without
1074
+ * one produces - {@link toTransportAction} refuses that rather than passing
1075
+ * it on.
1076
+ */
1077
+ input: NonNullable<unknown>;
1078
+ scope: string;
1079
+ context?: TransportActionContext;
1080
+ };
1081
+ /**
1082
+ * Projects an action onto the fields the GraphQL `ActionInput` declares.
1083
+ *
1084
+ * A projection rather than a spread, because an input object rejects a field it
1085
+ * does not declare, and that refusal takes the whole request with it. An action
1086
+ * read back out of storage can carry fields the type no longer has - a legacy
1087
+ * `attachments` array, or the operation fields left behind by a signing helper
1088
+ * that returns an operation - and any one of them would sink an otherwise valid
1089
+ * submission.
1090
+ *
1091
+ * Only fields the action actually carries are emitted, so an unsigned action
1092
+ * sends no context at all rather than a context full of nulls.
1093
+ */
1094
+ declare function toTransportAction(action: Action): TransportAction;
1095
+ //#endregion
1096
+ //#region document-model/auth.d.ts
1097
+ type InitializeAuthActionInput = {
1098
+ version: number;
1099
+ grants: Grant[];
1100
+ };
1101
+ type SetGrantActionInput = {
1102
+ grant: Grant;
1103
+ };
1104
+ type RemoveGrantActionInput = {
1105
+ id: string;
1106
+ };
1107
+ type MoveGrantActionInput = {
1108
+ id: string;
1109
+ /** Target index in the grant list; clamped to the valid range. */
1110
+ index: number;
1111
+ };
1112
+ type InitializeAuthAction = Action & {
1113
+ type: "INITIALIZE_AUTH";
1114
+ input: InitializeAuthActionInput;
1115
+ };
1116
+ type SetGrantAction = Action & {
1117
+ type: "SET_GRANT";
1118
+ input: SetGrantActionInput;
1119
+ };
1120
+ type RemoveGrantAction = Action & {
1121
+ type: "REMOVE_GRANT";
1122
+ input: RemoveGrantActionInput;
1123
+ };
1124
+ type MoveGrantAction = Action & {
1125
+ type: "MOVE_GRANT";
1126
+ input: MoveGrantActionInput;
1127
+ };
1128
+ type AuthAction = InitializeAuthAction | SetGrantAction | RemoveGrantAction | MoveGrantAction;
1129
+ declare const AUTH_ACTION_TYPES: readonly ["INITIALIZE_AUTH", "SET_GRANT", "REMOVE_GRANT", "MOVE_GRANT"];
1130
+ declare function isAuthAction(action: Action): action is AuthAction;
1131
+ /** Highest known policy version; decide() fails closed above it. */
1132
+ declare const MAX_SUPPORTED_AUTH_VERSION = 1;
1133
+ declare const InitializeAuthActionInputSchema: () => z.ZodObject<{
1134
+ version: z.ZodNumber;
1135
+ grants: z.ZodArray<z.ZodCustom<Grant, Grant>>;
1136
+ }, z.core.$strip>;
1137
+ declare const SetGrantActionInputSchema: () => z.ZodObject<{
1138
+ grant: z.ZodCustom<Grant, Grant>;
1139
+ }, z.core.$strip>;
1140
+ declare const RemoveGrantActionInputSchema: () => z.ZodObject<{
1141
+ id: z.ZodString;
1142
+ }, z.core.$strip>;
1143
+ declare const MoveGrantActionInputSchema: () => z.ZodObject<{
1144
+ id: z.ZodString;
1145
+ index: z.ZodNumber;
1146
+ }, z.core.$strip>;
1147
+ declare const initializeAuth: (input: InitializeAuthActionInput) => InitializeAuthAction;
1148
+ declare const setGrant: (input: SetGrantActionInput) => SetGrantAction;
1149
+ declare const removeGrant: (input: RemoveGrantActionInput) => RemoveGrantAction;
1150
+ declare const moveGrant: (input: MoveGrantActionInput) => MoveGrantAction;
1151
+ /**
1152
+ * True when `signerKey` (an ActionSigner app key, a did:key) identifies the same
1153
+ * key recorded as the document creator. Returns false
1154
+ * when there is no creator (empty JWK) or no signer key.
1155
+ */
1156
+ declare function isDocumentCreator(creatorKey: JsonWebKey | undefined, signerKey: string | undefined): boolean;
1157
+ /**
1158
+ * Sets the initial policy. Valid only while the auth scope is uninitialized
1159
+ * (version 0). The input version is the policy language version and must be an
1160
+ * integer >= 1; 0 is reserved for the uninitialized state. On a signed-header
1161
+ * document it must be signed by the document creator (`header.sig.publicKey`).
1162
+ * A creator-less policy must include a grant permitting execute on the auth
1163
+ * scope, or it would be born locked out.
1164
+ */
1165
+ declare function applyInitializeAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: InitializeAuthAction): PHDocument<TState>;
1166
+ /** Upserts a grant by id: replaces in place if present, otherwise appends. */
1167
+ declare function applySetGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: SetGrantAction): PHDocument<TState>;
1168
+ /**
1169
+ * Removes a grant by id; throws if the id is not present or if the removal
1170
+ * would leave a creator-less policy with no auth-administration grant.
1171
+ */
1172
+ declare function applyRemoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: RemoveGrantAction): PHDocument<TState>;
1173
+ /**
1174
+ * Moves a grant by id to a new index. Order is load-bearing (the last
1175
+ * applicable grant wins), so the relative order of the other grants is kept.
1176
+ * The target index is clamped to the valid range; an unknown id throws.
1177
+ *
1178
+ * Order alone decides which grant wins, so a move can take administration away
1179
+ * without changing the list's contents. It carries the same retention rule as
1180
+ * the two mutation paths.
1181
+ */
1182
+ declare function applyMoveGrantAction<TState extends PHBaseState>(document: PHDocument<TState>, action: MoveGrantAction): PHDocument<TState>;
1183
+ /**
1184
+ * Dispatches an auth-scope action to its handler. This is the auth scope's
1185
+ * dedicated reducer: it is applied by the base reducer instead of the model
1186
+ * reducer, mirroring the document-scope platform handlers. Unknown types are a
1187
+ * no-op, matching the model-reducer default.
1188
+ */
1189
+ declare function applyAuthAction<TState extends PHBaseState>(document: PHDocument<TState>, action: Action): PHDocument<TState>;
1190
+ /**
1191
+ * Because only creators can initialize auth scopes, we must verify that either
1192
+ * the document has no auth or the version and creator match.
1193
+ */
1194
+ declare function assertAuthPreservedOnDuplicate(documentId: string, source: PHAuthState | undefined, duplicated: PHAuthState | undefined): void;
1195
+ /**
1196
+ * The auth scope a state snapshot may install, given the policy already there.
1197
+ *
1198
+ * `applyAuthAction` is the validated door onto `state.auth`, but a whole-state
1199
+ * snapshot (UPGRADE_DOCUMENT's `initialState`) replaces the scope wholesale and
1200
+ * is authorized as a `document`-scope write. Without this, a subject holding
1201
+ * `execute` on `document` and no auth grant at all can install a policy of its
1202
+ * choosing, name itself `creator` (which exempts the policy from the retention
1203
+ * rule for good), or wipe an existing policy by carrying the default
1204
+ * uninitialized one.
1205
+ *
1206
+ * Three cases:
1207
+ *
1208
+ * - the snapshot carries no policy, or an uninitialized one: the document
1209
+ * keeps the policy it has, so a default-state upgrade cannot reset it;
1210
+ * - the document is uninitialized and the snapshot carries a policy: the
1211
+ * policy is installed after the same validation genesis applies, so it
1212
+ * cannot be born locked out;
1213
+ * - both carry a policy: they must agree. A duplicate preserves its source's
1214
+ * policy (see {@link assertAuthPreservedOnDuplicate}), and anything else is
1215
+ * an attempt to replace one policy with another.
1216
+ */
1217
+ declare function resolveSnapshotAuth(documentId: string, documentType: string, current: PHAuthState | undefined, incoming: PHAuthState | undefined): PHAuthState;
1218
+ /** UNDO and REDO are rejected on the auth scope. */
1219
+ declare function assertAuthScopeActionAllowed(action: Action): void;
1220
+ type AuthVerb = "read" | "execute";
1221
+ type AuthRequest = {
1222
+ verb: AuthVerb;
1223
+ scope: string;
1224
+ /** For execute: the operation (action type) being attempted. Omitted for reads. */
1225
+ operation?: string;
1226
+ };
1227
+ type AuthSubject = {
1228
+ /** Verified signer address; undefined for an anonymous subject. */
1229
+ address?: string;
1230
+ /** The signer's app key (a did:key), used to match the document creator. */
1231
+ key?: string;
1232
+ };
1233
+ /**
1234
+ * What condition attr paths resolve against, beyond the subject. Supplied
1235
+ * only while authConditions enforcement is on: with no context a grant
1236
+ * carrying `where` or a { match } principal never applies.
1237
+ */
1238
+ type ConditionContext = {
1239
+ /** The executing scope's own state, for `doc.<scope>.*` paths. */
1240
+ scopeState: unknown;
1241
+ /** The action's input, for `action.input.*` paths. Absent for reads. */
1242
+ actionInput?: unknown;
1243
+ };
1244
+ type AuthDecision = "allow" | "deny";
1245
+ /** Why the policy refused a request. */
1246
+ type AuthRefusal = "version-unsupported" | "no-applicable-grant" | "denied-by-grant";
1247
+ /**
1248
+ * A decision together with why it refused. A refusal names which of the
1249
+ * policy's rules produced it, so an operation records the reason it was refused
1250
+ * rather than one reason standing for every refusal.
1251
+ */
1252
+ type AuthEvaluation = {
1253
+ decision: "allow";
961
1254
  } | {
962
- authorized: false;
963
- response: Response;
1255
+ decision: "deny";
1256
+ refusal: AuthRefusal;
1257
+ grantId?: string;
964
1258
  };
965
- /** A route-specific gate, for policies the standard modes cannot express. */
966
- type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
967
- /** How a route authenticates. */
968
- type RouteAuth = /** Default. A verifiable bearer is required; a caller without one gets 401. */"renown" | "renown-optional" | "public" | RouteAuthorizer;
969
- /** How the request body reaches the handler. */
970
- type RouteBody = /** Default. Buffered, and readable through the Fetch Request. */"parsed" /** Buffered and also handed over as `ctx.rawBody`, byte for byte. */ | "raw" /** Not buffered; the Fetch Request body is the live request stream. */ | "stream" /** The body is not read at all. */ | "none";
971
- interface RouteOptions {
972
- auth?: RouteAuth;
973
- body?: RouteBody;
974
- /** Refuse a body larger than this with 413. Ignored when body is `stream`. */
975
- maxBodyBytes?: number;
976
- /** Serve sub-paths too, not just an exact match. */
977
- prefix?: boolean;
978
- }
979
- /** Where the request reached the host, resolved through any reverse proxy. */
980
- interface RouteTransport {
981
- proto: string;
982
- host: string;
983
- prefix: string;
984
- baseUrl: string;
985
- }
986
- interface RouteContext {
987
- /** Decoded path params. */
988
- params: Record<string, string>;
989
- user: RouteUser | undefined;
990
- authEnabled: boolean;
991
- /** The exact octets received. Present only when body is `raw`. */
992
- rawBody: Buffer | undefined;
993
- /** Aborts when the client disconnects. */
994
- signal: AbortSignal;
995
- transport: RouteTransport;
996
- }
997
- type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
998
- interface RouteSpec extends RouteOptions {
999
- method: RouteMethod | RouteMethod[];
1000
- /** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
1001
- path: string;
1002
- handler: RouteHandler;
1259
+ /**
1260
+ * Evaluates the auth policy for a single request and reports why it refused.
1261
+ * Pure and deterministic.
1262
+ *
1263
+ * An uninitialized policy (version 0, absent auth state, or a legacy `{}`
1264
+ * auth scope serialized before PHAuthState had a version) leaves the document
1265
+ * open. Once a policy exists the default is deny, and grants stack in order.
1266
+ *
1267
+ * Group principals match only against a supplied groups map (the groups
1268
+ * projection, present when authGroups is on); with no map they never apply.
1269
+ * `where` clauses and { match } principals likewise evaluate only against a
1270
+ * supplied condition context (present when authConditions is on).
1271
+ */
1272
+ declare function evaluate(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
1273
+ /**
1274
+ * Evaluates the auth policy for a single request. Pure and deterministic. This
1275
+ * is {@link evaluate} with the reason dropped.
1276
+ */
1277
+ declare function decide(auth: PHAuthState | undefined, subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
1278
+ /**
1279
+ * The group document ids a single auth action's input names with `{ group }`
1280
+ * principals. INITIALIZE_AUTH contributes the groups named across its grants,
1281
+ * SET_GRANT the groups named by its one grant; REMOVE_GRANT and MOVE_GRANT
1282
+ * contribute nothing. Total over any input shape, because references are read
1283
+ * from the input as it arrived, including inputs later stored as errors.
1284
+ */
1285
+ declare function mentionedGroupIds(action: Action): string[];
1286
+ //#endregion
1287
+ //#region document-model/auth-v1.d.ts
1288
+ /** Maximum number of grants in a policy. */
1289
+ declare const MAX_AUTH_GRANTS = 100;
1290
+ /** Maximum nesting depth of a condition tree. */
1291
+ declare const MAX_CONDITION_DEPTH = 10;
1292
+ /** Maximum node count (conditions plus operands) of a condition tree. */
1293
+ declare const MAX_CONDITION_NODES = 100;
1294
+ /** Maximum entries in an execute capability's operation list. */
1295
+ declare const MAX_CAPABILITY_OPERATIONS = 100;
1296
+ /**
1297
+ * Thrown when a grant violates the v1 validation rules. The message is stored
1298
+ * on error operations, so it must be a pure function of the input.
1299
+ */
1300
+ declare class InvalidGrantError extends Error {
1301
+ readonly grantId: string;
1302
+ constructor(grantId: string, problem: string);
1003
1303
  }
1004
- interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
1005
- method: RouteMethod | RouteMethod[];
1006
- path: string;
1007
- handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
1304
+ /** Thrown for a `{ group }` principal on a group document: references never chain. */
1305
+ declare class GroupPrincipalNotAllowedError extends Error {
1306
+ readonly grantId: string;
1307
+ constructor(grantId: string);
1008
1308
  }
1009
- interface ScopedRouteHandle {
1010
- /** The absolute public URL this route answers on. */
1011
- readonly url: string;
1012
- dispose(): void;
1309
+ /**
1310
+ * Thrown when a change would leave a creator-less policy with no grant
1311
+ * permitting execute on the auth scope. Without the creator carve-out no
1312
+ * subject could ever administer such a policy again.
1313
+ */
1314
+ declare class AuthAdministrationLockoutError extends Error {
1315
+ readonly grantId: string;
1316
+ constructor(grantId: string);
1013
1317
  }
1014
- type WebhookScheme = "none" /** A shared secret presented verbatim. No digest, so no digest options. */ | "token" /** The digest of the body, alone. */ | "hmac" /** That digest behind a label, `sha256=<digest>`. */ | "hmac-prefixed" | "hmac-timestamped";
1015
- /** Hashes a sender may compute the digest with. */
1016
- type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
1017
- /** How the digest is written into the header. */
1018
- type WebhookSignatureEncoding = "hex" | "base64";
1019
- interface WebhookVerification {
1020
- scheme: WebhookScheme;
1021
- /** Resolved value, never a reference — the caller resolves refs. */
1022
- secret?: string;
1023
- /** Overrides the scheme's conventional header. */
1024
- header?: string;
1025
- /** Replay window for timestamped schemes. */
1026
- toleranceSeconds?: number;
1027
- algorithm?: WebhookHashAlgorithm;
1028
- /** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
1029
- encoding?: WebhookSignatureEncoding;
1030
- prefix?: string;
1318
+ /**
1319
+ * Thrown when INITIALIZE_AUTH would create a creator-less policy with no grant
1320
+ * permitting execute on the auth scope. Such a policy would be born with no
1321
+ * subject able to administer it.
1322
+ */
1323
+ declare class AuthAdministrationMissingError extends Error {
1324
+ constructor();
1031
1325
  }
1032
- type WebhookField = string | {
1033
- header: string;
1034
- } /** Dot-separated path into the parsed body, e.g. `data.object.id`. */ | {
1035
- body: string;
1036
- };
1037
- interface WebhookRequest {
1038
- /** The caller's own key for this endpoint, e.g. a document id. */
1039
- key: string;
1040
- method: string;
1041
- path: string;
1042
- queryParams: Record<string, string>;
1043
- /** Lowercased, with credentials redacted. */
1044
- headers: Record<string, string>;
1045
- /** The exact bytes received. */
1046
- raw: Buffer;
1047
- /** JSON and form bodies decoded; anything else as text. */
1048
- body: unknown;
1326
+ declare function isPlainValue(value: unknown): value is Record<string, unknown>;
1327
+ /** Returns the first v1-rule violation, or null. Pure, total, deterministic. */
1328
+ declare function grantProblem(value: unknown): string | null;
1329
+ declare const GrantSchema: () => z.ZodCustom<Grant, Grant>;
1330
+ /** V1 shape rules plus the group-document group-principal ban. */
1331
+ declare function assertValidGrant(grant: unknown, documentType: string): void;
1332
+ /**
1333
+ * Validates an initial grant list: the count cap, every grant, and — on a
1334
+ * creator-less policy — that some grant keeps the auth scope administrable.
1335
+ */
1336
+ declare function assertValidInitialGrants(grants: Grant[], documentType: string, creator: string | undefined): void;
1337
+ /**
1338
+ * Validates a grant upsert: the grant itself, the count cap on append, and
1339
+ * administration retention. Retention is checked on an append as well as an
1340
+ * in-place replace, because a grant appended after the administration grant can
1341
+ * shadow it (evaluation is last-applicable-grant-wins) and so take
1342
+ * administration away without removing anything.
1343
+ */
1344
+ declare function assertValidGrantUpsert(grant: Grant, existing: Grant[], documentType: string, creator: string | undefined): void;
1345
+ /**
1346
+ * A creator-less policy must always retain a grant permitting execute on the
1347
+ * auth scope; on a signed document the creator carve-out keeps administration
1348
+ * reachable instead. Rejects a change that takes the last such grant away. A
1349
+ * policy already without one is left alone: the change is not what locks it.
1350
+ */
1351
+ declare function assertAuthAdministrationRetained(creator: string | undefined, previous: Grant[], next: Grant[], grantId: string): void;
1352
+ /**
1353
+ * Evaluates a version-1 condition. Deterministic, total, and pure: any input
1354
+ * shape yields a boolean and never throws, and a malformed condition is
1355
+ * false. These are consensus semantics, versioned by `PHAuthState.version`;
1356
+ * changing them requires a new version.
1357
+ */
1358
+ declare function evaluateCondition(condition: Condition, subject: AuthSubject, request: AuthRequest, conditions: ConditionContext): boolean;
1359
+ /**
1360
+ * The group document ids named by `{ group }` principals in a grant list, in
1361
+ * order of first appearance. These are the streams the groups projection reads.
1362
+ */
1363
+ declare function referencedGroupIds(grants: Grant[]): string[];
1364
+ /**
1365
+ * Evaluates a v1 grant stack: default deny, last applicable grant wins, and
1366
+ * reports which grant decided it. Group principals match only against a
1367
+ * supplied groups map, and `where` clauses and { match } principals evaluate
1368
+ * only against a supplied condition context; a grant that uses an unsupplied
1369
+ * feature never applies.
1370
+ */
1371
+ declare function evaluateGrantStack(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthEvaluation;
1372
+ /**
1373
+ * Evaluates a v1 grant stack: default deny, last applicable grant wins. This is
1374
+ * {@link evaluateGrantStack} with the reason dropped.
1375
+ */
1376
+ declare function evaluateGrants(grants: Grant[], subject: AuthSubject, request: AuthRequest, groups?: AuthGroups, conditions?: ConditionContext): AuthDecision;
1377
+ //#endregion
1378
+ //#region document-model/constants.d.ts
1379
+ declare const documentModelFileExtension: "phdm";
1380
+ declare const documentModelInitialLocalState: DocumentModelLocalState;
1381
+ declare const documentModelInitialGlobalState: DocumentModelGlobalState;
1382
+ declare const documentModelGlobalState: DocumentModelGlobalState;
1383
+ declare const HASH_ALGORITHM_SHA1 = "sha1";
1384
+ declare const HASH_ALGORITHM_SHA256 = "sha256";
1385
+ declare const HASH_ALGORITHM_SHA512 = "sha512";
1386
+ declare const HASH_ENCODING_BASE64 = "base64";
1387
+ declare const HASH_ENCODING_HEX = "hex";
1388
+ //#endregion
1389
+ //#region document-model/crypto.d.ts
1390
+ declare const hashBrowser: (data: string | Uint8Array | ArrayBufferView | DataView, algorithm?: string, encoding?: string, _params?: Record<string, unknown>) => string;
1391
+ declare function getUnixTimestamp(date: Date | string): string;
1392
+ declare function buildOperationSignatureParams({ documentId, signer, action, previousStateHash }: ActionSignatureContext): [string, string, string, string];
1393
+ declare function buildOperationSignatureMessage(params: [string, string, string, string]): Uint8Array;
1394
+ declare function ab2hex(ab: ArrayBuffer | ArrayBufferView): string;
1395
+ declare function hex2ab(hex: string): Uint8Array<ArrayBuffer>;
1396
+ /**
1397
+ * Decodes a base58btc (Bitcoin/IPFS alphabet) string to bytes. Returns null on
1398
+ * any character outside the alphabet.
1399
+ */
1400
+ declare function base58Decode(input: string): Uint8Array | null;
1401
+ /** Encodes bytes as unpadded base64url. */
1402
+ declare function bytesToBase64Url(bytes: Uint8Array): string;
1403
+ /** Decodes a base64url string to bytes (portable across node, browsers, workers). */
1404
+ declare function base64UrlToBytes(input: string): Uint8Array;
1405
+ //#endregion
1406
+ //#region document-model/denied.d.ts
1407
+ /**
1408
+ * True iff authorization rejected the action.
1409
+ */
1410
+ declare function isDenied(operation: Operation): boolean;
1411
+ /**
1412
+ * The closed set of strings persisted as `deniedReason`. Re-evaluation compares
1413
+ * them, so they are consensus data: exact strings that embed no grant id,
1414
+ * subject or timestamp. Changing one is history-visible.
1415
+ */
1416
+ declare const DOCUMENT_DELETED_REASON = "document deleted";
1417
+ declare const AUTH_VERSION_UNSUPPORTED_REASON = "auth policy version unsupported";
1418
+ declare const AUTH_NO_GRANT_REASON = "no grant permits this operation";
1419
+ declare const AUTH_DENIED_BY_GRANT_REASON = "denied by grant";
1420
+ //#endregion
1421
+ //#region document-model/document-schema.d.ts
1422
+ declare const BaseDocumentHeaderSchema: z.ZodObject<{
1423
+ id: z.ZodString;
1424
+ name: z.ZodString;
1425
+ createdAtUtcIso: z.ZodString;
1426
+ lastModifiedAtUtcIso: z.ZodString;
1427
+ documentType: z.ZodString;
1428
+ }, z.core.$strip>;
1429
+ declare const BaseDocumentStateSchema: z.ZodObject<{
1430
+ global: z.ZodUnknown;
1431
+ }, z.core.$strip>;
1432
+ /** Schema for validating the header object of a DocumentModel document */
1433
+ declare const DocumentModelHeaderSchema: z.ZodObject<{
1434
+ id: z.ZodString;
1435
+ name: z.ZodString;
1436
+ createdAtUtcIso: z.ZodString;
1437
+ lastModifiedAtUtcIso: z.ZodString;
1438
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
1439
+ }, z.core.$strip>;
1440
+ /** Schema for validating the state object of a DocumentModel document */
1441
+ declare const DocumentModelPHStateSchema: z.ZodObject<{
1442
+ global: z.ZodObject<Required<{
1443
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1444
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1445
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1446
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1447
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1448
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1449
+ }>, z.core.$strip>;
1450
+ }, z.core.$strip>;
1451
+ declare const DocumentModelSchema: z.ZodObject<{
1452
+ header: z.ZodObject<{
1453
+ id: z.ZodString;
1454
+ name: z.ZodString;
1455
+ createdAtUtcIso: z.ZodString;
1456
+ lastModifiedAtUtcIso: z.ZodString;
1457
+ documentType: z.ZodLiteral<"powerhouse/document-model">;
1458
+ }, z.core.$strip>;
1459
+ state: z.ZodObject<{
1460
+ global: z.ZodObject<Required<{
1461
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1462
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1463
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1464
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1465
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1466
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1467
+ }>, z.core.$strip>;
1468
+ }, z.core.$strip>;
1469
+ initialState: z.ZodObject<{
1470
+ global: z.ZodObject<Required<{
1471
+ author: z.ZodType<Author, Author, z.core.$ZodTypeInternals<Author, Author>>;
1472
+ description: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1473
+ extension: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1474
+ id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1475
+ name: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1476
+ specifications: z.ZodType<DocumentSpecification[], DocumentSpecification[], z.core.$ZodTypeInternals<DocumentSpecification[], DocumentSpecification[]>>;
1477
+ }>, z.core.$strip>;
1478
+ }, z.core.$strip>;
1479
+ }, z.core.$strip>;
1480
+ /** Simple helper function to check if a state object is a DocumentModel document state object */
1481
+ declare function isDocumentModelState(state: unknown): state is DocumentModelPHState;
1482
+ /** Simple helper function to assert that a document state object is a DocumentModel document state object */
1483
+ declare function assertIsDocumentModelState(state: unknown): asserts state is DocumentModelPHState;
1484
+ /** Simple helper function to check if a document is a DocumentModel document */
1485
+ declare function isDocumentModelDocument(document: unknown): document is DocumentModelDocument;
1486
+ /** Simple helper function to assert that a document is a DocumentModel document */
1487
+ declare function assertIsDocumentModelDocument(document: unknown): asserts document is DocumentModelDocument;
1488
+ //#endregion
1489
+ //#region document-model/document-type.d.ts
1490
+ declare const documentModelDocumentType = "powerhouse/document-model";
1491
+ declare const groupDocumentType = "powerhouse/reactor-group";
1492
+ /**
1493
+ * The group-model action types that change membership. The groups projection
1494
+ * filters its reads to these, so any other group operation is invisible to a
1495
+ * decision. Kept here so the reactor never depends on the group package; a
1496
+ * reactor-group test guards against drift.
1497
+ */
1498
+ declare const groupMembershipActionTypes: readonly ["ADD_MEMBER", "REMOVE_MEMBER"];
1499
+ //#endregion
1500
+ //#region document-model/errors.d.ts
1501
+ declare const FileSystemError: Error;
1502
+ declare class InvalidActionInputError extends Error {
1503
+ data: unknown;
1504
+ constructor(data: unknown);
1049
1505
  }
1050
- interface WebhookReply {
1051
- status: number;
1052
- body?: string;
1053
- contentType?: string;
1506
+ declare class InvalidActionInputZodError extends InvalidActionInputError {
1507
+ issues: ZodIssue[];
1508
+ constructor(issues: ZodIssue[]);
1054
1509
  }
1055
- interface WebhookPolicy {
1056
- verify?: WebhookVerification;
1057
- /** Uppercase. Undefined accepts every method. */
1058
- methods?: string[];
1059
- dedupe?: {
1060
- field: WebhookField;
1061
- ttlSeconds?: number;
1062
- };
1063
- challengeField?: WebhookField;
1064
- maxBodyBytes?: number;
1510
+ /**
1511
+ * Error thrown when attempting to downgrade a document version.
1512
+ */
1513
+ declare class DowngradeNotSupportedError extends Error {
1514
+ readonly documentType: string;
1515
+ readonly fromVersion: number;
1516
+ readonly toVersion: number;
1517
+ constructor(documentType: string, fromVersion: number, toVersion: number);
1065
1518
  }
1066
- interface WebhookSpec {
1067
- /** Distinguishes several endpoint families within one package. */
1068
- name: string;
1069
- defaults?: WebhookPolicy;
1070
- onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
1071
- policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
1519
+ /**
1520
+ * Thrown when INITIALIZE_AUTH is applied to an already-initialized auth scope.
1521
+ * The genesis action is valid only at auth revision zero.
1522
+ */
1523
+ declare class AuthAlreadyInitializedError extends Error {
1524
+ readonly documentId: string;
1525
+ constructor(documentId: string);
1072
1526
  }
1073
- interface WebhookEndpointInfo {
1074
- key: string;
1075
- token: string;
1076
- url: string;
1077
- createdAt: string;
1527
+ /**
1528
+ * Thrown when INITIALIZE_AUTH is not signed by the document creator (its signer
1529
+ * does not match `header.sig.publicKey`), so it cannot set the auth policy.
1530
+ */
1531
+ declare class AuthInitializerNotCreatorError extends Error {
1532
+ readonly documentId: string;
1533
+ constructor(documentId: string);
1078
1534
  }
1079
- interface IWebhookEndpoints {
1080
- endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
1081
- revoke(key: string): Promise<void>;
1082
- list(): Promise<WebhookEndpointInfo[]>;
1535
+ /**
1536
+ * Thrown when INITIALIZE_AUTH carries a version below 1. Version 0 is reserved
1537
+ * for the uninitialized auth scope.
1538
+ */
1539
+ declare class InvalidAuthVersionError extends Error {
1540
+ readonly documentId: string;
1541
+ readonly version: number;
1542
+ constructor(documentId: string, version: number);
1083
1543
  }
1084
- interface IWebhookScope {
1085
- register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
1086
- readonly hasPublicOrigin: boolean;
1544
+ /** Thrown when a duplicate would lose the source policy's version or creator binding. */
1545
+ declare class AuthPolicyNotPreservedError extends Error {
1546
+ readonly documentId: string;
1547
+ constructor(documentId: string);
1087
1548
  }
1088
- interface IHttpScope {
1089
- readonly owner: string;
1090
- readonly baseUrl: string;
1091
- get(path: string, handler: RouteHandler): ScopedRouteHandle;
1092
- get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1093
- post(path: string, handler: RouteHandler): ScopedRouteHandle;
1094
- post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1095
- put(path: string, handler: RouteHandler): ScopedRouteHandle;
1096
- put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1097
- patch(path: string, handler: RouteHandler): ScopedRouteHandle;
1098
- patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1099
- delete(path: string, handler: RouteHandler): ScopedRouteHandle;
1100
- delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1101
- /** Registered independently of GET: a HEAD response is not a bodyless GET. */
1102
- head(path: string, handler: RouteHandler): ScopedRouteHandle;
1103
- head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
1104
- route(spec: RouteSpec): ScopedRouteHandle;
1105
- nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
1106
- readonly webhooks: IWebhookScope;
1107
- /** Release every route this scope registered. Called on package teardown. */
1108
- dispose(): void;
1549
+ /**
1550
+ * Thrown when a grant referenced by REMOVE_GRANT or MOVE_GRANT does not exist.
1551
+ */
1552
+ declare class GrantNotFoundError extends Error {
1553
+ readonly grantId: string;
1554
+ constructor(grantId: string);
1109
1555
  }
1110
- //#endregion
1111
- //#region processors/types.d.ts
1112
- type ProcessorDispatchResult = {
1113
- id: string;
1114
- status: string;
1115
- };
1116
- interface IProcessorDispatch {
1117
- execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
1556
+ /**
1557
+ * Thrown when a disallowed action (UNDO, REDO) targets the auth scope.
1558
+ */
1559
+ declare class AuthActionNotAllowedError extends Error {
1560
+ readonly actionType: string;
1561
+ constructor(actionType: string);
1118
1562
  }
1119
- interface IProcessorHostModuleBase {
1120
- analyticsStore: IAnalyticsStore;
1121
- relationalDb: IRelationalDb;
1122
- processorApp: ProcessorApp;
1123
- dispatch: IProcessorDispatch;
1124
- getReadModel<T>(name: string): T;
1125
- config?: Map<string, unknown>;
1126
- /**
1127
- * The package's slice of the HTTP surface, bound to its own namespace.
1128
- *
1129
- * Declared on the host-agnostic base rather than on each host's module so
1130
- * the two cannot drift: codegen types generated processors against
1131
- * reactor-browser's `IProcessorHostModule`, and the same source has to
1132
- * compile against reactor-api's.
1133
- *
1134
- * Absent whenever the host has no HTTP server — processors also run in the
1135
- * browser — and on the reactor when the package's name cannot be resolved to
1136
- * a routable namespace, so a caller must always check before using it.
1137
- */
1138
- http?: IHttpScope;
1563
+ declare class HashMismatchError extends Error {
1564
+ protected _scope: string;
1565
+ protected _document: PHDocument;
1566
+ protected _operation: Operation;
1567
+ constructor(scope: string, document: PHDocument, operation: Operation);
1568
+ get document(): PHDocument;
1569
+ get scope(): string;
1570
+ get operation(): Operation;
1139
1571
  }
1140
1572
  /**
1141
- * Filter for matching operations to processors.
1142
- * All fields are optional arrays - when provided, operations must match at least one value in each specified field.
1143
- * When a field is undefined or empty, it matches all values for that field.
1573
+ * Thrown when replay or import requires a document model version that is not
1574
+ * registered. Carries the data the UI needs to explain the mismatch.
1144
1575
  */
1145
- type ProcessorFilter = {
1146
- documentType?: string[];
1147
- scope?: string[];
1148
- branch?: string[];
1149
- documentId?: string[];
1576
+ declare class UnsupportedDocumentModelVersionError extends Error {
1577
+ readonly documentType: string;
1578
+ readonly requiredVersion: number;
1579
+ readonly availableVersions: number[];
1580
+ constructor(documentType: string, requiredVersion: number, availableVersions: number[]);
1581
+ static isError(error: unknown): error is UnsupportedDocumentModelVersionError;
1582
+ }
1583
+ //#endregion
1584
+ //#region document-model/upgrades.d.ts
1585
+ /** Upgrade reducer transforms a document from one version to another */
1586
+ type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
1587
+ type ModelVersion = number;
1588
+ /** Metadata about a version transition */
1589
+ type UpgradeTransition = {
1590
+ toVersion: ModelVersion;
1591
+ upgradeReducer: UpgradeReducer<any, any>;
1592
+ description?: string;
1593
+ };
1594
+ type TupleMember<T extends readonly unknown[]> = T[number];
1595
+ /** Manifest declaring all supported versions and upgrade paths */
1596
+ type UpgradeManifest<TVersions extends readonly number[]> = {
1597
+ documentType: string;
1598
+ latestVersion: TupleMember<TVersions>;
1599
+ supportedVersions: TVersions;
1600
+ upgrades: { [V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition; };
1150
1601
  };
1151
1602
  /**
1152
- * Describes an object that can process operations.
1603
+ * Applies an UPGRADE_DOCUMENT action to a document.
1604
+ * Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
1605
+ *
1606
+ * Behavior based on fromVersion/toVersion:
1607
+ * - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
1608
+ * - fromVersion > toVersion: Throw DowngradeNotSupportedError
1609
+ * - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
1153
1610
  */
1154
- interface IProcessor {
1155
- /**
1156
- * Processes a list of operations with context.
1157
- * Called when operations match this processor's filter.
1158
- */
1159
- onOperations(operations: OperationWithContext[]): Promise<void>;
1160
- /**
1161
- * Called when the processor is disconnected.
1162
- * Used to clean up any resources allocated during processor creation.
1163
- */
1164
- onDisconnect(): Promise<void>;
1165
- }
1611
+ declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
1612
+ /** CREATE_DOCUMENT fixes `protocolVersions`; this puts them back after a reducer. */
1613
+ declare function withProtocolVersions<TDocument extends PHDocument>(document: TDocument, protocolVersions: PHDocument["header"]["protocolVersions"]): TDocument;
1166
1614
  /**
1167
- * Relates a processor to its filter configuration.
1615
+ * Applies a DELETE_DOCUMENT action, or a PURGE_DOCUMENT marker, to a document.
1616
+ * Marks the document as deleted in the document scope state.
1168
1617
  */
1169
- type ProcessorRecord = {
1170
- processor: IProcessor;
1171
- filter: ProcessorFilter;
1172
- startFrom?: "beginning" | "current";
1173
- id?: string;
1174
- };
1618
+ declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction | PurgeDocumentAction): PHDocument;
1175
1619
  /**
1176
- * A factory function that creates processor records for a given drive.
1177
- * Called once per drive when the drive is first detected or when the factory is registered.
1620
+ * Computes the ordered list of upgrade transitions needed to move from
1621
+ * fromVersion to toVersion using the provided manifest.
1622
+ * Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
1623
+ * if the manifest is absent or any step is missing.
1178
1624
  */
1179
- type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
1180
- /** Takes a processor host module and builds processor factories using its context. */
1181
- type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
1182
- bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
1183
- }["bivarianceHack"];
1184
- type ProcessorStatus = "active" | "errored";
1185
- type TrackedProcessor = {
1186
- processorId: string;
1187
- factoryId: string;
1188
- driveId: string;
1189
- processorIndex: number;
1190
- record: ProcessorRecord;
1191
- lastOrdinal: number;
1192
- status: ProcessorStatus;
1193
- lastError: string | undefined;
1194
- lastErrorTimestamp: Date | undefined;
1195
- retry: () => Promise<void>;
1625
+ declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
1626
+ //#endregion
1627
+ //#region document-model/versioned-replay.d.ts
1628
+ type VersionedReducers = Record<number, Reducer<PHBaseState>>;
1629
+ type VersionedReplayConfig = {
1630
+ reducers: VersionedReducers;
1631
+ upgradeManifest?: UpgradeManifest<readonly number[]>;
1196
1632
  };
1197
1633
  /**
1198
- * Manages processor creation and destruction based on drive operations.
1634
+ * Version-aware document replay. Replays a versioned document through per-version
1635
+ * reducers, applying upgrade transitions at segment boundaries.
1636
+ *
1637
+ * Algorithm (D5):
1638
+ * a. Build spine from operations["document"]. Empty spine or no upgrades → legacy fallback.
1639
+ * b. Collect UPGRADE_DOCUMENT ops from the spine.
1640
+ * c. Seed state from the creation upgrade (fromVersion===0). Missing seed with validated
1641
+ * upgrades throws; otherwise falls back to legacy.
1642
+ * d. Identify validated upgrades (fromVersion > 0, version increases). Compute per-scope
1643
+ * boundaries using revision snapshot (preferred) or timestamp fallback.
1644
+ * e. Loop over version segments, replaying each scope's ops through the matching reducer,
1645
+ * then applying the upgrade transition before the next segment.
1646
+ * f. Set header.revision["document"], verify per-scope hashes against state at op-time
1647
+ * (not post-upgrade state) when checkHashes is false, and map timestamps from input.
1648
+ *
1649
+ * operations must include ALL scopes (document scope is NOT stripped).
1650
+ * reuseOperationResultingState is ignored by this function — zip operations never carry
1651
+ * resultingState.
1199
1652
  */
1200
- interface IProcessorManager {
1201
- /**
1202
- * Registers a processor factory.
1203
- * Immediately creates processors for all existing drives.
1204
- */
1205
- registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
1206
- /**
1207
- * Unregisters a processor factory and disconnects all processors it created.
1208
- */
1209
- unregisterFactory(identifier: string): Promise<void>;
1210
- /**
1211
- * Gets a tracked processor by its ID.
1212
- */
1213
- get(processorId: string): TrackedProcessor | undefined;
1214
- /**
1215
- * Gets all tracked processors.
1216
- */
1217
- getAll(): TrackedProcessor[];
1218
- }
1219
- type ProcessorApp = (typeof PROCESSOR_APPS)[number];
1220
- type ProcessorApps = readonly ProcessorApp[];
1653
+ declare function replayDocumentVersioned<TState extends PHBaseState>(initialState: TState, operations: DocumentOperations, config: VersionedReplayConfig, header: PHDocumentHeader, dispatch?: SignalDispatch, options?: ReplayDocumentOptions): PHDocument<TState>;
1221
1654
  //#endregion
1222
- //#region processors/relational/types.d.ts
1223
- type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
1224
- type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
1225
- withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
1655
+ //#region document-model/files.d.ts
1656
+ declare function createZip(document: PHDocument): Promise<Uint8Array>;
1657
+ /**
1658
+ * Creates a minimal ZIP backup from strand data.
1659
+ * Used when the full document is not available (e.g., in onOperations handler).
1660
+ * Creates a ZIP with minimal header and empty operations.
1661
+ */
1662
+ declare function createMinimalZip(data: MinimalBackupData): Promise<Uint8Array>;
1663
+ declare function baseSaveToFileHandle(document: PHDocument, input: FileSystemFileHandle): Promise<void>;
1664
+ declare function baseLoadFromInput<TState extends PHBaseState>(input: FileInput, reducer: Reducer<TState>, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1665
+ declare function baseLoadFromInputVersioned<TState extends PHBaseState>(input: FileInput, config: VersionedReplayConfig, options?: ReplayDocumentOptions): Promise<PHDocument<TState>>;
1666
+ type BulkArchiveEntry = {
1667
+ /** "/"-separated zip path of a file entry (no trailing slash). */
1668
+ path: string;
1669
+ data: Uint8Array;
1226
1670
  };
1227
- type HashAlgorithms = "fnv1a";
1228
- type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
1229
1671
  /**
1230
- * The standardized relational database interface for relational db processors.
1231
- * This abstraction provides type-safe database operations while hiding the underlying
1232
- * database framework implementation details.
1233
- **/
1234
- type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
1235
- createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
1236
- queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
1672
+ * Whether this zip is a single Powerhouse document: the document's four JSON
1673
+ * entries (header/state/current-state/operations) at the archive root. A
1674
+ * bulk archive has a folder tree instead. Returns false for any input that
1675
+ * is not a readable zip.
1676
+ */
1677
+ declare function isDocumentZip(data: Uint8Array): Promise<boolean>;
1678
+ /**
1679
+ * The file entries of a zip (directory entries excluded). Used for bulk
1680
+ * archives; throws when the archive holds no files. Note this does NOT
1681
+ * validate that the entries are document zips — pair with isDocumentZip.
1682
+ */
1683
+ declare function parseBulkArchive(data: Uint8Array): Promise<BulkArchiveEntry[]>;
1684
+ /**
1685
+ * Assemble a zip from raw entries. A key ending in "/" with empty data is a
1686
+ * directory entry, so an archive's folder structure survives a round-trip.
1687
+ */
1688
+ declare function zipEntries(entries: Record<string, Uint8Array>): Promise<Uint8Array>;
1689
+ declare const documentModelLoadFromInput: LoadFromInput<DocumentModelPHState>;
1690
+ declare const documentModelSaveToFileHandle: SaveToFileHandle;
1691
+ declare function writeFileBrowser(path: string, name: string, stream: Uint8Array): Promise<string>;
1692
+ declare function readFileBrowser(path: string): void;
1693
+ declare function fetchFileBrowser(url: string): Promise<{
1694
+ data: Buffer;
1695
+ mimeType?: string;
1696
+ }>;
1697
+ declare const getFileBrowser: (file: string) => Promise<void>;
1698
+ //#endregion
1699
+ //#region document-model/header.d.ts
1700
+ /**
1701
+ * Creates a verification-only signer from a public key.
1702
+ * This signer can only verify signatures, not sign data.
1703
+ *
1704
+ * @param pubKey - The public key to use for verification.
1705
+ * @returns An ISigner that can only verify signatures.
1706
+ */
1707
+ declare function createVerificationSigner(pubKey: JsonWebKey): Promise<ISigner>;
1708
+ /**
1709
+ * Signs a header. Generally, this is not called directly, but rather through
1710
+ * {@link createSignedHeader}.
1711
+ *
1712
+ * @param parameters - The parameters used to sign the header.
1713
+ * @param signer - The signer of the document.
1714
+ *
1715
+ * @returns The signature of the header.
1716
+ */
1717
+ declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
1718
+ /**
1719
+ * Verifies a header signature. Generally, this is not called directly, but
1720
+ * rather through {@link validateHeader}.
1721
+ *
1722
+ * @param parameters - The parameters used to sign the header.
1723
+ * @param signature - The signature to verify.
1724
+ * @param signer - The signer of the document.
1725
+ */
1726
+ declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
1727
+ /**
1728
+ * Validates a header signature.
1729
+ */
1730
+ declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
1731
+ /**
1732
+ * Creates a header that has yet to be signed. This header is not valid, but
1733
+ * can be input into {@link createSignedHeader} to create a signed header.
1734
+ *
1735
+ * With `protocolVersions` requiring v2 signatures the header takes a random
1736
+ * nonce and the id {@link deriveDocumentId} gives, so `id` must be omitted.
1737
+ *
1738
+ * @returns An unsigned header for a document.
1739
+ */
1740
+ declare const createPresignedHeader: (id?: string, documentType?: string, protocolVersions?: ProtocolVersions) => PHDocumentHeader;
1741
+ /**
1742
+ * A header for a copy of a document headed `source`. A copy is v2-required
1743
+ * when its source is or when `policy` asks for it, and then takes a derived id;
1744
+ * otherwise it takes `id`. It keeps the source's other protocol versions.
1745
+ */
1746
+ declare function createCopyHeader(source: Pick<PHDocumentHeader, "documentType" | "protocolVersions">, id?: string, policy?: SignaturePolicy$1): PHDocumentHeader;
1747
+ /** Whether a v2-required `header` carries the id its params derive. */
1748
+ declare function hasDerivedDocumentId(header: PHDocumentHeader): boolean;
1749
+ /**
1750
+ * Creates a new, signed header for a document. This will replace the id of the
1751
+ * document.
1752
+ *
1753
+ * @param unsignedHeader - The unsigned header to created the signed header from.
1754
+ * @param signer - The signer of the document.
1755
+ *
1756
+ * @returns A new signed header for a document. Some fields are mutable and
1757
+ * some are not. See the PHDocumentHeader type for more information.
1758
+ */
1759
+ declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1760
+ /**
1761
+ * Creates a signed header for a document. The document header requires a signer
1762
+ * as the document id is a cryptographic signature.
1763
+ *
1764
+ * @param documentType - The type of the document.
1765
+ * @param signer - The signer of the document.
1766
+ *
1767
+ * @returns The signed header for a document. Some fields are mutable and
1768
+ * some are not. See the PHDocumentHeader type for more information.
1769
+ */
1770
+ declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
1771
+ //#endregion
1772
+ //#region document-model/peer-agreement.d.ts
1773
+ /** The reactor feature flags a capability's support is a function of. */
1774
+ type PeerCapabilityFlags = {
1775
+ readonly [flag: string]: boolean | undefined;
1776
+ };
1777
+ /** A document protocol, named by its `protocolVersions` key. */
1778
+ type ProtocolCapability = {
1779
+ kind: "protocol";
1780
+ name: string;
1781
+ /** What a peer that announces nothing is assumed to support. */
1782
+ baseline: readonly number[];
1783
+ supported(flags: PeerCapabilityFlags): readonly number[];
1784
+ /** The version new documents take when peers agree. Absent: not negotiated. */
1785
+ preferred?(flags: PeerCapabilityFlags): number;
1786
+ /** A header may omit the key. */
1787
+ optional: boolean;
1788
+ };
1789
+ /** A feature that changes what a peer sends or expects on the wire. */
1790
+ type FeatureCapability = {
1791
+ kind: "feature";
1792
+ name: string;
1793
+ baseline: readonly number[];
1794
+ supported(flags: PeerCapabilityFlags): readonly number[];
1795
+ };
1796
+ type PeerCapability = ProtocolCapability | FeatureCapability;
1797
+ /** A purged document's protocol; never preferred, so creation never selects it. */
1798
+ declare const DOCUMENT_PURGE_PROTOCOL = "document-purge";
1799
+ /** A peer that takes refusals of polled purge markers on the poll. */
1800
+ declare const MARKER_REFUSAL_FEATURE = "marker-refusal";
1801
+ declare const PEER_CAPABILITIES: readonly PeerCapability[];
1802
+ /** `base` plus `extra`; an extra replaces a base entry of the same name. */
1803
+ declare function mergePeerCapabilities(base: readonly PeerCapability[], extra: readonly PeerCapability[]): PeerCapability[];
1804
+ declare const PEER_MANIFEST_FORMAT = 1;
1805
+ type Supports = {
1806
+ protocols: {
1807
+ [protocol: string]: readonly number[];
1808
+ };
1809
+ features: {
1810
+ [feature: string]: readonly number[];
1811
+ };
1237
1812
  };
1238
- type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
1239
- type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
1240
- interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
1241
- namespace: string;
1242
- query: IRelationalQueryBuilder<TDatabaseSchema>;
1243
- filter: ProcessorFilter;
1244
- initAndUpgrade(): Promise<void>;
1245
- }
1246
- declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
1813
+ type PeerManifest = Supports & {
1814
+ format: 1;
1815
+ /** The signer's did:key, when configured; informational. */
1816
+ appKey?: string;
1817
+ /** Grows with every start of the reactor; a peer ignores an older one. */
1818
+ sequence: number;
1819
+ /** base64url(sha256(canonicalJson(Supports & { sequence }))) */
1820
+ revision: string;
1821
+ };
1822
+ /** What this reactor supports, for every capability it registers. */
1823
+ declare function localSupports(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags): Supports;
1824
+ /** What a peer that announces nothing supports. */
1825
+ declare function legacySupports(capabilities: readonly PeerCapability[]): Supports;
1826
+ declare function manifestRevision(supports: Supports, sequence?: number): string;
1827
+ declare function localPeerManifest(capabilities: readonly PeerCapability[], flags: PeerCapabilityFlags, appKey?: string, sequence?: number): PeerManifest;
1828
+ /** A manifest sent before the one already held; silence carries no sequence. */
1829
+ declare function isOlderManifest(next: PeerManifest | null, held: PeerManifest | null | undefined): boolean;
1830
+ /** A peer's manifest, or the baselines for a peer that announced none. */
1831
+ declare function peerSupports(manifest: PeerManifest | null, capabilities: readonly PeerCapability[]): Supports;
1247
1832
  /**
1248
- * Base class for relational db processors that require a relational database storage.
1249
- * This class abstracts database initialization, migration management, and resource cleanup,
1250
- * allowing derived classes to focus on business logic.
1833
+ * A manifest as received from a peer, or null when it is not one. Formats only
1834
+ * add fields, so one of an unknown format is read as its two maps.
1251
1835
  */
1252
- declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
1253
- protected _namespace: string;
1254
- protected _filter: ProcessorFilter;
1255
- protected relationalDb: IRelationalDb<TDatabaseSchema>;
1256
- constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>);
1257
- static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
1258
- /**
1259
- * Returns the namespace for a given drive id.
1260
- * This method can be overridden by derived classes to provide a custom namespace.
1261
- */
1262
- static getNamespace(driveId: string): string;
1263
- static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
1264
- /**
1265
- * Processes a list of operations with context.
1266
- * Called when operations match this processor's filter.
1267
- */
1268
- abstract onOperations(operations: OperationWithContext[]): Promise<void>;
1269
- /**
1270
- * Returns the filter for the processor.
1271
- * This method can be overridden by derived classes to provide a custom filter.
1272
- */
1273
- get filter(): ProcessorFilter;
1274
- /**
1275
- * Returns the namespace used by the processor.
1276
- */
1277
- get namespace(): string;
1278
- get query(): IRelationalQueryBuilder<TDatabaseSchema>;
1279
- /**
1280
- * Abstract method that derived classes must implement.
1281
- * This method is meant to be called on subclasses to initialize and upgrade the database.
1282
- */
1283
- abstract initAndUpgrade(): Promise<void>;
1284
- /**
1285
- * Called when the processor is disconnected.
1286
- * This method is meant to be overridden by subclasses to clean up resources.
1287
- */
1288
- abstract onDisconnect(): Promise<void>;
1289
- }
1836
+ declare function readPeerManifest(value: unknown): PeerManifest | null;
1837
+ /** Why a document may not go to a peer. */
1838
+ type HoldReason = {
1839
+ protocol: string;
1840
+ version: number;
1841
+ peerSupports: readonly number[];
1842
+ };
1843
+ /** Only keys this reactor registers are judged; an absent key agrees. */
1844
+ declare function holdReason(peer: Supports, versions: {
1845
+ readonly [protocol: string]: number;
1846
+ }, capabilities: readonly PeerCapability[]): HoldReason | undefined;
1847
+ /** Whether a peer runs every version this reactor does, so nothing is held. */
1848
+ declare function coversLocal(peer: Supports, local: Supports, capabilities: readonly PeerCapability[]): boolean;
1849
+ /**
1850
+ * protocolVersions for a new document: per negotiated protocol, the highest
1851
+ * version up to the local preference that every member supports, else the
1852
+ * lowest local one. `requested` wins over what is selected.
1853
+ */
1854
+ declare function selectProtocolVersions(input: {
1855
+ capabilities: readonly PeerCapability[];
1856
+ flags: PeerCapabilityFlags;
1857
+ members: Iterable<Supports>;
1858
+ requested?: {
1859
+ readonly [protocol: string]: number;
1860
+ };
1861
+ }): {
1862
+ [protocol: string]: number;
1863
+ };
1290
1864
  //#endregion
1291
- //#region processors/relational/utils.d.ts
1865
+ //#region document-model/purge.d.ts
1866
+ declare const PURGE_DOCUMENT = "PURGE_DOCUMENT";
1867
+ type PurgeMarkerOperation = Operation & {
1868
+ action: PurgeDocumentAction;
1869
+ };
1870
+ type ActionLike = Pick<Action, "type">;
1871
+ declare function isPurgeMarker(value: Action): value is PurgeDocumentAction;
1872
+ declare function isPurgeMarker(value: Operation): value is PurgeMarkerOperation;
1873
+ declare function isPurgeMarker(value: OperationWithContext$1): value is OperationWithContext$1 & {
1874
+ operation: PurgeMarkerOperation;
1875
+ };
1876
+ declare function isPurgeMarker(value: ActionLike | {
1877
+ action?: ActionLike;
1878
+ } | {
1879
+ operation: Operation;
1880
+ }): boolean;
1881
+ /** An unsigned marker; `purgedAtUtcIso` is the action's own timestamp. */
1882
+ declare function purgeDocumentAction(input: Omit<PurgeDocumentActionInput, "purgedAtUtcIso">, options?: {
1883
+ id?: string;
1884
+ timestampUtcMs?: string;
1885
+ }): PurgeDocumentAction;
1886
+ /** The sole row of a purged stream: document/main, index 0, skip 0, hash "". */
1887
+ declare function purgeMarkerOperation(action: PurgeDocumentAction): PurgeMarkerOperation;
1888
+ /** Protocol versions of a purged id; derived, never stored. */
1889
+ declare function purgedProtocolVersions(): {
1890
+ [protocol: string]: number;
1891
+ };
1892
+ //#endregion
1893
+ //#region document-model/reducer.d.ts
1894
+ declare function replayOperations<TState extends PHBaseState = PHBaseState>(initialState: TState, clearedOperations: DocumentOperations, stateReducer: StateReducer<TState>, header: PHDocumentHeader, dispatch?: SignalDispatch, documentReducer?: typeof baseReducer, skipHeaderOperations?: SkipHeaderOperations, options?: ReplayDocumentOptions): PHDocument<TState>;
1292
1895
  /**
1293
- * Hashes a string to a lowercase base-26 string.
1294
- * @param str The string to hash.
1295
- * @param length The length of the hash. Defaults to 10.
1296
- * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
1297
- * @returns The hashed string.
1896
+ * Updates the document state based on the provided action.
1897
+ *
1898
+ * @param state The current state of the document.
1899
+ * @param action The action being applied to the document.
1900
+ * @param skip The number of operations to skip before applying the action.
1901
+ * @param reuseLastOperationIndex Whether to reuse the last operation index (used when a an UNDO operation is performed after an existing one).
1902
+ * @param context The operation context for deterministic ID generation.
1903
+ * @returns The updated document state.
1298
1904
  */
1299
- declare function hashNamespace(str: string, length?: number): string;
1905
+ declare function updateDocument<TDocument extends PHDocument>(document: TDocument, action: Action, reuseLastOperationIndex: boolean, skip: number, context: OperationContext, operation?: Operation, skipIndexValidation?: boolean): TDocument;
1300
1906
  /**
1301
- * Creates a RelationalDb instance with namespace support.
1302
- * @param baseDb The base RelationalDb instance to enhance.
1303
- * @param baseOptions The default options for namespace creation. Hashes namespace by default.
1304
- * @returns The enhanced RelationalDb instance.
1907
+ * Processes an UNDO or REDO action.
1908
+ *
1909
+ * @param document The current state of the document.
1910
+ * @param action The action being applied to the document.
1911
+ * @param skip The number of operations to skip before applying the action.
1912
+ * @returns The updated document, calculated skip value and transformed action (if applied).
1305
1913
  */
1306
- declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
1307
- type NamespaceOptions = {
1308
- hashNamespace?: boolean;
1914
+ declare function processUndoRedo<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, skip: number, protocolVersion?: number): {
1915
+ document: PHDocument<TState>;
1916
+ action: Action;
1917
+ skip: number;
1918
+ reuseLastOperationIndex: boolean;
1309
1919
  };
1310
- declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
1311
- declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
1312
1920
  /**
1313
- * Returns a query builder for a RelationalDb instance.
1314
- * @param query The RelationalDb instance to convert.
1315
- * @returns The IRelationalQueryBuilder instance.
1921
+ * Base document reducer that wraps a custom document reducer and handles
1922
+ * document-level actions such as undo, redo, and set name.
1923
+ *
1924
+ * @template TGlobalState - The type of the state of the custom reducer.
1925
+ * @template TAction - The type of the actions of the custom reducer.
1926
+ * @param state - The current state of the document.
1927
+ * @param action - The action object to apply to the state.
1928
+ * @param customReducer - The custom reducer that implements the application logic
1929
+ * specific to the document's state.
1930
+ * @returns The new state of the document.
1931
+ */
1932
+ declare function baseReducer<TState extends PHBaseState = PHBaseState>(document: PHDocument<TState>, action: Action, customReducer: StateReducer<TState>, dispatch?: SignalDispatch, options?: ReducerOptions): PHDocument<TState>;
1933
+ /**
1934
+ * Helper function to create a document model reducer.
1935
+ *
1936
+ * @remarks
1937
+ * This function creates a new reducer that wraps the provided `reducer` with
1938
+ * `documentReducer`, adding support for document actions:
1939
+ * - `SET_NAME`
1940
+ * - `UNDO`
1941
+ * - `REDO`
1942
+ *
1943
+ * It also updates the document-related attributes on every operation.
1944
+ *
1945
+ * @param reducer - The custom reducer to wrap.
1946
+ * @param documentReducer - The document reducer to use.
1947
+ *
1948
+ * @returns The new reducer.
1316
1949
  */
1317
- declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1950
+ declare function createReducer<TState extends PHBaseState = PHBaseState>(stateReducer: StateReducer<TState>, documentReducer?: typeof baseReducer): Reducer<TState>;
1951
+ //#endregion
1952
+ //#region document-model/reducers.d.ts
1953
+ declare const documentModelHeaderReducer: DocumentModelHeaderOperations;
1954
+ declare const documentModelModuleReducer: DocumentModelModuleOperations;
1955
+ declare const documentModelOperationErrorReducer: DocumentModelOperationErrorOperations;
1956
+ declare const documentModelOperationExampleReducer: DocumentModelOperationExampleOperations;
1957
+ declare const documentModelOperationReducer: DocumentModelOperationOperations;
1958
+ declare const documentModelStateSchemaReducer: DocumentModelStateOperations;
1959
+ declare const documentModelVersioningReducer: DocumentModelVersioningOperations;
1960
+ declare const documentModelStateReducer: StateReducer<DocumentModelPHState>;
1961
+ declare const documentModelReducer: Reducer<DocumentModelPHState>;
1318
1962
  //#endregion
1319
1963
  //#region document-model/schemas.d.ts
1320
1964
  type definedNonNullAny = {};
1321
1965
  declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
1322
1966
  declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
1323
- declare const Load_StateSchema: z.ZodEnum<{
1324
- LOAD_STATE: "LOAD_STATE";
1325
- }>;
1326
- declare const PruneSchema: z.ZodEnum<{
1327
- PRUNE: "PRUNE";
1328
- }>;
1329
1967
  declare const RedoSchema: z.ZodEnum<{
1330
1968
  REDO: "REDO";
1331
1969
  }>;
@@ -1340,18 +1978,6 @@ declare const UndoSchema: z.ZodEnum<{
1340
1978
  }>;
1341
1979
  declare function OperationScopeSchema(): z.ZodString;
1342
1980
  declare function DocumentActionSchema(): z.ZodUnion<readonly [z.ZodObject<Required<{
1343
- id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1344
- timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1345
- input: z.ZodType<LoadStateActionInput, LoadStateActionInput, z.core.$ZodTypeInternals<LoadStateActionInput, LoadStateActionInput>>;
1346
- type: z.ZodType<"LOAD_STATE", "LOAD_STATE", z.core.$ZodTypeInternals<"LOAD_STATE", "LOAD_STATE">>;
1347
- scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1348
- }>, z.core.$strip>, z.ZodObject<Required<{
1349
- id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1350
- timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1351
- input: z.ZodType<PruneActionInput, PruneActionInput, z.core.$ZodTypeInternals<PruneActionInput, PruneActionInput>>;
1352
- type: z.ZodType<"PRUNE", "PRUNE", z.core.$ZodTypeInternals<"PRUNE", "PRUNE">>;
1353
- scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1354
- }>, z.core.$strip>, z.ZodObject<Required<{
1355
1981
  id: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1356
1982
  timestampUtcMs: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1357
1983
  input: z.ZodType<RedoActionInput, RedoActionInput, z.core.$ZodTypeInternals<RedoActionInput, RedoActionInput>>;
@@ -1376,11 +2002,6 @@ declare function DocumentActionSchema(): z.ZodUnion<readonly [z.ZodObject<Requir
1376
2002
  type: z.ZodType<"UNDO", "UNDO", z.core.$ZodTypeInternals<"UNDO", "UNDO">>;
1377
2003
  scope: z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
1378
2004
  }>, z.core.$strip>]>;
1379
- declare function LoadStateActionSchema(): z.ZodObject<Properties<SchemaLoadStateAction>>;
1380
- declare function LoadStateActionInputSchema(): z.ZodObject<Properties<LoadStateActionInput>>;
1381
- declare function LoadStateActionStateInputSchema(): z.ZodObject<Properties<LoadStateActionStateInput>>;
1382
- declare function PruneActionSchema(): z.ZodObject<Properties<SchemaPruneAction>>;
1383
- declare function PruneActionInputSchema(): z.ZodObject<Properties<PruneActionInput>>;
1384
2005
  declare function RedoActionInputSchema(): z.ZodObject<{
1385
2006
  count: z.ZodNumber;
1386
2007
  }, z.core.$strip>;
@@ -1397,7 +2018,7 @@ declare function UndoActionInputSchema(): z.ZodObject<{
1397
2018
  count: z.ZodNumber;
1398
2019
  }, z.core.$strip>;
1399
2020
  declare function UndoActionSchema(): z.ZodObject<Properties<SchemaUndoAction>>;
1400
- type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]> }>;
2021
+ type Properties<T> = Required<{ [K in keyof T]: z.ZodType<T[K], T[K]>; }>;
1401
2022
  declare function AddChangeLogItemInputSchema(): z.ZodObject<Properties<AddChangeLogItemInput>>;
1402
2023
  declare function AddModuleInputSchema(): z.ZodObject<Properties<AddModuleInput>>;
1403
2024
  declare function AddOperationErrorInputSchema(): z.ZodObject<Properties<AddOperationErrorInput>>;
@@ -1590,6 +2211,24 @@ declare const PowerhouseModulesSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
1590
2211
  name: z.ZodString;
1591
2212
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1592
2213
  }, z.core.$strip>>>;
2214
+ declare const PieceModuleSchema: z.ZodObject<{
2215
+ id: z.ZodString;
2216
+ name: z.ZodString;
2217
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2218
+ version: z.ZodOptional<z.ZodString>;
2219
+ description: z.ZodOptional<z.ZodString>;
2220
+ bundle: z.ZodOptional<z.ZodString>;
2221
+ descriptor: z.ZodOptional<z.ZodString>;
2222
+ }, z.core.$strip>;
2223
+ declare const PieceModulesSchema: z.ZodOptional<z.ZodArray<z.ZodObject<{
2224
+ id: z.ZodString;
2225
+ name: z.ZodString;
2226
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2227
+ version: z.ZodOptional<z.ZodString>;
2228
+ description: z.ZodOptional<z.ZodString>;
2229
+ bundle: z.ZodOptional<z.ZodString>;
2230
+ descriptor: z.ZodOptional<z.ZodString>;
2231
+ }, z.core.$strip>>>;
1593
2232
  declare const PublisherSchema: z.ZodObject<{
1594
2233
  name: z.ZodOptional<z.ZodString>;
1595
2234
  url: z.ZodOptional<z.ZodString>;
@@ -1600,7 +2239,7 @@ declare const ConfigEntrySchema: z.ZodObject<{
1600
2239
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1601
2240
  description: z.ZodOptional<z.ZodString>;
1602
2241
  required: z.ZodOptional<z.ZodBoolean>;
1603
- default: z.ZodOptional<z.ZodBoolean>;
2242
+ default: z.ZodOptional<z.ZodString>;
1604
2243
  }, z.core.$strip>;
1605
2244
  declare const PwaConfigSchema: z.ZodType<PHConnectPwa>;
1606
2245
  declare const ManifestSchema: z.ZodObject<{
@@ -1637,65 +2276,695 @@ declare const ManifestSchema: z.ZodObject<{
1637
2276
  name: z.ZodString;
1638
2277
  documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1639
2278
  }, z.core.$strip>>>;
2279
+ pieces: z.ZodOptional<z.ZodArray<z.ZodObject<{
2280
+ id: z.ZodString;
2281
+ name: z.ZodString;
2282
+ documentTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
2283
+ version: z.ZodOptional<z.ZodString>;
2284
+ description: z.ZodOptional<z.ZodString>;
2285
+ bundle: z.ZodOptional<z.ZodString>;
2286
+ descriptor: z.ZodOptional<z.ZodString>;
2287
+ }, z.core.$strip>>>;
2288
+ externalDependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1640
2289
  config: z.ZodOptional<z.ZodArray<z.ZodObject<{
1641
2290
  name: z.ZodString;
1642
2291
  type: z.ZodUnion<readonly [z.ZodLiteral<"var">, z.ZodLiteral<"secret">]>;
1643
2292
  description: z.ZodOptional<z.ZodString>;
1644
2293
  required: z.ZodOptional<z.ZodBoolean>;
1645
- default: z.ZodOptional<z.ZodBoolean>;
2294
+ default: z.ZodOptional<z.ZodString>;
1646
2295
  }, z.core.$strip>>>;
1647
- pwa: z.ZodOptional<z.ZodType<PHConnectPwa, unknown, z.core.$ZodTypeInternals<PHConnectPwa, unknown>>>;
2296
+ pwa: z.ZodOptional<z.ZodType<{
2297
+ globPatterns?: string[] | undefined;
2298
+ globIgnores?: string[] | undefined;
2299
+ maximumFileSizeToCacheInBytes?: number | undefined;
2300
+ runtimeCaching?: {
2301
+ urlPattern: string | {
2302
+ source: string;
2303
+ flags?: string | undefined;
2304
+ };
2305
+ handler: "CacheFirst" | "CacheOnly" | "NetworkFirst" | "NetworkOnly" | "StaleWhileRevalidate";
2306
+ method?: "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | undefined;
2307
+ options?: {
2308
+ cacheName?: string | undefined;
2309
+ networkTimeoutSeconds?: number | undefined;
2310
+ expiration?: {
2311
+ maxEntries?: number | undefined;
2312
+ maxAgeSeconds?: number | undefined;
2313
+ } | undefined;
2314
+ cacheableResponse?: {
2315
+ statuses?: number[] | undefined;
2316
+ headers?: Record<string, string> | undefined;
2317
+ } | undefined;
2318
+ } | undefined;
2319
+ }[] | undefined;
2320
+ navigateFallbackDenylist?: (string | {
2321
+ source: string;
2322
+ flags?: string | undefined;
2323
+ })[] | undefined;
2324
+ manifest?: {
2325
+ name?: string | undefined;
2326
+ short_name?: string | undefined;
2327
+ description?: string | undefined;
2328
+ theme_color?: string | undefined;
2329
+ background_color?: string | undefined;
2330
+ display?: "browser" | "fullscreen" | "minimal-ui" | "standalone" | undefined;
2331
+ start_url?: string | undefined;
2332
+ scope?: string | undefined;
2333
+ icons?: {
2334
+ src: string;
2335
+ sizes?: string | undefined;
2336
+ type?: string | undefined;
2337
+ purpose?: string | undefined;
2338
+ }[] | undefined;
2339
+ file_handlers?: {
2340
+ accept: Record<string, string[]>;
2341
+ icons?: {
2342
+ src: string;
2343
+ sizes?: string | undefined;
2344
+ type?: string | undefined;
2345
+ purpose?: string | undefined;
2346
+ }[] | undefined;
2347
+ launch_type?: "multiple-clients" | "single-client" | undefined;
2348
+ }[] | undefined;
2349
+ launch_handler?: {
2350
+ client_mode: "auto" | "focus-existing" | "navigate-existing" | "navigate-new";
2351
+ } | undefined;
2352
+ categories?: string[] | undefined;
2353
+ } | undefined;
2354
+ }, unknown, z.core.$ZodTypeInternals<{
2355
+ globPatterns?: string[] | undefined;
2356
+ globIgnores?: string[] | undefined;
2357
+ maximumFileSizeToCacheInBytes?: number | undefined;
2358
+ runtimeCaching?: {
2359
+ urlPattern: string | {
2360
+ source: string;
2361
+ flags?: string | undefined;
2362
+ };
2363
+ handler: "CacheFirst" | "CacheOnly" | "NetworkFirst" | "NetworkOnly" | "StaleWhileRevalidate";
2364
+ method?: "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | undefined;
2365
+ options?: {
2366
+ cacheName?: string | undefined;
2367
+ networkTimeoutSeconds?: number | undefined;
2368
+ expiration?: {
2369
+ maxEntries?: number | undefined;
2370
+ maxAgeSeconds?: number | undefined;
2371
+ } | undefined;
2372
+ cacheableResponse?: {
2373
+ statuses?: number[] | undefined;
2374
+ headers?: Record<string, string> | undefined;
2375
+ } | undefined;
2376
+ } | undefined;
2377
+ }[] | undefined;
2378
+ navigateFallbackDenylist?: (string | {
2379
+ source: string;
2380
+ flags?: string | undefined;
2381
+ })[] | undefined;
2382
+ manifest?: {
2383
+ name?: string | undefined;
2384
+ short_name?: string | undefined;
2385
+ description?: string | undefined;
2386
+ theme_color?: string | undefined;
2387
+ background_color?: string | undefined;
2388
+ display?: "browser" | "fullscreen" | "minimal-ui" | "standalone" | undefined;
2389
+ start_url?: string | undefined;
2390
+ scope?: string | undefined;
2391
+ icons?: {
2392
+ src: string;
2393
+ sizes?: string | undefined;
2394
+ type?: string | undefined;
2395
+ purpose?: string | undefined;
2396
+ }[] | undefined;
2397
+ file_handlers?: {
2398
+ accept: Record<string, string[]>;
2399
+ icons?: {
2400
+ src: string;
2401
+ sizes?: string | undefined;
2402
+ type?: string | undefined;
2403
+ purpose?: string | undefined;
2404
+ }[] | undefined;
2405
+ launch_type?: "multiple-clients" | "single-client" | undefined;
2406
+ }[] | undefined;
2407
+ launch_handler?: {
2408
+ client_mode: "auto" | "focus-existing" | "navigate-existing" | "navigate-new";
2409
+ } | undefined;
2410
+ categories?: string[] | undefined;
2411
+ } | undefined;
2412
+ }, unknown>>>;
2413
+ connectRoutes: z.ZodOptional<z.ZodBoolean>;
1648
2414
  }, z.core.$strip>;
1649
2415
  //#endregion
1650
- //#region document-model/upgrades.d.ts
1651
- /** Upgrade reducer transforms a document from one version to another */
1652
- type UpgradeReducer<TFrom extends PHBaseState, TTo extends PHBaseState> = (document: PHDocument<TFrom>, action: Action) => PHDocument<TTo>;
1653
- type ModelVersion = number;
1654
- /** Metadata about a version transition */
1655
- type UpgradeTransition = {
1656
- toVersion: ModelVersion;
1657
- upgradeReducer: UpgradeReducer<any, any>;
1658
- description?: string;
2416
+ //#region document-model/validation.d.ts
2417
+ /**
2418
+ * Reserved operation names from base reducer (core/actions.ts).
2419
+ * These names cannot be used for custom operations.
2420
+ */
2421
+ declare const RESERVED_OPERATION_NAMES: readonly ["UNDO", "REDO", "SET_NAME", "SET_PREFERRED_EDITOR", "NOOP", "PURGE_DOCUMENT"];
2422
+ type ReservedOperationName = (typeof RESERVED_OPERATION_NAMES)[number];
2423
+ /**
2424
+ * Operation names become the literal action `type` string at runtime and the
2425
+ * key for codegen's action union. They must be SCREAMING_SNAKE_CASE so the
2426
+ * generated TypeScript is valid.
2427
+ */
2428
+ declare const OPERATION_NAME_PATTERN: RegExp;
2429
+ declare function isValidOperationNameFormat(name: string): boolean;
2430
+ /**
2431
+ * Check if name conflicts with base reducer actions (case-insensitive).
2432
+ */
2433
+ declare function isReservedOperationName(name: string): boolean;
2434
+ /**
2435
+ * Get all operation names from all modules in the latest specification.
2436
+ * Returns names in uppercase for case-insensitive comparison.
2437
+ */
2438
+ declare function getAllOperationNames(state: DocumentModelGlobalState, excludeOperationId?: string): string[];
2439
+ /**
2440
+ * Validate operation name is not reserved or duplicate. Throws on failure.
2441
+ *
2442
+ * @param name - The operation name to validate
2443
+ * @param state - The document model global state
2444
+ * @param excludeOperationId - Optional operation ID to exclude (for rename validation)
2445
+ * @throws Error if the name is reserved or a duplicate
2446
+ */
2447
+ declare function validateOperationName(name: string, state: DocumentModelGlobalState, excludeOperationId?: string): void;
2448
+ declare function validateInitialState(initialState: string, allowEmptyState?: boolean): ValidationError[];
2449
+ declare function validateStateSchemaName(schema: string, documentName: string, scope?: string, allowEmptySchema?: boolean): ValidationError[];
2450
+ declare function validateModules(modules: ModuleSpecification[]): ValidationError[];
2451
+ declare function validateModule(mod: ModuleSpecification): ValidationError[];
2452
+ declare function validateModuleOperation(operation: OperationSpecification): ValidationError[];
2453
+ /**
2454
+ * Find a module in the latest specification by id, or throw. Reducers that
2455
+ * mutate-by-id should call this up front so an unknown id fails loudly
2456
+ * instead of silently no-opping.
2457
+ */
2458
+ declare function findModuleOrThrow(state: DocumentModelGlobalState, moduleId: string): ModuleSpecification;
2459
+ /**
2460
+ * Find an operation in the latest specification by id, or throw. Same
2461
+ * rationale as findModuleOrThrow — reducers that target an operation must
2462
+ * fail loudly when the operation doesn't exist.
2463
+ */
2464
+ declare function findOperationOrThrow(state: DocumentModelGlobalState, operationId: string): OperationSpecification;
2465
+ /**
2466
+ * Find an operation error by id across all operations in the latest
2467
+ * specification, or throw. Throws on a duplicate id too: setters act on a
2468
+ * single error, so an ambiguous id must fail loudly rather than mutate an
2469
+ * arbitrary match.
2470
+ */
2471
+ declare function findOperationErrorOrThrow(state: DocumentModelGlobalState, errorId: string): OperationErrorSpecification;
2472
+ /**
2473
+ * Find an operation example (code example) by id across all operations in the
2474
+ * latest specification, or throw. Throws on a duplicate id for the same reason
2475
+ * as findOperationErrorOrThrow.
2476
+ */
2477
+ declare function findOperationExampleOrThrow(state: DocumentModelGlobalState, exampleId: string): CodeExample;
2478
+ /**
2479
+ * Assert no module in the latest specification already uses `id`. Modules are
2480
+ * targeted by id by the setter/delete/reorder reducers, so a duplicate id makes
2481
+ * those operations ambiguous.
2482
+ */
2483
+ declare function assertModuleIdUnique(state: DocumentModelGlobalState, id: string): void;
2484
+ /**
2485
+ * Assert no operation in the latest specification already uses `id`. Operations
2486
+ * are targeted by id across all modules, so the id must be unique document-wide.
2487
+ */
2488
+ declare function assertOperationIdUnique(state: DocumentModelGlobalState, id: string): void;
2489
+ /**
2490
+ * Assert no operation error in the latest specification already uses `id`.
2491
+ * Error ids are targeted document-wide by the setter/delete reducers, so the id
2492
+ * must be unique to keep those operations unambiguous.
2493
+ */
2494
+ declare function assertOperationErrorIdUnique(state: DocumentModelGlobalState, id: string): void;
2495
+ /**
2496
+ * Assert no operation example in the latest specification already uses `id`.
2497
+ * Example ids are targeted document-wide by the update/delete reducers, so the
2498
+ * id must be unique to keep those operations unambiguous.
2499
+ */
2500
+ declare function assertOperationExampleIdUnique(state: DocumentModelGlobalState, id: string): void;
2501
+ declare function validateOperations(operations: DocumentOperations): ValidationError[];
2502
+ //#endregion
2503
+ //#region processors/deletion.d.ts
2504
+ /** The id a DELETE_DOCUMENT or PURGE_DOCUMENT removes; undefined otherwise. */
2505
+ declare function deletedDocumentId(op: OperationWithContext$1): string | undefined;
2506
+ //#endregion
2507
+ //#region processors/http.d.ts
2508
+ /** Methods a package route may bind. OPTIONS belongs to the CORS layer. */
2509
+ type RouteMethod = "DELETE" | "GET" | "HEAD" | "PATCH" | "POST" | "PUT";
2510
+ interface RouteUser {
2511
+ address: string;
2512
+ chainId: number;
2513
+ networkId: string;
2514
+ appKey: string;
2515
+ }
2516
+ type RouteActor = {
2517
+ user: RouteUser | undefined;
2518
+ authEnabled: boolean;
2519
+ };
2520
+ type AuthorizerResult = {
2521
+ authorized: true;
2522
+ } |
2523
+ /** Refused; the scope answers with its own JSON error envelope. */
2524
+ {
2525
+ authorized: false;
2526
+ status: number;
2527
+ message: string;
2528
+ } | {
2529
+ authorized: false;
2530
+ response: Response;
2531
+ };
2532
+ /** A route-specific gate, for policies the standard modes cannot express. */
2533
+ type RouteAuthorizer = (req: IncomingMessage) => Promise<AuthorizerResult> | AuthorizerResult;
2534
+ /** How a route authenticates. */
2535
+ type RouteAuth =
2536
+ /** Default. A verifiable bearer is required; a caller without one gets 401. */
2537
+ "renown" | "renown-optional" | "public" | RouteAuthorizer;
2538
+ /** How the request body reaches the handler. */
2539
+ type RouteBody =
2540
+ /** Default. Buffered, and readable through the Fetch Request. */
2541
+ "parsed" |
2542
+ /** Buffered and also handed over as `ctx.rawBody`, byte for byte. */
2543
+ "raw" |
2544
+ /** Not buffered; the Fetch Request body is the live request stream. */
2545
+ "stream" |
2546
+ /** The body is not read at all. */
2547
+ "none";
2548
+ interface RouteOptions {
2549
+ auth?: RouteAuth;
2550
+ body?: RouteBody;
2551
+ /** Refuse a body larger than this with 413. Ignored when body is `stream`. */
2552
+ maxBodyBytes?: number;
2553
+ /** Serve sub-paths too, not just an exact match. */
2554
+ prefix?: boolean;
2555
+ }
2556
+ /** Where the request reached the host, resolved through any reverse proxy. */
2557
+ interface RouteTransport {
2558
+ proto: string;
2559
+ host: string;
2560
+ prefix: string;
2561
+ baseUrl: string;
2562
+ }
2563
+ interface RouteContext {
2564
+ /** Decoded path params. */
2565
+ params: Record<string, string>;
2566
+ user: RouteUser | undefined;
2567
+ authEnabled: boolean;
2568
+ /** The exact octets received. Present only when body is `raw`. */
2569
+ rawBody: Buffer | undefined;
2570
+ /** Aborts when the client disconnects. */
2571
+ signal: AbortSignal;
2572
+ transport: RouteTransport;
2573
+ }
2574
+ type RouteHandler = (request: Request, ctx: RouteContext) => Response | Promise<Response>;
2575
+ interface RouteSpec extends RouteOptions {
2576
+ method: RouteMethod | RouteMethod[];
2577
+ /** Relative to the scope: "runs/:id", never "/api/@scope/pkg/runs/:id". */
2578
+ path: string;
2579
+ handler: RouteHandler;
2580
+ }
2581
+ interface NodeRouteSpec extends Omit<RouteOptions, "body" | "maxBodyBytes"> {
2582
+ method: RouteMethod | RouteMethod[];
2583
+ path: string;
2584
+ handler: (req: IncomingMessage, res: ServerResponse, ctx: Omit<RouteContext, "rawBody" | "signal">) => void | Promise<void>;
2585
+ }
2586
+ interface ScopedRouteHandle {
2587
+ /** The absolute public URL this route answers on. */
2588
+ readonly url: string;
2589
+ dispose(): void;
2590
+ }
2591
+ type WebhookScheme = "none" |
2592
+ /** A shared secret presented verbatim. No digest, so no digest options. */
2593
+ "token" |
2594
+ /** The digest of the body, alone. */
2595
+ "hmac" |
2596
+ /** That digest behind a label, `sha256=<digest>`. */
2597
+ "hmac-prefixed" | "hmac-timestamped";
2598
+ /** Hashes a sender may compute the digest with. */
2599
+ type WebhookHashAlgorithm = "sha1" | "sha256" | "sha512";
2600
+ /** How the digest is written into the header. */
2601
+ type WebhookSignatureEncoding = "hex" | "base64";
2602
+ interface WebhookVerification {
2603
+ scheme: WebhookScheme;
2604
+ /** Resolved value, never a reference — the caller resolves refs. */
2605
+ secret?: string;
2606
+ /** Overrides the scheme's conventional header. */
2607
+ header?: string;
2608
+ /** Replay window for timestamped schemes. */
2609
+ toleranceSeconds?: number;
2610
+ algorithm?: WebhookHashAlgorithm;
2611
+ /** Defaults to `hex`. Base64 comparison is case-sensitive; hex is not. */
2612
+ encoding?: WebhookSignatureEncoding;
2613
+ prefix?: string;
2614
+ }
2615
+ type WebhookField = string | {
2616
+ header: string;
2617
+ } |
2618
+ /** Dot-separated path into the parsed body, e.g. `data.object.id`. */
2619
+ {
2620
+ body: string;
2621
+ };
2622
+ interface WebhookRequest {
2623
+ /** The caller's own key for this endpoint, e.g. a document id. */
2624
+ key: string;
2625
+ method: string;
2626
+ path: string;
2627
+ queryParams: Record<string, string>;
2628
+ /** Lowercased, with credentials redacted. */
2629
+ headers: Record<string, string>;
2630
+ /** The exact bytes received. */
2631
+ raw: Buffer;
2632
+ /** JSON and form bodies decoded; anything else as text. */
2633
+ body: unknown;
2634
+ }
2635
+ interface WebhookReply {
2636
+ status: number;
2637
+ body?: string;
2638
+ contentType?: string;
2639
+ /** The handler did not process this delivery (its owner is shutting down),
2640
+ * so its dedupe key is dropped and the sender's retry is delivered again.
2641
+ * Unset, a delivery counts as seen whatever the status. */
2642
+ unprocessed?: boolean;
2643
+ }
2644
+ interface WebhookPolicy {
2645
+ verify?: WebhookVerification;
2646
+ /** Uppercase. Undefined accepts every method. */
2647
+ methods?: string[];
2648
+ dedupe?: {
2649
+ field: WebhookField;
2650
+ ttlSeconds?: number;
2651
+ };
2652
+ challengeField?: WebhookField;
2653
+ maxBodyBytes?: number;
2654
+ }
2655
+ interface WebhookSpec {
2656
+ /** Distinguishes several endpoint families within one package. */
2657
+ name: string;
2658
+ defaults?: WebhookPolicy;
2659
+ onRequest: (request: WebhookRequest) => Promise<WebhookReply> | WebhookReply;
2660
+ policyFor?: (key: string) => Promise<WebhookPolicy | undefined> | WebhookPolicy | undefined;
2661
+ }
2662
+ interface WebhookEndpointInfo {
2663
+ key: string;
2664
+ token: string;
2665
+ url: string;
2666
+ createdAt: string;
2667
+ }
2668
+ interface IWebhookEndpoints {
2669
+ endpointFor(key: string): Promise<Omit<WebhookEndpointInfo, "key">>;
2670
+ revoke(key: string): Promise<void>;
2671
+ list(): Promise<WebhookEndpointInfo[]>;
2672
+ }
2673
+ interface IWebhookScope {
2674
+ register(spec: WebhookSpec): Promise<IWebhookEndpoints>;
2675
+ readonly hasPublicOrigin: boolean;
2676
+ }
2677
+ interface IHttpScope {
2678
+ readonly owner: string;
2679
+ readonly baseUrl: string;
2680
+ get(path: string, handler: RouteHandler): ScopedRouteHandle;
2681
+ get(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2682
+ post(path: string, handler: RouteHandler): ScopedRouteHandle;
2683
+ post(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2684
+ put(path: string, handler: RouteHandler): ScopedRouteHandle;
2685
+ put(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2686
+ patch(path: string, handler: RouteHandler): ScopedRouteHandle;
2687
+ patch(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2688
+ delete(path: string, handler: RouteHandler): ScopedRouteHandle;
2689
+ delete(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2690
+ /** Registered independently of GET: a HEAD response is not a bodyless GET. */
2691
+ head(path: string, handler: RouteHandler): ScopedRouteHandle;
2692
+ head(path: string, options: RouteOptions, handler: RouteHandler): ScopedRouteHandle;
2693
+ route(spec: RouteSpec): ScopedRouteHandle;
2694
+ nodeRoute(spec: NodeRouteSpec): ScopedRouteHandle;
2695
+ readonly webhooks: IWebhookScope;
2696
+ /** Release every route this scope registered. Called on package teardown. */
2697
+ dispose(): void;
2698
+ }
2699
+ //#endregion
2700
+ //#region processors/types.d.ts
2701
+ type ProcessorDispatchResult = {
2702
+ id: string;
2703
+ status: string;
2704
+ };
2705
+ interface IProcessorDispatch {
2706
+ execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<ProcessorDispatchResult>;
2707
+ }
2708
+ interface IProcessorHostModuleBase {
2709
+ analyticsStore: IAnalyticsStore;
2710
+ relationalDb: IRelationalDb;
2711
+ processorApp: ProcessorApp;
2712
+ dispatch: IProcessorDispatch;
2713
+ getReadModel<T>(name: string): T;
2714
+ config?: Map<string, unknown>;
2715
+ /**
2716
+ * The package's slice of the HTTP surface, bound to its own namespace.
2717
+ *
2718
+ * Declared on the host-agnostic base rather than on each host's module so
2719
+ * the two cannot drift: codegen types generated processors against
2720
+ * reactor-browser's `IProcessorHostModule`, and the same source has to
2721
+ * compile against reactor-api's.
2722
+ *
2723
+ * Absent whenever the host has no HTTP server — processors also run in the
2724
+ * browser — and on the reactor when the package's name cannot be resolved to
2725
+ * a routable namespace, so a caller must always check before using it.
2726
+ */
2727
+ http?: IHttpScope;
2728
+ }
2729
+ /**
2730
+ * Filter for matching operations to processors.
2731
+ * All fields are optional arrays - when provided, operations must match at least one value in each specified field.
2732
+ * When a field is undefined or empty, it matches all values for that field.
2733
+ */
2734
+ type ProcessorFilter = {
2735
+ documentType?: string[];
2736
+ scope?: string[];
2737
+ branch?: string[];
2738
+ documentId?: string[];
2739
+ };
2740
+ /**
2741
+ * Describes an object that can process operations.
2742
+ */
2743
+ interface IProcessor {
2744
+ /**
2745
+ * Processes a list of operations with context.
2746
+ * Called when operations match this processor's filter.
2747
+ *
2748
+ * Delivery is at-least-once. Within a document's scope and branch, each
2749
+ * call is in ordinal order, and an operation delivered late comes with
2750
+ * every later operation of its stream this processor was already given.
2751
+ * Across documents there is no ordering guarantee. A processor receives one
2752
+ * `onOperations` call at a time; the next call begins after the previous
2753
+ * resolves.
2754
+ *
2755
+ * A drive's processors also receive the drive's own DELETE_DOCUMENT or
2756
+ * PURGE_DOCUMENT, whatever the filter, as the last delivery before
2757
+ * `onDisconnect`. A purged document's operations other than its marker are
2758
+ * not delivered. Erase a document's data on either deletion action.
2759
+ */
2760
+ onOperations(operations: OperationWithContext[]): Promise<void>;
2761
+ /**
2762
+ * Called when the processor is disconnected.
2763
+ * Used to clean up any resources allocated during processor creation.
2764
+ * Also runs when the factory is unregistered, so it is not a deletion signal.
2765
+ */
2766
+ onDisconnect(): Promise<void>;
2767
+ }
2768
+ /**
2769
+ * Relates a processor to its filter configuration.
2770
+ */
2771
+ type ProcessorRecord = {
2772
+ processor: IProcessor;
2773
+ filter: ProcessorFilter;
2774
+ startFrom?: "beginning" | "current";
2775
+ id?: string;
2776
+ };
2777
+ /**
2778
+ * A factory function that creates processor records for a given drive.
2779
+ * Called once per drive when the drive is first detected or when the factory is registered.
2780
+ * The header is the drive's header at creation. For a purged drive it is
2781
+ * minimal: only `id` and `documentType` are set, and `slug` and `name` are
2782
+ * empty, so a factory that selects drives by slug or name makes no processor
2783
+ * for it and the deletion stays owed.
2784
+ */
2785
+ type ProcessorFactory = (driveHeader: PHDocumentHeader, processorApp?: ProcessorApp) => Promise<ProcessorRecord[]> | ProcessorRecord[];
2786
+ /** Takes a processor host module and builds processor factories using its context. */
2787
+ type ProcessorFactoryBuilder<TModule extends IProcessorHostModuleBase = IProcessorHostModuleBase> = {
2788
+ bivarianceHack(module: TModule): Promise<ProcessorFactory> | ProcessorFactory;
2789
+ }["bivarianceHack"];
2790
+ type ProcessorStatus = "active" | "errored";
2791
+ type TrackedProcessor = {
2792
+ processorId: string;
2793
+ factoryId: string;
2794
+ driveId: string;
2795
+ processorIndex: number;
2796
+ record: ProcessorRecord;
2797
+ lastOrdinal: number;
2798
+ status: ProcessorStatus;
2799
+ lastError: string | undefined;
2800
+ lastErrorTimestamp: Date | undefined;
2801
+ /**
2802
+ * Clears the error and resolves once the replay from the cursor completes.
2803
+ * Safe from anywhere, but awaiting it from this processor's own
2804
+ * `onOperations` waits on itself: the replay runs after that call returns.
2805
+ * A no-op once the processor has been removed.
2806
+ */
2807
+ retry: () => Promise<void>;
2808
+ };
2809
+ /**
2810
+ * Manages processor creation and destruction based on drive operations.
2811
+ */
2812
+ interface IProcessorManager {
2813
+ /**
2814
+ * Registers a processor factory.
2815
+ * Immediately creates processors for all existing drives and resolves once
2816
+ * every factory run has completed and its processors are bound. Their
2817
+ * backfills run afterwards, on each processor's own queue. A deleted drive
2818
+ * whose deletion one of the factory's processors never received (it was not
2819
+ * running, or its delivery threw) gets a processor too: it receives only the
2820
+ * drive's `DELETE_DOCUMENT`, or its `PURGE_DOCUMENT` once purged, and is
2821
+ * disconnected. That delivery is not awaited: it runs after this resolves,
2822
+ * so a processor that hangs on it does not hold the registration, nor a
2823
+ * later one: a drive whose deletion is still being delivered gets it from
2824
+ * the new registration only if that delivery leaves it owed. If processors
2825
+ * from an earlier registration under the same identifier are still
2826
+ * draining, or a call of the previous factory is still in flight, the
2827
+ * factory runs after they have settled, so awaiting a re-registration of
2828
+ * a factory from inside that factory or one of its processors'
2829
+ * `onOperations` waits on itself.
2830
+ */
2831
+ registerFactory(identifier: string, factory: ProcessorFactory): Promise<void>;
2832
+ /**
2833
+ * Unregisters a processor factory. Resolves once its processors receive no
2834
+ * new deliveries and their cursors are released; each one's in-flight
2835
+ * delivery finishes first, then `onDisconnect` runs. A released cursor no
2836
+ * longer positions a processor: a re-registration starts each one afresh,
2837
+ * per `startFrom`. It only records that the factory held a drive's data, so
2838
+ * that a drive deleted before the factory registers again still gets its
2839
+ * deletion delivered then. Safe to call from
2840
+ * inside a processor's own `onOperations`.
2841
+ */
2842
+ unregisterFactory(identifier: string): Promise<void>;
2843
+ /**
2844
+ * Gets a tracked processor by its ID.
2845
+ */
2846
+ get(processorId: string): TrackedProcessor | undefined;
2847
+ /**
2848
+ * Gets all tracked processors, including an errored entry for each
2849
+ * processor whose drive's deletion threw; its `retry()` delivers the
2850
+ * deletion again.
2851
+ */
2852
+ getAll(): TrackedProcessor[];
2853
+ }
2854
+ type ProcessorApp = (typeof PROCESSOR_APPS)[number];
2855
+ type ProcessorApps = readonly ProcessorApp[];
2856
+ //#endregion
2857
+ //#region processors/relational/types.d.ts
2858
+ /** Columns {@link RelationalDbProcessor.deleteDocumentRows} matches. */
2859
+ declare const DOCUMENT_ID_COLUMNS: readonly ["document_id", "documentId"];
2860
+ type IRelationalQueryMethods = "selectFrom" | "selectNoFrom" | "with" | "withRecursive";
2861
+ type IRelationalQueryBuilder<Schema = unknown> = Pick<QueryCreator<Schema>, IRelationalQueryMethods> & {
2862
+ withSchema: (schema: string) => IRelationalQueryBuilder<Schema>;
1659
2863
  };
1660
- type TupleMember<T extends readonly unknown[]> = T[number];
1661
- /** Manifest declaring all supported versions and upgrade paths */
1662
- type UpgradeManifest<TVersions extends readonly number[]> = {
1663
- documentType: string;
1664
- latestVersion: TupleMember<TVersions>;
1665
- supportedVersions: TVersions;
1666
- upgrades: { [V in Exclude<TupleMember<TVersions>, 1> as `v${V}`]: UpgradeTransition };
2864
+ type HashAlgorithms = "fnv1a";
2865
+ type IBaseRelationalDb<Schema = unknown> = Kysely<Schema>;
2866
+ /**
2867
+ * The standardized relational database interface for relational db processors.
2868
+ * This abstraction provides type-safe database operations while hiding the underlying
2869
+ * database framework implementation details.
2870
+ **/
2871
+ type IRelationalDb<Schema = unknown> = IBaseRelationalDb<Schema> & {
2872
+ createNamespace<NamespaceSchema>(namespace: string): Promise<IRelationalDb<ExtractProcessorSchemaOrSelf<NamespaceSchema>>>;
2873
+ queryNamespace<NamespaceSchema>(namespace: string): IRelationalQueryBuilder<NamespaceSchema>;
1667
2874
  };
2875
+ type ExtractProcessorSchemaOrSelf<TProcessor> = TProcessor extends RelationalDbProcessor<infer TSchema> ? TSchema : TProcessor;
2876
+ type RelationalDbProcessorClass<TSchema> = typeof RelationalDbProcessor<TSchema>;
2877
+ interface IRelationalDbProcessor<TDatabaseSchema = unknown> extends IProcessor {
2878
+ namespace: string;
2879
+ query: IRelationalQueryBuilder<TDatabaseSchema>;
2880
+ filter: ProcessorFilter;
2881
+ initAndUpgrade(): Promise<void>;
2882
+ }
2883
+ declare const IS_RELATIONAL_DB_PROCESSOR: unique symbol;
1668
2884
  /**
1669
- * Canonical document-model version normalization: documents stamped with 0
1670
- * or nothing at all predate versioning and are treated as version 1, the
1671
- * same version the registry assigns unversioned modules. Every consumer
1672
- * that resolves a module or compares versions must use this rule; resolving
1673
- * 0 to "latest" instead re-pins a legacy document's history to whichever
1674
- * module happens to be newest.
2885
+ * Base class for relational db processors that require a relational database storage.
2886
+ * This class abstracts database initialization, migration management, and resource cleanup,
2887
+ * allowing derived classes to focus on business logic.
1675
2888
  */
1676
- declare function normalizeDocumentModelVersion(version: number | undefined | null): number;
2889
+ declare abstract class RelationalDbProcessor<TDatabaseSchema = unknown> implements IRelationalDbProcessor<TDatabaseSchema> {
2890
+ protected _namespace: string;
2891
+ protected _filter: ProcessorFilter;
2892
+ protected relationalDb: IRelationalDb<TDatabaseSchema>;
2893
+ /** The drive the factory created this processor for. */
2894
+ protected _driveId?: string | undefined;
2895
+ constructor(_namespace: string, _filter: ProcessorFilter, relationalDb: IRelationalDb<TDatabaseSchema>,
2896
+ /** The drive the factory created this processor for. */
2897
+ _driveId?: string | undefined);
2898
+ static [IS_RELATIONAL_DB_PROCESSOR]: boolean;
2899
+ /**
2900
+ * Returns the namespace for a given drive id.
2901
+ * This method can be overridden by derived classes to provide a custom namespace.
2902
+ */
2903
+ static getNamespace(driveId: string): string;
2904
+ static query<Schema>(this: RelationalDbProcessorClass<Schema>, driveId: string, db: IRelationalDb<any>): IRelationalQueryBuilder<Schema>;
2905
+ /**
2906
+ * Processes a list of operations with context.
2907
+ * Called when operations match this processor's filter.
2908
+ */
2909
+ abstract onOperations(operations: OperationWithContext[]): Promise<void>;
2910
+ /**
2911
+ * Returns the filter for the processor.
2912
+ * This method can be overridden by derived classes to provide a custom filter.
2913
+ */
2914
+ get filter(): ProcessorFilter;
2915
+ /**
2916
+ * Returns the namespace used by the processor.
2917
+ */
2918
+ get namespace(): string;
2919
+ get query(): IRelationalQueryBuilder<TDatabaseSchema>;
2920
+ /** True for this processor's drive when its namespace is that drive's alone. */
2921
+ protected isNamespaceDrive(documentId: string): boolean;
2922
+ /** Deletes a document's rows from every table with a document-id column. */
2923
+ protected deleteDocumentRows(documentId: string): Promise<void>;
2924
+ /** Drops this processor's namespace and every table in it. */
2925
+ protected dropNamespace(): Promise<void>;
2926
+ private namespaceSchema;
2927
+ /**
2928
+ * Abstract method that derived classes must implement.
2929
+ * This method is meant to be called on subclasses to initialize and upgrade the database.
2930
+ */
2931
+ abstract initAndUpgrade(): Promise<void>;
2932
+ /**
2933
+ * Called when the processor is disconnected.
2934
+ * This method is meant to be overridden by subclasses to clean up resources.
2935
+ */
2936
+ abstract onDisconnect(): Promise<void>;
2937
+ }
2938
+ //#endregion
2939
+ //#region processors/relational/utils.d.ts
1677
2940
  /**
1678
- * Applies an UPGRADE_DOCUMENT action to a document.
1679
- * Handles all upgrade scenarios including initial upgrades, no-ops, and multi-step upgrades.
1680
- *
1681
- * Behavior based on fromVersion/toVersion:
1682
- * - fromVersion === toVersion (and fromVersion > 0): No-op - return unchanged document
1683
- * - fromVersion > toVersion: Throw DowngradeNotSupportedError
1684
- * - All other cases: Apply upgradePath transitions (if provided), then apply initialState, set version
2941
+ * Hashes a string to a lowercase base-26 string.
2942
+ * @param str The string to hash.
2943
+ * @param length The length of the hash. Defaults to 10.
2944
+ * @param algorithm The hashing algorithm to use. Defaults to "fnv1a".
2945
+ * @returns The hashed string.
1685
2946
  */
1686
- declare function applyUpgradeDocumentAction(document: PHDocument, action: UpgradeDocumentAction, upgradePath?: UpgradeTransition[]): PHDocument;
2947
+ declare function hashNamespace(str: string, length?: number): string;
1687
2948
  /**
1688
- * Applies a DELETE_DOCUMENT action to a document.
1689
- * Marks the document as deleted in the document scope state.
2949
+ * Creates a RelationalDb instance with namespace support.
2950
+ * @param baseDb The base RelationalDb instance to enhance.
2951
+ * @param baseOptions The default options for namespace creation. Hashes namespace by default.
2952
+ * @returns The enhanced RelationalDb instance.
1690
2953
  */
1691
- declare function applyDeleteDocumentAction(document: PHDocument, action: DeleteDocumentAction): PHDocument;
2954
+ declare function createRelationalDb<Schema>(baseDb: IBaseRelationalDb<Schema>, baseOptions?: NamespaceOptions): IRelationalDb<Schema>;
2955
+ type NamespaceOptions = {
2956
+ hashNamespace?: boolean;
2957
+ };
2958
+ declare function createNamespacedDb<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): Promise<IRelationalDb<Schema>>;
2959
+ /** The schema behind a handle from `createNamespace`; undefined otherwise. */
2960
+ declare function namespaceSchemaOf(db: object): string | undefined;
2961
+ declare function createNamespacedQueryBuilder<Schema>(db: IBaseRelationalDb<any>, namespace: string, options?: NamespaceOptions): IRelationalQueryBuilder<Schema>;
1692
2962
  /**
1693
- * Computes the ordered list of upgrade transitions needed to move from
1694
- * fromVersion to toVersion using the provided manifest.
1695
- * Walks keys v(fromVersion+1)..v(toVersion) and throws a descriptive Error
1696
- * if the manifest is absent or any step is missing.
2963
+ * Returns a query builder for a RelationalDb instance.
2964
+ * @param query The RelationalDb instance to convert.
2965
+ * @returns The IRelationalQueryBuilder instance.
1697
2966
  */
1698
- declare function computeUpgradeTransitions(manifest: UpgradeManifest<readonly number[]> | undefined, fromVersion: number, toVersion: number): UpgradeTransition[];
2967
+ declare function relationalDbToQueryBuilder<TSchema>(query: IBaseRelationalDb<TSchema>): IRelationalQueryBuilder<TSchema>;
1699
2968
  //#endregion
1700
2969
  //#region document-model/types.d.ts
1701
2970
  type State = {
@@ -2342,11 +3611,11 @@ interface DocumentModelVersioningOperations {
2342
3611
  }
2343
3612
  type Maybe<T> = T | null;
2344
3613
  type InputMaybe<T> = T | null | undefined;
2345
- type Exact<T extends Record<string, unknown>> = { [K in keyof T]: T[K] };
2346
- type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
2347
- type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
2348
- type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = { [_ in K]?: never };
2349
- type Incremental<T> = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never };
3614
+ type Exact<T extends Record<string, unknown>> = { [K in keyof T]: T[K]; };
3615
+ type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]>; };
3616
+ type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]>; };
3617
+ type MakeEmpty<T extends Record<string, unknown>, K extends keyof T> = { [_ in K]?: never; };
3618
+ type Incremental<T> = T | { [P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never; };
2350
3619
  /** All built-in and custom scalars, mapped to their actual values */
2351
3620
  type Scalars = {
2352
3621
  ID: {
@@ -2407,28 +3676,6 @@ type IOperation = {
2407
3676
  timestampUtcMs: Scalars["DateTime"]["output"];
2408
3677
  type: Scalars["String"]["output"];
2409
3678
  };
2410
- type Load_State = "LOAD_STATE";
2411
- type SchemaLoadStateAction = {
2412
- id: Scalars["String"]["output"];
2413
- timestampUtcMs: Scalars["DateTime"]["output"];
2414
- input: LoadStateActionInput;
2415
- type: Load_State;
2416
- scope: string;
2417
- };
2418
- type LoadStateActionInput = {
2419
- operations: Scalars["Int"]["input"];
2420
- state: LoadStateActionStateInput;
2421
- };
2422
- type LoadStateActionStateInput = {
2423
- data?: InputMaybe<Scalars["Unknown"]["input"]>;
2424
- name: Scalars["String"]["input"];
2425
- };
2426
- type MutationLoadStateArgs = {
2427
- input: SchemaLoadStateAction;
2428
- };
2429
- type MutationPruneArgs = {
2430
- input: SchemaPruneAction;
2431
- };
2432
3679
  type MutationRedoArgs = {
2433
3680
  input: SchemaRedoAction;
2434
3681
  };
@@ -2438,18 +3685,6 @@ type MutationSetNameArgs = {
2438
3685
  type MutationUndoArgs = {
2439
3686
  input: SchemaUndoAction;
2440
3687
  };
2441
- type Prune = "PRUNE";
2442
- type SchemaPruneAction = {
2443
- id: Scalars["String"]["output"];
2444
- timestampUtcMs: Scalars["DateTime"]["output"];
2445
- input: PruneActionInput;
2446
- type: Prune;
2447
- scope: string;
2448
- };
2449
- type PruneActionInput = {
2450
- end?: InputMaybe<Scalars["Int"]["input"]>;
2451
- start?: InputMaybe<Scalars["Int"]["input"]>;
2452
- };
2453
3688
  type Query = {
2454
3689
  __typename?: "Query";
2455
3690
  document: Maybe<IDocument>;
@@ -2521,14 +3756,6 @@ type SchemaNOOPAction = {
2521
3756
  timestampUtcMs: Scalars["DateTime"]["output"];
2522
3757
  type: "NOOP";
2523
3758
  };
2524
- type LoadStateAction = Action & {
2525
- type: "LOAD_STATE";
2526
- input: LoadStateActionInput;
2527
- };
2528
- type PruneAction = Action & {
2529
- type: "PRUNE";
2530
- input: PruneActionInput;
2531
- };
2532
3759
  type RedoAction = Action & {
2533
3760
  type: "REDO";
2534
3761
  input: SchemaRedoAction["input"];
@@ -2585,6 +3812,13 @@ type DeleteDocumentActionInput = {
2585
3812
  documentId: string;
2586
3813
  propagate?: "none" | "cascade";
2587
3814
  };
3815
+ type PurgeDocumentActionInput = {
3816
+ documentId: string;
3817
+ documentType: string;
3818
+ /** The same instant as the action's timestampUtcMs. */
3819
+ purgedAtUtcIso: string;
3820
+ requestId: string;
3821
+ };
2588
3822
  type AddRelationshipActionInput = {
2589
3823
  sourceId: string;
2590
3824
  targetId: string;
@@ -2614,6 +3848,12 @@ type DeleteDocumentAction = Action & {
2614
3848
  type: "DELETE_DOCUMENT";
2615
3849
  input: DeleteDocumentActionInput;
2616
3850
  };
3851
+ /** Reserved document-scope marker; a purged document's only operation. */
3852
+ type PurgeDocumentAction = Action & {
3853
+ type: "PURGE_DOCUMENT";
3854
+ scope: "document";
3855
+ input: PurgeDocumentActionInput;
3856
+ };
2617
3857
  type AddRelationshipAction = Action & {
2618
3858
  type: "ADD_RELATIONSHIP";
2619
3859
  input: AddRelationshipActionInput;
@@ -2626,7 +3866,7 @@ type UpdateRelationshipAction = Action & {
2626
3866
  type: "UPDATE_RELATIONSHIP";
2627
3867
  input: UpdateRelationshipActionInput;
2628
3868
  };
2629
- type DocumentAction = LoadStateAction | PruneAction | RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
3869
+ type DocumentAction = RedoAction | SetNameAction | SetPreferredEditorAction | UndoAction | NOOPAction;
2630
3870
  interface ISignal<TType extends string, TInput> {
2631
3871
  type: TType;
2632
3872
  input: TInput;
@@ -2663,19 +3903,27 @@ type SignalResults = {
2663
3903
  type SignalType<T extends Signal> = T["type"];
2664
3904
  type FileInput = string | number[] | Uint8Array | ArrayBuffer | Blob;
2665
3905
  type ReducerOptions = {
2666
- /** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */skip?: number; /** When true the skip count is ignored and the action is applied regardless of the skip count */
2667
- ignoreSkipOperations?: boolean; /** if true reuses the provided action resulting state instead of replaying it */
2668
- reuseOperationResultingState?: boolean; /** if true checks the hashes of the operations */
2669
- checkHashes?: boolean; /** Options for performing a replay. */
3906
+ /** The number of operations to skip before this new action is applied. This overrides the skip count in the operation. */
3907
+ skip?: number;
3908
+ /** When true the skip count is ignored and the action is applied regardless of the skip count */
3909
+ ignoreSkipOperations?: boolean;
3910
+ /** if true reuses the provided action resulting state instead of replaying it */
3911
+ reuseOperationResultingState?: boolean;
3912
+ /** if true checks the hashes of the operations */
3913
+ checkHashes?: boolean;
3914
+ /** Options for performing a replay. */
2670
3915
  replayOptions?: {
2671
- /** The previously created operation to verify against. */operation: Operation;
2672
- }; /** Optional parser for the operation resulting state, uses JSON.parse by default */
3916
+ /** The previously created operation to verify against. */
3917
+ operation: Operation;
3918
+ };
3919
+ /** Optional parser for the operation resulting state, uses JSON.parse by default */
2673
3920
  operationResultingStateParser?: <TState>(state: string | null | undefined) => TState;
2674
3921
  /**
2675
3922
  * When true (default), the reducer will prune operations (garbage collect) when processing a skip.
2676
3923
  * When false, it will recompute state for the skip but preserve the existing operations history.
2677
3924
  */
2678
- pruneOnSkip?: boolean; /** The branch being operated on. Defaults to "main". */
3925
+ pruneOnSkip?: boolean;
3926
+ /** The branch being operated on. Defaults to "main". */
2679
3927
  branch?: string;
2680
3928
  /**
2681
3929
  * Protocol version controlling undo/redo behavior.
@@ -2726,7 +3974,7 @@ type User = {
2726
3974
  chainId: number;
2727
3975
  ens?: ENSInfo;
2728
3976
  };
2729
- type PartialRecord<K extends keyof any, T> = { [P in K]?: T };
3977
+ type PartialRecord<K extends keyof any, T> = { [P in K]?: T; };
2730
3978
  type RevisionsFilter = PartialRecord<string, number>;
2731
3979
  type GetDocumentOptions = ReducerOptions & {
2732
3980
  revisions?: RevisionsFilter;
@@ -2734,10 +3982,20 @@ type GetDocumentOptions = ReducerOptions & {
2734
3982
  };
2735
3983
  type ActionErrorCallback = (error: unknown) => void;
2736
3984
  type EditorDispatch = (action: Action, onErrorCallback?: ActionErrorCallback) => void;
2737
- type EditorProps = {
3985
+ /** Dispatches actions to a document; `onErrors`/`onSuccess` report the outcome. */
3986
+ type DocumentDispatch<TAction extends Action = Action> = (actionOrActions: TAction | TAction[] | DocumentAction | DocumentAction[] | undefined, onErrors?: (errors: Error[]) => void, onSuccess?: (result: PHDocument) => void) => void;
3987
+ type EditorBaseProps = {
2738
3988
  children?: ReactNode;
2739
3989
  className?: string;
3990
+ };
3991
+ /** `EditorProps<MyDocument, MyAction>`: the document and dispatch a host passes
3992
+ * an editor. Bare `EditorProps` leaves them optional, as before. */
3993
+ type EditorProps<TDocument extends PHDocument = never, TAction extends Action = Action> = [TDocument] extends [never] ? EditorBaseProps & {
2740
3994
  document?: PHDocument;
3995
+ dispatch?: DocumentDispatch;
3996
+ } : EditorBaseProps & {
3997
+ document: TDocument;
3998
+ dispatch: DocumentDispatch<TAction>;
2741
3999
  };
2742
4000
  type SubgraphModule = {
2743
4001
  id: string;
@@ -2745,8 +4003,18 @@ type SubgraphModule = {
2745
4003
  gql: string;
2746
4004
  endpoint: string;
2747
4005
  };
2748
- type EditorModule<TProps = any> = {
2749
- Component: FC<EditorProps & TProps>;
4006
+ /** What hosts pass an editor besides `document` and `dispatch`. */
4007
+ type HostedEditorProps = {
4008
+ documentId?: string;
4009
+ context?: {
4010
+ readMode?: boolean;
4011
+ selectedTimelineRevision?: number;
4012
+ };
4013
+ displayToolbar?: boolean;
4014
+ };
4015
+ /** Hosts render `Component` with `document` and `dispatch`. */
4016
+ type EditorModule<TDocument extends PHDocument = any, TAction extends Action = any, TProps = HostedEditorProps> = {
4017
+ Component: FC<EditorProps<TDocument, TAction> & TProps>;
2750
4018
  documentTypes: string[];
2751
4019
  config: {
2752
4020
  id: string;
@@ -2806,13 +4074,14 @@ interface ISigner {
2806
4074
  */
2807
4075
  verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
2808
4076
  /**
2809
- * Signs an action (used for operation signing).
4077
+ * Signs an action for the log it is written to.
2810
4078
  *
2811
4079
  * @param action - The action to sign.
4080
+ * @param target - The document and branch whose log stores the action.
2812
4081
  * @param abortSignal - Optional abort signal to cancel the signing.
2813
4082
  * @returns The signature tuple.
2814
4083
  */
2815
- signAction: (action: Action, abortSignal?: AbortSignal) => Promise<Signature>;
4084
+ signAction: (action: Action, target: ActionSigningTarget, abortSignal?: AbortSignal) => Promise<Signature>;
2816
4085
  }
2817
4086
  type IsStateOfType<TState> = (state: unknown) => state is TState;
2818
4087
  type AssertIsStateOfType<TState> = (state: unknown) => asserts state is TState;
@@ -2831,6 +4100,9 @@ type MinimalBackupData = {
2831
4100
  branch: string;
2832
4101
  state: PHBaseState;
2833
4102
  name: string;
4103
+ protocolVersions?: {
4104
+ [key: string]: number;
4105
+ };
2834
4106
  };
2835
4107
  type DocumentModelUtils<TState extends PHBaseState = PHBaseState> = {
2836
4108
  fileExtension: string;
@@ -2870,7 +4142,8 @@ type PhAiToolDescriptor = {
2870
4142
  callback: (args: never) => Promise<unknown>;
2871
4143
  };
2872
4144
  type DocumentModelModule<TState extends PHBaseState = PHBaseState> = {
2873
- /** optional version field, should be made required */version?: number;
4145
+ /** optional version field, should be made required */
4146
+ version?: number;
2874
4147
  reducer: Reducer<TState>;
2875
4148
  actions: Actions;
2876
4149
  utils: DocumentModelUtils<TState>;
@@ -2893,6 +4166,7 @@ type DocumentModelDocumentModelModule = DocumentModelModule<DocumentModelPHState
2893
4166
  type ConfigEntryType = z.infer<typeof ConfigEntryTypeSchema>;
2894
4167
  type ConfigEntry = z.infer<typeof ConfigEntrySchema>;
2895
4168
  type PowerhouseModule = z.infer<typeof PowerhouseModuleSchema>;
4169
+ type PieceModule = z.infer<typeof PieceModuleSchema>;
2896
4170
  type Publisher = z.infer<typeof PublisherSchema>;
2897
4171
  type Manifest = z.infer<typeof ManifestSchema>;
2898
4172
  //#endregion
@@ -2919,199 +4193,82 @@ type PowerhousePackage = {
2919
4193
  provider?: PHPackageProvider;
2920
4194
  url?: string;
2921
4195
  };
2922
- type PHConnectBranding = {
2923
- appName?: string;
2924
- homeBackground?: string | null;
2925
- };
2926
- type PHConnectDefaultDriveRemote = {
2927
- url: string;
2928
- name?: string | null;
2929
- icon?: string | null;
2930
- };
2931
- type PHConnectDefaultDriveLocal = {
2932
- /** Discriminator: this entry is a local drive created on first boot. */local: true; /** Stable drive id; the drive is not re-created on later boots. */
2933
- id: string;
2934
- name?: string | null;
2935
- icon?: string | null; /** Drive app (preferred editor) to open on the drive. */
2936
- app?: string;
2937
- };
2938
- type PHConnectDefaultDrive = PHConnectDefaultDriveRemote | PHConnectDefaultDriveLocal;
2939
- type PHConnectDriveSection = {
2940
- enabled?: boolean;
2941
- allowAdd?: boolean;
2942
- allowDelete?: boolean;
2943
- };
2944
- type PHConnectDriveSections = {
2945
- remote?: PHConnectDriveSection;
2946
- local?: PHConnectDriveSection;
2947
- };
2948
- type PHConnectDrives = {
2949
- allowAddDrive?: boolean;
2950
- defaultDrives?: PHConnectDefaultDrive[];
2951
- preserveStrategy?: DrivePreserveStrategy;
2952
- sections?: PHConnectDriveSections;
2953
- };
2954
- type PHConnectApp = {
2955
- logLevel?: "debug" | "info" | "warn" | "error";
2956
- basePath?: string;
2957
- offline?: boolean;
2958
- studioMode?: boolean;
2959
- };
2960
- type PHConnectAi = {
2961
- /** Enables the in-browser AI assistant (chat FAB + window). Off by default. */assistantEnabled?: boolean;
2962
- };
2963
- type PHConnectPackages = {
2964
- externalEnabled?: boolean; /** Subscribe to the static-mode `/__packages` SSE channel for live reload. */
2965
- liveReload?: boolean;
2966
- };
2967
- type PHRenownRainbowAdapterConfig = {
2968
- /** WalletConnect project id; required for the rainbow adapter to function. */walletConnectProjectId?: string; /** Optional Infura project id used to build RPC transports. */
2969
- infuraProjectId?: string;
2970
- };
2971
- type PHRenownPrivyAdapterConfig = {
2972
- /** Privy application id; required for the privy adapter to function. */appId?: string; /** Optional Privy client id. */
2973
- clientId?: string; /** Login methods this adapter offers; defaults per adapter when omitted. */
2974
- methods?: string[];
2975
- };
2976
- type PHConnectRenownAdapters = {
2977
- rainbow?: PHRenownRainbowAdapterConfig;
2978
- privy?: PHRenownPrivyAdapterConfig;
2979
- };
2980
- type PHConnectRenown = {
2981
- url?: string;
2982
- networkId?: string;
2983
- chainId?: number; /** Renown localStorage namespace; share it across Connects to share login. */
2984
- namespace?: string; /** Switchboard GraphQL URL; when set, enables in-page (no-redirect) auth. */
2985
- switchboardUrl?: string; /** Per-adapter wallet config; presence of a key enables that adapter. */
2986
- adapters?: PHConnectRenownAdapters;
2987
- };
2988
- type PHConnectSentry = {
2989
- /** Sentry DSN URL. `null` disables Sentry entirely. */dsn?: string | null; /** Sentry environment label. */
2990
- env?: string; /** Enable Sentry performance tracing. */
2991
- tracing?: boolean;
2992
- };
2993
- type PHConnectInstance = {
2994
- namespace: string | null;
2995
- reactorWorker: boolean;
2996
- };
4196
+ type PHImageRef = z.infer<typeof connectImageRefSchema>;
4197
+ type PHSchemedImage = z.infer<typeof connectSchemedImageSchema>;
4198
+ type PHSchemedColor = z.infer<typeof connectSchemedColorSchema>;
4199
+ type PHLength = z.infer<typeof connectLengthSchema>;
4200
+ type PHEdges = z.infer<typeof connectEdgesSchema>;
4201
+ type PHBackgroundLayer = z.infer<typeof connectBackgroundLayerSchema>;
4202
+ type PHBackgroundLayers = z.infer<typeof connectBackgroundLayersSchema>;
4203
+ type PHBackground = z.infer<typeof connectBackgroundSchema>;
4204
+ type PHConnectBranding = z.infer<typeof connectBrandingSchema>;
4205
+ type PHConnectLoader = z.infer<typeof connectLoaderSchema>;
4206
+ type PHConnectHome = z.infer<typeof connectHomeSchema>;
4207
+ type PHConnectExplorerIcons = z.infer<typeof connectExplorerIconsSchema>;
4208
+ type PHConnectDefaultDriveRemote = z.infer<typeof connectDefaultDriveRemoteSchema>;
4209
+ type PHConnectDefaultDriveLocal = z.infer<typeof connectDefaultDriveLocalSchema>;
4210
+ type PHConnectDefaultDrive = z.infer<typeof connectDefaultDriveSchema>;
4211
+ type PHConnectDriveSection = z.infer<typeof connectDriveSectionSchema>;
4212
+ type PHConnectDriveSections = z.infer<typeof connectDriveSectionsSchema>;
4213
+ type PHConnectDrives = z.infer<typeof connectDrivesSchema>;
4214
+ type PHConnectApp = z.infer<typeof connectAppSchema>;
4215
+ type PHConnectAi = z.infer<typeof connectAiSchema>;
4216
+ type PHConnectPackages = z.infer<typeof connectPackagesSchema>;
4217
+ type PHRenownRainbowAdapterConfig = z.infer<typeof connectRenownRainbowAdapterSchema>;
4218
+ type PHRenownPrivyAdapterConfig = z.infer<typeof connectRenownPrivyAdapterSchema>;
4219
+ type PHConnectRenownAdapters = z.infer<typeof connectRenownAdaptersSchema>;
4220
+ type PHConnectRenown = z.infer<typeof connectRenownSchema>;
4221
+ type PHConnectSentry = z.infer<typeof connectSentrySchema>;
4222
+ type PHConnectOpenPanel = z.infer<typeof connectOpenPanelSchema>;
4223
+ /**
4224
+ * Which reactor client Connect runs. One field selects all four shapes the
4225
+ * multi-reactor work standardized (each a peer `IReactorClient`):
4226
+ * - `in-process`: the tab's own reactor on the main thread (PGlite in-tab).
4227
+ * - `worker`: the tab's own reactor in a SharedWorker (PGlite in-worker).
4228
+ * - `remote`: a pure client to a remote Switchboard reactor over GraphQL,
4229
+ * with NO local reactor and NO PGlite download.
4230
+ * - `router`: the tab's reactor (local) PLUS remote backends, routed.
4231
+ * Derived from the host's reactor backends (see reactorClientMode); when
4232
+ * unset, Connect falls back to the legacy `reactorWorker`/`multiReactor`
4233
+ * booleans.
4234
+ */
4235
+ type PHReactorClientMode = z.infer<typeof connectReactorClientModeSchema>;
4236
+ /** Served `instance`: the authored fields plus the derived `reactorClient`. */
4237
+ type PHConnectInstance = z.infer<typeof connectRuntimeInstanceSchema>;
2997
4238
  /** Each flag implies its predecessors, and must match the fleet Connect syncs
2998
4239
  * with or the two compute different replay outcomes. */
2999
- type PHConnectReactorFeatureFlags = {
3000
- /** Decide writes from the document stream instead of the meta cache. */documentDecisions?: boolean; /** Enforce the auth scope's policy at admission, replay, and read. */
3001
- authEnforcement?: boolean; /** Let `{ group }` principals match, via the group documents' rosters. */
3002
- authGroups?: boolean; /** Evaluate `where` / `match` conditions on grants. */
3003
- authConditions?: boolean;
3004
- };
3005
- type PHConnectReactor = {
3006
- featureFlags?: PHConnectReactorFeatureFlags;
3007
- };
3008
- /**
3009
- * A URL-matching pattern for a service-worker runtime-caching rule, in
3010
- * JSON-serialisable form. A plain string is handed to Workbox verbatim (exact
3011
- * URL or same-origin path match). `{ source, flags }` is reconstructed into a
3012
- * `RegExp` at build time — use it for prefix/suffix/origin matches (e.g.
3013
- * `{ source: "^https://api\\.acme\\.io/" }`). Function-valued patterns aren't
3014
- * expressible here; regex covers the realistic package cases.
3015
- */
3016
- type PHConnectPwaUrlPattern = string | {
3017
- source: string;
3018
- flags?: string;
3019
- };
3020
- type PHConnectPwaCacheStrategy = "CacheFirst" | "CacheOnly" | "NetworkFirst" | "NetworkOnly" | "StaleWhileRevalidate";
3021
- /** Serialisable subset of a Workbox `RuntimeCaching` rule. */
3022
- type PHConnectPwaRuntimeCaching = {
3023
- urlPattern: PHConnectPwaUrlPattern;
3024
- handler: PHConnectPwaCacheStrategy;
3025
- method?: "GET" | "POST" | "PUT" | "DELETE" | "HEAD" | "PATCH";
3026
- options?: {
3027
- cacheName?: string;
3028
- /** Seconds a NetworkFirst rule waits for the network before falling back
3029
- * to the cache. */
3030
- networkTimeoutSeconds?: number;
3031
- expiration?: {
3032
- maxEntries?: number;
3033
- maxAgeSeconds?: number;
3034
- };
3035
- cacheableResponse?: {
3036
- statuses?: number[];
3037
- headers?: Record<string, string>;
3038
- };
3039
- };
3040
- };
3041
- type PHConnectPwaIcon = {
3042
- src: string;
3043
- sizes?: string;
3044
- type?: string;
3045
- purpose?: string;
3046
- };
4240
+ type PHConnectReactorFeatureFlags = z.infer<typeof connectReactorFeatureFlagsSchema>;
4241
+ type PHConnectReactor = z.infer<typeof connectReactorSchema>;
4242
+ type PHConnectPwaUrlPattern = z.infer<typeof connectPwaUrlPatternSchema>;
4243
+ type PHConnectPwaCacheStrategy = z.infer<typeof connectPwaCacheStrategySchema>;
4244
+ type PHConnectPwaRuntimeCaching = z.infer<typeof connectPwaRuntimeCachingSchema>;
4245
+ type PHConnectPwaIcon = z.infer<typeof connectPwaIconSchema>;
4246
+ type PHConnectPwaFileHandler = z.infer<typeof connectPwaFileHandlerSchema>;
4247
+ /** Served manifest overrides: the authored fields plus `categories`, derived
4248
+ * from every contributing `powerhouse.manifest.json`'s `category`. */
4249
+ type PHConnectPwaManifest = z.infer<typeof connectRuntimePwaManifestSchema>;
3047
4250
  /**
3048
- * A File Handling API entry a package or project contributes: the OS-level
3049
- * file types the installed Connect PWA offers to open. There is deliberately
3050
- * no `action` field — consuming launched files requires runtime code that
3051
- * lives in Connect itself, so every handler (built-in or contributed) opens
3052
- * at Connect's app root, injected at build time.
4251
+ * PWA / service-worker overrides contributed by a package or the project,
4252
+ * layered on Connect's hardcoded PWA defaults at build time. Scalars
4253
+ * deep-merge (later layer wins), arrays are additive and
4254
+ * `maximumFileSizeToCacheInBytes` takes the max. Precedence: defaults <
4255
+ * package fragments < project config.
3053
4256
  */
3054
- type PHConnectPwaFileHandler = {
3055
- /** MIME type → file extensions (each must start with "."). */accept: Record<string, string[]>; /** OS-level file-type icons. */
3056
- icons?: PHConnectPwaIcon[];
3057
- launch_type?: "single-client" | "multiple-clients";
3058
- };
3059
- /** Web-app-manifest fields a package or project may override. */
3060
- type PHConnectPwaManifest = {
3061
- name?: string;
3062
- short_name?: string;
3063
- description?: string;
3064
- theme_color?: string;
3065
- background_color?: string;
3066
- display?: "fullscreen" | "standalone" | "minimal-ui" | "browser";
3067
- start_url?: string;
3068
- scope?: string;
3069
- icons?: PHConnectPwaIcon[]; /** Extra file associations, appended after Connect's built-in `.phd`/`.phdm` handler. */
3070
- file_handlers?: PHConnectPwaFileHandler[]; /** How the OS launches the app for handled files/links. */
3071
- launch_handler?: {
3072
- client_mode: "auto" | "focus-existing" | "navigate-existing" | "navigate-new";
3073
- };
3074
- /** App-store-style categories. NOT authored under `connect.pwa` — derived at
3075
- * build/runtime from the `category` field of every contributing
3076
- * `powerhouse.manifest.json` (project + packages), unioned across them. */
3077
- categories?: string[];
3078
- };
3079
- /**
3080
- * PWA / service-worker overrides contributed by a package or the project.
3081
- * Layered on top of Connect's hardcoded PWA defaults at build time. Scalar
3082
- * fields deep-merge (later layer wins); every array member — the manifest
3083
- * arrays (`icons`, `file_handlers`, and the derived `categories`) plus the
3084
- * top-level `globPatterns`, `globIgnores`, `runtimeCaching` and
3085
- * `navigateFallbackDenylist` — is additive (concatenated/unioned);
3086
- * `maximumFileSizeToCacheInBytes` takes the max across contributors.
3087
- * Precedence: defaults < package fragments < project config.
3088
- */
3089
- type PHConnectPwa = {
3090
- manifest?: PHConnectPwaManifest; /** Extra Workbox precache globs, unioned with the built-in patterns. */
3091
- globPatterns?: string[]; /** Extra Workbox precache ignore globs, unioned with the built-in list. */
3092
- globIgnores?: string[]; /** Raise the precache file-size ceiling; the max across contributors wins. */
3093
- maximumFileSizeToCacheInBytes?: number; /** Additional runtime-caching rules, appended after the built-in rules. */
3094
- runtimeCaching?: PHConnectPwaRuntimeCaching[]; /** Extra SPA-fallback denylist patterns, unioned with the built-in list. */
3095
- navigateFallbackDenylist?: PHConnectPwaUrlPattern[];
3096
- };
3097
- type PHConnectRuntimeConfig = {
3098
- branding?: PHConnectBranding;
3099
- app?: PHConnectApp;
3100
- ai?: PHConnectAi;
3101
- packages?: PHConnectPackages;
3102
- drives?: PHConnectDrives;
3103
- renown?: PHConnectRenown;
3104
- sentry?: PHConnectSentry;
3105
- instance?: PHConnectInstance;
3106
- reactor?: PHConnectReactor;
3107
- pwa?: PHConnectPwa;
3108
- };
4257
+ type PHConnectPwa = z.infer<typeof connectRuntimePwaSchema>;
4258
+ /** One entry of the host.js composition, projected into the served config as
4259
+ * DATA (module specifier + validated config). */
4260
+ type PHConnectCompositionEntry = z.infer<typeof connectCompositionEntrySchema>;
4261
+ /** The served `connect` block. For the authored block (powerhouse.config.json,
4262
+ * the connect host's `config`) see `ConnectConfig`. */
4263
+ type PHConnectRuntimeConfig = z.infer<typeof connectRuntimeConfigSchema>;
3109
4264
  /** Which Renown instance a reactor authenticates against, server-side. */
3110
4265
  type PHReactorRenown = {
3111
4266
  /** "self" reads this reactor's own renown read model; "remote" (default)
3112
4267
  * queries a Renown or Switchboard instance. */
3113
- source?: "remote" | "self"; /** Renown base URL; also the instance this reactor's own identity uses. */
3114
- url?: string; /** Switchboard GraphQL endpoint to read credentials from directly. */
4268
+ source?: "remote" | "self";
4269
+ /** Renown base URL; also the instance this reactor's own identity uses. */
4270
+ url?: string;
4271
+ /** Switchboard GraphQL endpoint to read credentials from directly. */
3115
4272
  switchboardUrl?: string;
3116
4273
  };
3117
4274
  type PowerhouseConfig = {
@@ -3159,9 +4316,16 @@ type PowerhouseConfig = {
3159
4316
  driveUrl?: string;
3160
4317
  connectPort?: number;
3161
4318
  };
4319
+ assistant?: {
4320
+ port?: number;
4321
+ };
4322
+ workflows?: {
4323
+ enabled?: boolean;
4324
+ };
3162
4325
  packageRegistryUrl?: string;
3163
4326
  connect?: PHConnectRuntimeConfig;
3164
4327
  };
3165
4328
  //#endregion
3166
- export { AddOperationExampleAction as $, UpgradeReducer as $a, deleteOperationExample as $c, SetOperationErrorCodeAction as $i, baseCreateDocument as $l, MutationDeleteOperationErrorArgs as $n, SetAuthorWebsiteInputSchema as $o, RedoActionInput as $r, ProcessorDispatchResult as $s, DocumentModelOperationExampleOperations as $t, PHDocumentState as $u, PHReactorRenown as A, SigningParameters as Aa, WebhookSignatureEncoding as Ac, SetAuthorNameAction as Ai, setOperationErrorDescription as Al, LoadStateActionInput as An, ModuleSchema as Ao, MutationSetOperationTemplateArgs as Ar, UpdateStateExampleInputSchema as As, DeleteOperationErrorInput as At, sortMappedOperations as Au, DEFAULT_REGISTRY_URL as B, UpdateChangeLogItemAction as Ba, addModule as Bc, SetModelIdAction as Bi, undo as Bl, ModuleSpecification as Bn, PublisherSchema as Bo, OperationsByScope as Br, IBaseRelationalDb as Bs, DocumentModelGlobalState as Bt, operationOutcome as Bu, PHConnectReactor as C, Set_PreferredEditor as Ca, WebhookEndpointInfo as Cc, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Cd, SchemaNOOPAction as Ci, setModelId as Cl, Incremental as Cn, DocumentModelInputSchema as Co, MutationSetOperationErrorCodeArgs as Cr, Set_PreferredEditorSchema as Cs, DeleteChildDocumentSignal as Ct, prepareOperations as Cu, PHConnectRuntimeConfig as D, SignalResults as Da, WebhookReply as Dc, SchemaSetPreferredEditorAction as Di, setName as Dl, LoadFromFile as Dn, LoadStateActionStateInputSchema as Do, MutationSetOperationNameArgs as Dr, UndoSchema as Ds, DeleteModuleInput as Dt, reshuffleByTimestamp as Du, PHConnectRenownAdapters as E, SignalResult as Ea, WebhookPolicy as Ec, SchemaSetNameAction as Ei, setModuleName as El, IsStateOfType as En, LoadStateActionSchema as Eo, MutationSetOperationErrorTemplateArgs as Er, UndoActionSchema as Es, DeleteModuleAction as Et, replayDocument as Eu, PathValidation as F, SubgraphModule as Fa, actionContext as Fc, SetInitialStateInput as Fi, setOperationSchema as Fl, MakeOptional as Fn, PowerhouseModuleSchema as Fo, MutationUpdateStateExampleArgs as Fr, createRelationalDb as Fs, DeleteStateExampleInput as Ft, Operation as Fu, Actions as G, UpdateRelationshipActionInput as Ga, baseActions as Gc, SetModuleDescriptionInput as Gi, IntegrityIssueSubType as Gl, MutationAddModuleArgs as Gn, ReorderChangeLogItemsInputSchema as Go, PowerhouseModule as Gr, RelationalDbProcessor as Gs, DocumentModelLocalState as Gt, undoOperationV2 as Gu, ActionSignatureContext as H, UpdateOperationExampleAction as Ha, addOperationError as Hc, SetModelNameAction as Hi, updateOperationExample as Hl, MoveOperationInput as Hn, RedoActionInputSchema as Ho, PartialState as Hr, IRelationalDbProcessor as Hs, DocumentModelHeaderOperations as Ht, setNameOperation as Hu, PowerhouseConfig as I, Undo as Ia, actionFromAction as Ic, SetModelDescriptionAction as Ii, setOperationScope as Il, Manifest as In, PowerhouseModulesSchema as Io, NOOPAction as Ir, hashNamespace as Is, DocumentAction as It, OperationContext as Iu, AddModuleAction as J, UpgradeDocumentAction as Ja, createAction as Jc, SetNameAction as Ji, PHDocumentHeader as Jl, MutationAddOperationExampleArgs as Jn, ReorderOperationErrorsInputSchema as Jo, PruneActionInput as Jr, IProcessorDispatch as Js, DocumentModelModuleOperations as Jt, Condition as Ju, AddChangeLogItemAction as K, UpdateStateExampleAction as Ka, buildOperationSignature as Kc, SetModuleNameAction as Ki, IntegrityIssueType as Kl, MutationAddOperationArgs as Kn, ReorderModuleOperationsInputSchema as Ko, Prune as Kr, RelationalDbProcessorClass as Ks, DocumentModelModule as Kt, AuthGroups as Ku, PowerhousePackage as L, UndoAction as La, actionSigner as Lc, SetModelDescriptionInput as Li, setOperationTemplate as Ll, MappedOperation as Ln, PruneActionInputSchema as Lo, OperationErrorSpecification as Lr, relationalDbToQueryBuilder as Ls, DocumentModelAction as Lt, OperationOutcome as Lu, PHRenownRainbowAdapterConfig as M, SkipHeaderOperations as Ma, WebhookVerification as Mc, SetAuthorWebsiteAction as Mi, setOperationErrorTemplate as Ml, Load_State as Mn, OperationErrorSchema as Mo, MutationUndoArgs as Mr, isDefinedNonNullAny as Ms, DeleteOperationExampleInput as Mt, split as Mu, PackageManagerArgs as N, State as Na, Action as Nc, SetAuthorWebsiteInput as Ni, setOperationName as Nl, MakeEmpty as Nn, OperationScopeSchema as No, MutationUpdateChangeLogItemInputArgs as Nr, createNamespacedDb as Ns, DeleteOperationInput as Nt, updateHeaderRevision as Nu, PHConnectSentry as O, SignalType as Oa, WebhookRequest as Oc, SchemaUndoAction as Oi, setOperationDescription as Ol, LoadFromInput as On, Load_StateSchema as Oo, MutationSetOperationReducerArgs as Or, UpdateChangeLogItemInputSchema as Os, DeleteOperationAction as Ot, reshuffleByTimestampAndIndex as Ou, ParsedCmdResult as P, StateReducer as Pa, ActionContext as Pc, SetInitialStateAction as Pi, setOperationReducer as Pl, MakeMaybe as Pn, OperationSpecificationSchema as Po, MutationUpdateOperationExampleArgs as Pr, createNamespacedQueryBuilder as Ps, DeleteStateExampleAction as Pt, DocumentOperations as Pu, AddOperationErrorInput as Q, UpgradeManifest as Qa, deleteOperationError as Qc, SetOperationDescriptionInput as Qi, attachBranch as Ql, MutationDeleteOperationArgs as Qn, SetAuthorNameInputSchema as Qo, RedoAction as Qr, ProcessorApps as Qs, DocumentModelOperationExampleAction as Qt, PHBaseState as Qu, ServiceAction as R, UndoActionInput as Ra, actions as Rc, SetModelExtensionAction as Ri, setPreferredEditor as Rl, Maybe as Rn, PruneActionSchema as Ro, OperationIndex as Rr, ExtractProcessorSchemaOrSelf as Rs, DocumentModelDocument as Rt, OperationWithContext$1 as Ru, PHConnectPwaUrlPattern as S, Set_Name as Sa, ScopedRouteHandle as Sc, serializeSignature as Sd, SchemaLoadStateAction as Si, setModelExtension as Sl, ISigner as Sn, DocumentModelGlobalStateSchema as So, MutationSetOperationDescriptionArgs as Sr, Set_NameSchema as Ss, DeleteChildDocumentInput as St, precedes as Su, PHConnectRenown as T, SignalDispatch as Ta, WebhookHashAlgorithm as Tc, PROCESSOR_APPS as Td, SchemaRedoAction as Ti, setModuleDescription as Tl, IsDocumentOfType as Tn, LoadStateActionInputSchema as To, MutationSetOperationErrorNameArgs as Tr, UndoActionInputSchema as Ts, DeleteDocumentActionInput as Tt, removeExistingOperations as Tu, ActionSigningHandler as U, UpdateOperationExampleInput as Ua, addOperationExample as Uc, SetModelNameInput as Ui, updateStateExample as Ul, Mutation as Un, RedoActionSchema as Uo, PhAiToolAnnotations as Ur, IRelationalQueryBuilder as Us, DocumentModelInput as Ut, setPreferredEditorOperation as Uu, ActionErrorCallback as V, UpdateChangeLogItemInput as Va, addOperation as Vc, SetModelIdInput as Vi, updateChangeLogItem as Vl, MoveOperationAction as Vn, PwaConfigSchema as Vo, PartialRecord as Vr, IRelationalDb as Vs, DocumentModelHeaderAction as Vt, redoOperation as Vu, ActionVerificationHandler as W, UpdateRelationshipAction as Wa, addStateExample as Wc, SetModuleDescriptionAction as Wi, verifyOperationSignature as Wl, MutationAddChangeLogItemInputArgs as Wn, RedoSchema as Wo, PhAiToolDescriptor as Wr, IRelationalQueryMethods as Ws, DocumentModelLib as Wt, undoOperation as Wu, AddOperationAction as X, User as Xa, deleteModule as Xc, SetNameOperation as Xi, addUndo as Xl, MutationDeleteChangeLogItemInputArgs as Xn, ReorderStateExamplesInputSchema as Xo, Query as Xr, IProcessorManager as Xs, DocumentModelOperationErrorAction as Xt, Operand as Xu, AddModuleInput as Y, UpgradeDocumentActionInput as Ya, deleteChangeLogItem as Yc, SetNameActionInput as Yi, PHDocumentMeta as Yl, MutationAddStateExampleArgs as Yn, ReorderOperationExamplesInputSchema as Yo, Publisher as Yr, IProcessorHostModuleBase as Ys, DocumentModelOperationAction as Yt, Grant as Yu, AddOperationErrorAction as Z, ValidationError as Za, deleteOperation as Zc, SetOperationDescriptionAction as Zi, appendWithoutApplying as Zl, MutationDeleteModuleArgs as Zn, ScopeStateSchema as Zo, Redo as Zr, ProcessorApp as Zs, DocumentModelOperationErrorOperations as Zt, PHAuthState as Zu, PHConnectPwaCacheStrategy as _, SetPreferredEditorAction as _a, RouteMethod as _c, HashConfig as _d, ReplayDocumentOptions as _i, reorderStateExamples as _l, ID as _n, DeleteOperationErrorInputSchema as _o, MutationSetModelIdArgs as _r, SetOperationScopeInputSchema as _s, CreateDocumentAction as _t, mapSkippedOperationsV2 as _u, PHConnectAi as a, SetOperationErrorTemplateAction as aa, TrackedProcessor as ac, createDocumentState as ad, ReorderChangeLogItemsAction as ai, operationExampleCreators as al, DocumentModelVersioningAction as an, AddChangeLogItemInputSchema as ao, MutationRedoArgs as ar, SetModuleDescriptionInputSchema as as, AddStateExampleInput as at, filterDuplicatedOperations as au, PHConnectPwaManifest as b, SetStateSchemaAction as ba, RouteTransport as bc, UserActionSigner as bd, SaveToFileHandle as bi, setInitialState as bl, ISignal as bn, DeleteStateExampleInputSchema as bo, MutationSetModuleNameArgs as br, SetPreferredEditorActionSchema as bs, DeleteChangeLogItemAction as bt, operationsAreEqual as bu, PHConnectDefaultDrive as c, SetOperationNameInput as ca, IWebhookEndpoints as cc, createState as cd, ReorderModuleOperationsInput as ci, operationWithContext as cl, DocumentSpecification as cn, AddOperationExampleInputSchema as co, MutationReorderModulesArgs as cr, SetNameActionSchema as cs, Author as ct, garbageCollectV2 as cu, PHConnectDriveSection as d, SetOperationSchemaAction as da, RouteActor as dc, defaultDocumentState as dd, ReorderOperationErrorsAction as di, releaseNewVersion as dl, EditorModule as dn, AuthorSchema as do, MutationReorderStateExamplesArgs as dr, SetOperationErrorDescriptionInputSchema as ds, ConfigEntryType as dt, hashDocumentStateForScope as du, SetOperationErrorCodeInput as ea, ProcessorFactory as ec, PHGroupState as ed, Reducer as ei, deleteStateExample as el, DocumentModelOperationOperations as en, UpgradeTransition as eo, MutationDeleteOperationExampleArgs as er, SetInitialStateInputSchema as es, AddOperationExampleInput as et, baseReducerVersion as eu, PHConnectDriveSections as f, SetOperationSchemaInput as fa, RouteAuth as fc, defaultGlobalState as fd, ReorderOperationErrorsInput as fi, reorderChangeLogItems as fl, EditorProps as fn, CodeExampleSchema as fo, MutationSetAuthorNameArgs as fr, SetOperationErrorNameInputSchema as fs, CopyChildDocumentInput as ft, isDocumentAction as fu, PHConnectPwa as g, SetOperationTemplateInput as ga, RouteHandler as gc, AppActionSigner as gd, ReorderStateExamplesInput as gi, reorderOperationExamples as gl, IAction as gn, DeleteModuleInputSchema as go, MutationSetModelExtensionArgs as gr, SetOperationSchemaInputSchema as gs, CreateDocument as gt, mapSkippedOperations as gu, PHConnectPackages as h, SetOperationTemplateAction as ha, RouteContext as hc, ActionSigner as hd, ReorderStateExamplesAction as hi, reorderOperationErrors as hl, GetDocumentOptions as hn, DeleteChangeLogItemInputSchema as ho, MutationSetModelDescriptionArgs as hr, SetOperationReducerInputSchema as hs, CreateChildDocumentSignal as ht, isUndoRedo as hu, LogLevels as i, SetOperationErrorNameInput as ia, ProcessorStatus as ic, createBaseState as id, RemoveRelationshipActionInput as ii, noop as il, DocumentModelUtils as in, normalizeDocumentModelVersion as io, MutationPruneArgs as ir, SetModelNameInputSchema as is, AddStateExampleAction as it, filterDocumentOperationsResultingState as iu, PHRenownPrivyAdapterConfig as j, SkipHeaderOperationIndex as ja, WebhookSpec as jc, SetAuthorNameInput as ji, setOperationErrorName as jl, LoadStateActionStateInput as jn, MoveOperationInputSchema as jo, MutationSetStateSchemaArgs as jr, definedNonNullAnySchema as js, DeleteOperationExampleAction as jt, sortOperations as ju, PHPackageProvider as k, SignatureVerificationHandler as ka, WebhookScheme as kc, ScopeState as ki, setOperationErrorCode as kl, LoadStateAction as kn, ManifestSchema as ko, MutationSetOperationSchemaArgs as kr, UpdateOperationExampleInputSchema as ks, DeleteOperationErrorAction as kt, skipHeaderOperations as ku, PHConnectDefaultDriveLocal as l, SetOperationReducerAction as la, IWebhookScope as lc, defaultAuthState as ld, ReorderModulesAction as li, prune as ll, ENSInfo as ln, AddOperationInputSchema as lo, MutationReorderOperationErrorsArgs as lr, SetOperationDescriptionInputSchema as ls, CodeExample as lt, getDocumentLastModified as lu, PHConnectInstance as m, SetOperationScopeInput as ma, RouteBody as mc, defaultPHState as md, ReorderOperationExamplesInput as mi, reorderModules as ml, FileInput as mn, ConfigEntryTypeSchema as mo, MutationSetInitialStateArgs as mr, SetOperationNameInputSchema as ms, CreateChildDocumentInput as mt, isUndo as mu, DrivePreserveStrategy as n, SetOperationErrorDescriptionInput as na, ProcessorFilter as nc, backfillAuthState as nd, ReleaseNewVersionAction as ni, loadState as nl, DocumentModelStateAction as nn, applyUpgradeDocumentAction as no, MutationLoadStateArgs as nr, SetModelExtensionInputSchema as ns, AddRelationshipAction as nt, checkOperationsIntegrity as nu, PHConnectApp as o, SetOperationErrorTemplateInput as oa, AuthorizerResult as oc, createGlobalState as od, ReorderChangeLogItemsInput as oi, operationFromAction as ol, DocumentModelVersioningOperations as on, AddModuleInputSchema as oo, MutationReorderChangeLogItemsInputArgs as or, SetModuleNameInputSchema as os, AssertIsDocumentOfType as ot, garbageCollect as ou, PHConnectDrives as p, SetOperationScopeAction as pa, RouteAuthorizer as pc, defaultLocalState as pd, ReorderOperationExamplesAction as pi, reorderModuleOperations as pl, Exact as pn, ConfigEntrySchema as po, MutationSetAuthorWebsiteArgs as pr, SetOperationErrorTemplateInputSchema as ps, CopyChildDocumentSignal as pt, isNoopOperation as pu, AddChangeLogItemInput as q, UpdateStateExampleInput as qa, buildSignedAction as qc, SetModuleNameInput as qi, PHDocument as ql, MutationAddOperationErrorArgs as qn, ReorderModulesInputSchema as qo, PruneAction as qr, IProcessor as qs, DocumentModelModuleAction as qt, Capability as qu, LogLevel as r, SetOperationErrorNameAction as ra, ProcessorRecord as rc, createAuthState as rd, RemoveRelationshipAction as ri, moveOperation as rl, DocumentModelStateOperations as rn, computeUpgradeTransitions as ro, MutationMoveOperationArgs as rr, SetModelIdInputSchema as rs, AddRelationshipActionInput as rt, diffOperations as ru, PHConnectBranding as s, SetOperationNameAction as sa, IHttpScope as sc, createLocalState as sd, ReorderModuleOperationsAction as si, operationFromOperation as sl, DocumentOperationsIgnoreMap as sn, AddOperationErrorInputSchema as so, MutationReorderModuleOperationsArgs as sr, SetNameActionInputSchema as ss, AssertIsStateOfType as st, garbageCollectDocumentOperations as su, DrivePreserveStrategies as t, SetOperationErrorDescriptionAction as ta, ProcessorFactoryBuilder as tc, Principal as td, ReducerOptions as ti, documentModelActions as tl, DocumentModelPHState as tn, applyDeleteDocumentAction as to, MutationDeleteStateExampleArgs as tr, SetModelDescriptionInputSchema as ts, AddOperationInput as tt, checkCleanedOperationsIntegrity as tu, PHConnectDefaultDriveRemote as u, SetOperationReducerInput as ua, NodeRouteSpec as uc, defaultBaseState as ud, ReorderModulesInput as ui, redo as ul, EditorDispatch as un, AddStateExampleInputSchema as uo, MutationReorderOperationExamplesArgs as ur, SetOperationErrorCodeInputSchema as us, ConfigEntry as ut, groupOperationsByScope as uu, PHConnectPwaFileHandler as v, SetPreferredEditorActionInput as va, RouteOptions as vc, PHDocumentSignatureInfo as vd, RevisionsFilter as vi, setAuthorName as vl, IDocument as vn, DeleteOperationExampleInputSchema as vo, MutationSetModelNameArgs as vr, SetOperationTemplateInputSchema as vs, CreateDocumentActionInput as vt, merge as vu, PHConnectReactorFeatureFlags as w, Signal as wa, WebhookField as wc, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as wd, SchemaPruneAction as wi, setModelName as wl, InputMaybe as wn, DocumentSpecificationSchema as wo, MutationSetOperationErrorDescriptionArgs as wr, StateSchema as ws, DeleteDocumentAction as wt, readOnly as wu, PHConnectPwaRuntimeCaching as x, SetStateSchemaInput as xa, RouteUser as xc, deserializeSignature as xd, Scalars as xi, setModelDescription as xl, ISignalResult as xn, DocumentActionSchema as xo, MutationSetNameArgs as xr, SetStateSchemaInputSchema as xs, DeleteChangeLogItemInput as xt, parseResultingState as xu, PHConnectPwaIcon as y, SetPreferredEditorOperation as ya, RouteSpec as yc, Signature as yd, SaveToFile as yi, setAuthorWebsite as yl, IOperation as yn, DeleteOperationInputSchema as yo, MutationSetModuleDescriptionArgs as yr, SetPreferredEditorActionInputSchema as ys, CreateState as yt, nextSkipNumber as yu, ServiceActions as z, UndoRedoAction as za, addChangeLogItem as zc, SetModelExtensionInput as zi, setStateSchema as zl, MinimalBackupData as zn, PruneSchema as zo, OperationSpecification as zr, HashAlgorithms as zs, DocumentModelDocumentModelModule as zt, loadStateOperation as zu };
3167
- //# sourceMappingURL=types-CpnWmiFY.d.ts.map
4329
+ export { ServiceActions as $, UpdateRelationshipActionInput as $a, documentModelHeaderReducer as $c, SetGrantActionInput as $d, deleteModule as $f, SetModuleDescriptionInput as $i, baseSaveToFileHandle as $l, defaultAuthState as $m, MoveOperationAction as $n, WebhookField as $o, attachBranch as $p, PhAiToolAnnotations as $r, OperationErrorSchema as $s, DocumentModelDocument as $t, buildOperationSignatureMessage as $u, PHConnectPwaUrlPattern as A, Set_Name as Aa, SetOperationErrorCodeInputSchema as Ac, grantProblem as Ad, canonicalJson as Af, AppActionSigner as Ah, SaveToFileHandle as Ai, coversLocal as Al, skipHeaderOperations as Am, GetDocumentOptions as An, ProcessorFactoryBuilder as Ao, setOperationErrorCode as Ap, MutationSetModuleNameArgs as Ar, AddChangeLogItemInputSchema as As, CreateDocument as At, InvalidActionInputZodError as Au, PHPackageProvider as B, SkipHeaderOperations as Ba, SetPreferredEditorActionSchema as Bc, AuthVerb as Bd, actionSigner as Bf, SetAuthorWebsiteAction as Bi, selectProtocolVersions as Bl, Operand as Bm, InputMaybe as Bn, RouteActor as Bo, setStateSchema as Bp, MutationSetOperationTemplateArgs as Br, DeleteChangeLogItemInputSchema as Bs, DeleteModuleAction as Bt, DocumentModelSchema as Bu, PHConnectPackages as C, SetOperationTemplateAction as Ca, SetModelIdInputSchema as Cc, assertAuthAdministrationRetained as Cd, ActionSignerIdentity as Cf, operationOutcome as Ch, ReorderOperationExamplesAction as Ci, PEER_CAPABILITIES as Cl, precedes as Cm, DocumentSpecification as Cn, IProcessorDispatch as Co, setModelExtension as Cp, MutationSetAuthorWebsiteArgs as Cr, validateInitialState as Cs, CodeExample as Ct, AuthInitializerNotCreatorError as Cu, PHConnectPwaIcon as D, SetPreferredEditorOperation as Da, SetNameActionInputSchema as Dc, evaluateCondition as Dd, actionPreimageV2 as Df, undoOperation as Dh, ReplayDocumentOptions as Di, PeerManifest as Dl, replayDocument as Dm, EditorProps as Dn, ProcessorApps as Do, setModuleName as Dp, MutationSetModelIdArgs as Dr, validateOperationName as Ds, CopyChildDocumentSignal as Dt, GrantNotFoundError as Du, PHConnectPwaFileHandler as E, SetPreferredEditorActionInput as Ea, SetModuleNameInputSchema as Ec, assertValidInitialGrants as Ed, DOCUMENT_SCOPE_ACTION_TYPES as Ef, setPreferredEditorOperation as Eh, ReorderStateExamplesInput as Ei, PeerCapabilityFlags as El, removeExistingOperations as Em, EditorModule as En, ProcessorApp as Eo, setModuleDescription as Ep, MutationSetModelExtensionArgs as Er, validateModules as Es, CopyChildDocumentInput as Et, FileSystemError as Eu, PHConnectRuntimeConfig as F, SignalResults as Fa, SetOperationReducerInputSchema as Fc, AuthDecision as Fd, v2TupleProblem as Ff, deserializeSignature as Fh, SchemaSetPreferredEditorAction as Fi, localSupports as Fl, withSignaturePolicy as Fm, IOperation as Fn, AuthorizerResult as Fo, setOperationReducer as Fp, MutationSetOperationErrorNameArgs as Fr, AddStateExampleInputSchema as Fs, DeleteChangeLogItemInput as Ft, groupMembershipActionTypes as Fu, PHSchemedColor as G, UndoAction as Ga, UndoActionInputSchema as Gc, MAX_SUPPORTED_AUTH_VERSION as Gd, addOperationError as Gf, SetModelDescriptionInput as Gi, createVerificationSigner as Gl, Principal as Gm, MakeEmpty as Gn, RouteHandler as Go, verifyOperationSignature as Gp, MutationUpdateStateExampleArgs as Gr, DeleteStateExampleInputSchema as Gs, DeleteOperationExampleAction as Gt, AUTH_DENIED_BY_GRANT_REASON as Gu, PHReactorRenown as H, StateReducer as Ha, Set_NameSchema as Hc, InitializeAuthAction as Hd, addChangeLogItem as Hf, SetInitialStateAction as Hi, createPresignedHeader as Hl, PHBaseState as Hm, IsStateOfType as Hn, RouteAuthorizer as Ho, updateChangeLogItem as Hp, MutationUndoArgs as Hr, DeleteOperationErrorInputSchema as Hs, DeleteOperationAction as Ht, assertIsDocumentModelState as Hu, PHConnectSentry as I, SignalType as Ia, SetOperationSchemaInputSchema as Ic, AuthEvaluation as Id, Action as If, serializeSignature as Ih, SchemaUndoAction as Ii, manifestRevision as Il, AuthGroups as Im, ISignal as In, IHttpScope as Io, setOperationSchema as Ip, MutationSetOperationErrorTemplateArgs as Ir, AuthorSchema as Is, DeleteChildDocumentInput as It, BaseDocumentHeaderSchema as Iu, ParsedCmdResult as J, UpdateChangeLogItemAction as Ja, UpdateChangeLogItemInputSchema as Jc, MoveGrantActionInputSchema as Jd, baseActions as Jf, SetModelIdAction as Ji, validateHeader as Jl, createBaseState as Jm, Manifest as Jn, RouteSpec as Jo, PHDocument as Jp, OperationIndex as Jr, DocumentModelInputSchema as Js, DeleteStateExampleAction as Jt, DOCUMENT_DELETED_REASON as Ju, PHSchemedImage as K, UndoActionInput as Ka, UndoActionSchema as Kc, MoveGrantAction as Kd, addOperationExample as Kf, SetModelExtensionAction as Ki, hasDerivedDocumentId as Kl, backfillAuthState as Km, MakeMaybe as Kn, RouteMethod as Ko, IntegrityIssueSubType as Kp, NOOPAction as Kr, DocumentActionSchema as Ks, DeleteOperationExampleInput as Kt, AUTH_NO_GRANT_REASON as Ku, PHEdges as L, SignatureVerificationHandler as La, SetOperationScopeInputSchema as Lc, AuthRefusal as Ld, ActionContext as Lf, DEFAULT_ANALYTICS_PROCESSOR_DB_NAME as Lh, ScopeState as Li, mergePeerCapabilities as Ll, Capability as Lm, ISignalResult as Ln, IWebhookEndpoints as Lo, setOperationScope as Lp, MutationSetOperationNameArgs as Lr, CodeExampleSchema as Ls, DeleteChildDocumentSignal as Lt, BaseDocumentStateSchema as Lu, PHConnectReactorFeatureFlags as M, Signal as Ma, SetOperationErrorNameInputSchema as Mc, referencedGroupIds as Md, isV2ActionHash as Mf, PHDocumentSignatureInfo as Mh, SchemaNOOPAction as Mi, isOlderManifest as Ml, sortOperations as Mm, IAction as Mn, ProcessorRecord as Mo, setOperationErrorName as Mp, MutationSetOperationDescriptionArgs as Mr, AddOperationErrorInputSchema as Ms, CreateDocumentActionInput as Mt, UnsupportedDocumentModelVersionError as Mu, PHConnectRenown as N, SignalDispatch as Na, SetOperationErrorTemplateInputSchema as Nc, AUTH_ACTION_TYPES as Nd, signActionV2 as Nf, Signature as Nh, SchemaRedoAction as Ni, legacySupports as Nl, split as Nm, ID as Nn, ProcessorStatus as No, setOperationErrorTemplate as Np, MutationSetOperationErrorCodeArgs as Nr, AddOperationExampleInputSchema as Ns, CreateState as Nt, documentModelDocumentType as Nu, PHConnectPwaManifest as O, SetStateSchemaAction as Oa, SetNameActionSchema as Oc, evaluateGrantStack as Od, actionSignerIdentity as Of, undoOperationV2 as Oh, RevisionsFilter as Oi, ProtocolCapability as Ol, reshuffleByTimestamp as Om, Exact as On, ProcessorDispatchResult as Oo, setName as Op, MutationSetModelNameArgs as Or, validateOperations as Os, CreateChildDocumentInput as Ot, HashMismatchError as Ou, PHConnectRenownAdapters as P, SignalResult as Pa, SetOperationNameInputSchema as Pc, AuthAction as Pd, targetDocumentId as Pf, UserActionSigner as Ph, SchemaSetNameAction as Pi, localPeerManifest as Pl, updateHeaderRevision as Pm, IDocument as Pn, TrackedProcessor as Po, setOperationName as Pp, MutationSetOperationErrorDescriptionArgs as Pr, AddOperationInputSchema as Ps, DeleteChangeLogItemAction as Pt, groupDocumentType as Pu, ServiceAction as Q, UpdateRelationshipAction as Qa, isDefinedNonNullAny as Qc, SetGrantAction as Qd, deleteChangeLogItem as Qf, SetModuleDescriptionAction as Qi, baseLoadFromInputVersioned as Ql, createState as Qm, ModuleSpecification as Qn, WebhookEndpointInfo as Qo, appendWithoutApplying as Qp, PartialState as Qr, MoveOperationInputSchema as Qs, DocumentModelAction as Qt, base64UrlToBytes as Qu, PHImageRef as R, SigningParameters as Ra, SetOperationTemplateInputSchema as Rc, AuthRequest as Rd, actionContext as Rf, DEFAULT_RELATIONAL_PROCESSOR_DB_NAME as Rh, SetAuthorNameAction as Ri, peerSupports as Rl, Condition as Rm, ISigner as Rn, IWebhookScope as Ro, setOperationTemplate as Rp, MutationSetOperationReducerArgs as Rr, ConfigEntrySchema as Rs, DeleteDocumentAction as Rt, DocumentModelHeaderSchema as Ru, PHConnectOpenPanel as S, SetOperationScopeInput as Sa, SetModelExtensionInputSchema as Sc, MAX_CONDITION_NODES as Sd, ACTION_SIGNATURE_V2_PREFIX as Sf, OperationWithContext$1 as Sh, ReorderOperationErrorsInput as Si, MARKER_REFUSAL_FEATURE as Sl, parseResultingState as Sm, DocumentOperationsIgnoreMap as Sn, IProcessor as So, setModelDescription as Sp, MutationSetAuthorNameArgs as Sr, isValidOperationNameFormat as Ss, Author as St, AuthAlreadyInitializedError as Su, PHConnectPwaCacheStrategy as T, SetPreferredEditorAction as Ta, SetModuleDescriptionInputSchema as Tc, assertValidGrantUpsert as Td, CanonicalJsonError as Tf, setNameOperation as Th, ReorderStateExamplesAction as Ti, PeerCapability as Tl, readOnly as Tm, EditorDispatch as Tn, IProcessorManager as To, setModelName as Tp, MutationSetModelDescriptionArgs as Tr, validateModuleOperation as Ts, ConfigEntryType as Tt, DowngradeNotSupportedError as Tu, PHRenownPrivyAdapterConfig as U, SubgraphModule as Ua, Set_PreferredEditorSchema as Uc, InitializeAuthActionInput as Ud, addModule as Uf, SetInitialStateInput as Ui, createSignedHeader as Ul, PHDocumentState as Um, LoadFromFile as Un, RouteBody as Uo, updateOperationExample as Up, MutationUpdateChangeLogItemInputArgs as Ur, DeleteOperationExampleInputSchema as Us, DeleteOperationErrorAction as Ut, isDocumentModelDocument as Uu, PHReactorClientMode as V, State as Va, SetStateSchemaInputSchema as Vc, ConditionContext as Vd, actions as Vf, SetAuthorWebsiteInput as Vi, createCopyHeader as Vl, PHAuthState as Vm, IsDocumentOfType as Vn, RouteAuth as Vo, undo as Vp, MutationSetStateSchemaArgs as Vr, DeleteModuleInputSchema as Vs, DeleteModuleInput as Vt, assertIsDocumentModelDocument as Vu, PHRenownRainbowAdapterConfig as W, Undo as Wa, StateSchema as Wc, InitializeAuthActionInputSchema as Wd, addOperation as Wf, SetModelDescriptionAction as Wi, createSignedHeaderForSigner as Wl, PHGroupState as Wm, LoadFromInput as Wn, RouteContext as Wo, updateStateExample as Wp, MutationUpdateOperationExampleArgs as Wr, DeleteOperationInputSchema as Ws, DeleteOperationErrorInput as Wt, isDocumentModelState as Wu, PowerhouseConfig as X, UpdateOperationExampleAction as Xa, UpdateStateExampleInputSchema as Xc, RemoveGrantActionInput as Xd, buildSignedAction as Xf, SetModelNameAction as Xi, BulkArchiveEntry as Xl, createGlobalState as Xm, Maybe as Xn, RouteUser as Xo, PHDocumentMeta as Xp, OperationsByScope as Xr, ManifestSchema as Xs, DocumentAction as Xt, ab2hex as Xu, PathValidation as Y, UpdateChangeLogItemInput as Ya, UpdateOperationExampleInputSchema as Yc, RemoveGrantAction as Yd, buildOperationSignature as Yf, SetModelIdInput as Yi, verify as Yl, createDocumentState as Ym, MappedOperation as Yn, RouteTransport as Yo, PHDocumentHeader as Yp, OperationSpecification as Yr, DocumentSpecificationSchema as Ys, DeleteStateExampleInput as Yt, isDenied as Yu, PowerhousePackage as Z, UpdateOperationExampleInput as Za, definedNonNullAnySchema as Zc, RemoveGrantActionInputSchema as Zd, createAction as Zf, SetModelNameInput as Zi, baseLoadFromInput as Zl, createLocalState as Zm, MinimalBackupData as Zn, ScopedRouteHandle as Zo, addUndo as Zp, PartialRecord as Zr, ModuleSchema as Zs, DocumentDispatch as Zt, base58Decode as Zu, PHConnectDrives as _, SetOperationReducerAction as _a, ScopeStateSchema as _c, GroupPrincipalNotAllowedError as _d, setGrant as _f, v2RequiredProtocolVersions as _h, ReorderModuleOperationsAction as _i, purgeMarkerOperation as _l, mapSkippedOperations as _m, DocumentModelStateAction as _n, IRelationalDbProcessor as _o, reorderOperationExamples as _p, MutationReorderModuleOperationsArgs as _r, findOperationErrorOrThrow as _s, AddRelationshipActionInput as _t, applyDeleteDocumentAction as _u, PHBackground as a, SetOperationDescriptionAction as aa, PowerhouseModulesSchema as ac, HASH_ALGORITHM_SHA1 as ad, applySetGrantAction as af, DEFAULT_SIGNATURE_POLICY as ah, PurgeDocumentActionInput as ai, documentModelStateReducer as al, filterDocumentOperationsResultingState as am, DocumentModelLib as an, ValidationError as ao, moveOperation as ap, MutationAddOperationErrorArgs as ar, WebhookSignatureEncoding as as, Actions as at, getFileBrowser as au, PHConnectInstance as b, SetOperationSchemaInput as ba, SetInitialStateInputSchema as bc, MAX_CAPABILITY_OPERATIONS as bd, TransportSigner as bf, OperationContext as bh, ReorderModulesInput as bi, FeatureCapability as bl, nextSkipNumber as bm, DocumentModelVersioningAction as bn, RelationalDbProcessor as bo, setAuthorWebsite as bp, MutationReorderOperationExamplesArgs as br, getAllOperationNames as bs, AssertIsDocumentOfType as bt, withProtocolVersions as bu, PHConnectAi as c, SetOperationErrorCodeInput as ca, RedoActionInputSchema as cc, HASH_ENCODING_BASE64 as cd, decide as cf, SIGNATURE_PROTOCOL as ch, RedoAction as ci, baseReducer as cl, garbageCollectDocumentOperations as cm, DocumentModelModuleAction as cn, createRelationalDb as co, operationFromAction as cp, MutationDeleteChangeLogItemInputArgs as cr, deletedDocumentId as cs, AddModuleAction as ct, readFileBrowser as cu, PHConnectCompositionEntry as d, SetOperationErrorNameAction as da, ReorderChangeLogItemsInputSchema as dc, documentModelGlobalState as dd, isAuthAction as df, deriveDocumentId as dh, ReducerOptions as di, replayOperations as dl, groupOperationsByScope as dm, DocumentModelOperationErrorAction as dn, relationalDbToQueryBuilder as do, redo as dp, MutationDeleteOperationErrorArgs as dr, ReservedOperationName as ds, AddOperationErrorAction as dt, VersionedReducers as du, SetModuleNameAction as ea, OperationScopeSchema as ec, buildOperationSignatureParams as ed, SetGrantActionInputSchema as ef, defaultBaseState as eh, PhAiToolDescriptor as ei, documentModelModuleReducer as el, baseCreateDocument as em, DocumentModelDocumentModelModule as en, UpdateStateExampleAction as eo, deleteOperation as ep, MoveOperationInput as er, WebhookHashAlgorithm as es, DEFAULT_REGISTRY_URL as et, createMinimalZip as eu, PHConnectDefaultDrive as f, SetOperationErrorNameInput as fa, ReorderModuleOperationsInputSchema as fc, documentModelInitialGlobalState as fd, isDocumentCreator as ff, isDerivedDocumentId as fh, ReleaseNewVersionAction as fi, updateDocument as fl, hashDocumentStateForScope as fm, DocumentModelOperationErrorOperations as fn, DOCUMENT_ID_COLUMNS as fo, releaseNewVersion as fp, MutationDeleteOperationExampleArgs as fr, assertModuleIdUnique as fs, AddOperationErrorInput as ft, VersionedReplayConfig as fu, PHConnectDriveSections as g, SetOperationNameInput as ga, ReorderStateExamplesInputSchema as gc, GrantSchema as gd, resolveSnapshotAuth as gf, signaturePolicyOf as gh, ReorderChangeLogItemsInput as gi, purgeDocumentAction as gl, isUndoRedo as gm, DocumentModelPHState as gn, IRelationalDb as go, reorderOperationErrors as gp, MutationReorderChangeLogItemsInputArgs as gr, findModuleOrThrow as gs, AddRelationshipAction as gt, UpgradeTransition as gu, PHConnectDriveSection as h, SetOperationNameAction as ha, ReorderOperationExamplesInputSchema as hc, AuthAdministrationMissingError as hd, removeGrant as hf, requestedSignaturePolicy as hh, ReorderChangeLogItemsAction as hi, isPurgeMarker as hl, isUndo as hm, DocumentModelOperationOperations as hn, IBaseRelationalDb as ho, reorderModules as hp, MutationRedoArgs as hr, assertOperationIdUnique as hs, AddOperationInput as ht, UpgradeReducer as hu, LogLevels as i, SetNameOperation as ia, PowerhouseModuleSchema as ic, hex2ab as id, applyRemoveGrantAction as if, defaultPHState as ih, PurgeDocumentAction as ii, documentModelReducer as il, diffOperations as im, DocumentModelInput as in, User as io, documentModelActions as ip, MutationAddOperationArgs as ir, WebhookScheme as is, ActionVerificationHandler as it, fetchFileBrowser as iu, PHConnectReactor as j, Set_PreferredEditor as ja, SetOperationErrorDescriptionInputSchema as jc, isPlainValue as jd, hashActionV2 as jf, HashConfig as jh, Scalars as ji, holdReason as jl, sortMappedOperations as jm, HostedEditorProps as jn, ProcessorFilter as jo, setOperationErrorDescription as jp, MutationSetNameArgs as jr, AddModuleInputSchema as js, CreateDocumentAction as jt, InvalidAuthVersionError as ju, PHConnectPwaRuntimeCaching as k, SetStateSchemaInput as ka, SetOperationDescriptionInputSchema as kc, evaluateGrants as kd, actionSigningTarget as kf, ActionSigner as kh, SaveToFile as ki, Supports as kl, reshuffleByTimestampAndIndex as km, FileInput as kn, ProcessorFactory as ko, setOperationDescription as kp, MutationSetModuleDescriptionArgs as kr, validateStateSchemaName as ks, CreateChildDocumentSignal as kt, InvalidActionInputError as ku, PHConnectApp as l, SetOperationErrorDescriptionAction as la, RedoActionSchema as lc, HASH_ENCODING_HEX as ld, evaluate as lf, SIGNATURE_PROTOCOL_V2 as lh, RedoActionInput as li, createReducer as ll, garbageCollectV2 as lm, DocumentModelModuleOperations as ln, hashNamespace as lo, operationFromOperation as lp, MutationDeleteModuleArgs as lr, OPERATION_NAME_PATTERN as ls, AddModuleInput as lt, writeFileBrowser as lu, PHConnectDefaultDriveRemote as m, SetOperationErrorTemplateInput as ma, ReorderOperationErrorsInputSchema as mc, AuthAdministrationLockoutError as md, moveGrant as mf, protocolVersionsFor as mh, RemoveRelationshipActionInput as mi, PurgeMarkerOperation as ml, isNoopOperation as mm, DocumentModelOperationExampleOperations as mn, HashAlgorithms as mo, reorderModuleOperations as mp, MutationMoveOperationArgs as mr, assertOperationExampleIdUnique as ms, AddOperationExampleInput as mt, UpgradeManifest as mu, DrivePreserveStrategy as n, SetNameAction as na, PieceModuleSchema as nc, getUnixTimestamp as nd, applyInitializeAuthAction as nf, defaultGlobalState as nh, PowerhouseModule as ni, documentModelOperationExampleReducer as nl, checkCleanedOperationsIntegrity as nm, DocumentModelHeaderAction as nn, UpgradeDocumentAction as no, deleteOperationExample as np, MutationAddChangeLogItemInputArgs as nr, WebhookReply as ns, ActionSignatureContext as nt, documentModelLoadFromInput as nu, PHBackgroundLayer as o, SetOperationDescriptionInput as oa, PublisherSchema as oc, HASH_ALGORITHM_SHA256 as od, assertAuthPreservedOnDuplicate as of, DocumentIdParams as oh, Query as oi, documentModelStateSchemaReducer as ol, filterDuplicatedOperations as om, DocumentModelLocalState as on, createNamespacedDb as oo, noop as op, MutationAddOperationExampleArgs as or, WebhookSpec as os, AddChangeLogItemAction as ot, isDocumentZip as ou, PHConnectDefaultDriveLocal as p, SetOperationErrorTemplateAction as pa, ReorderModulesInputSchema as pc, documentModelInitialLocalState as pd, mentionedGroupIds as pf, isSignaturePolicy as ph, RemoveRelationshipAction as pi, PURGE_DOCUMENT as pl, isDocumentAction as pm, DocumentModelOperationExampleAction as pn, ExtractProcessorSchemaOrSelf as po, reorderChangeLogItems as pp, MutationDeleteStateExampleArgs as pr, assertOperationErrorIdUnique as ps, AddOperationExampleAction as pt, replayDocumentVersioned as pu, PackageManagerArgs as q, UndoRedoAction as qa, UndoSchema as qc, MoveGrantActionInput as qd, addStateExample as qf, SetModelExtensionInput as qi, sign as ql, createAuthState as qm, MakeOptional as qn, RouteOptions as qo, IntegrityIssueType as qp, OperationErrorSpecification as qr, DocumentModelGlobalStateSchema as qs, DeleteOperationInput as qt, AUTH_VERSION_UNSUPPORTED_REASON as qu, LogLevel as r, SetNameActionInput as ra, PieceModulesSchema as rc, hashBrowser as rd, applyMoveGrantAction as rf, defaultLocalState as rh, Publisher as ri, documentModelOperationReducer as rl, checkOperationsIntegrity as rm, DocumentModelHeaderOperations as rn, UpgradeDocumentActionInput as ro, deleteStateExample as rp, MutationAddModuleArgs as rr, WebhookRequest as rs, ActionSigningHandler as rt, documentModelSaveToFileHandle as ru, PHBackgroundLayers as s, SetOperationErrorCodeAction as sa, PwaConfigSchema as sc, HASH_ALGORITHM_SHA512 as sd, assertAuthScopeActionAllowed as sf, ProtocolVersions as sh, Redo as si, documentModelVersioningReducer as sl, garbageCollect as sm, DocumentModelModule as sn, createNamespacedQueryBuilder as so, operationExampleCreators as sp, MutationAddStateExampleArgs as sr, WebhookVerification as ss, AddChangeLogItemInput as st, parseBulkArchive as su, DrivePreserveStrategies as t, SetModuleNameInput as ta, OperationSpecificationSchema as tc, bytesToBase64Url as td, applyAuthAction as tf, defaultDocumentState as th, PieceModule as ti, documentModelOperationErrorReducer as tl, baseReducerVersion as tm, DocumentModelGlobalState as tn, UpdateStateExampleInput as to, deleteOperationError as tp, Mutation as tr, WebhookPolicy as ts, ActionErrorCallback as tt, createZip as tu, PHConnectBranding as u, SetOperationErrorDescriptionInput as ua, RedoSchema as uc, documentModelFileExtension as ud, initializeAuth as uf, SignaturePolicy$1 as uh, Reducer as ui, processUndoRedo as ul, getDocumentLastModified as um, DocumentModelOperationAction as un, namespaceSchemaOf as uo, operationWithContext as up, MutationDeleteOperationArgs as ur, RESERVED_OPERATION_NAMES as us, AddOperationAction as ut, zipEntries as uu, PHConnectExplorerIcons as v, SetOperationReducerInput as va, SetAuthorNameInputSchema as vc, InvalidGrantError as vd, TransportAction as vf, DocumentOperations as vh, ReorderModuleOperationsInput as vi, purgedProtocolVersions as vl, mapSkippedOperationsV2 as vm, DocumentModelStateOperations as vn, IRelationalQueryBuilder as vo, reorderStateExamples as vp, MutationReorderModulesArgs as vr, findOperationExampleOrThrow as vs, AddStateExampleAction as vt, applyUpgradeDocumentAction as vu, PHConnectPwa as w, SetOperationTemplateInput as wa, SetModelNameInputSchema as wc, assertValidGrant as wd, ActionSigningTarget as wf, redoOperation as wh, ReorderOperationExamplesInput as wi, PEER_MANIFEST_FORMAT as wl, prepareOperations as wm, ENSInfo as wn, IProcessorHostModuleBase as wo, setModelId as wp, MutationSetInitialStateArgs as wr, validateModule as ws, ConfigEntry as wt, AuthPolicyNotPreservedError as wu, PHConnectLoader as x, SetOperationScopeAction as xa, SetModelDescriptionInputSchema as xc, MAX_CONDITION_DEPTH as xd, toTransportAction as xf, OperationOutcome as xh, ReorderOperationErrorsAction as xi, HoldReason as xl, operationsAreEqual as xm, DocumentModelVersioningOperations as xn, RelationalDbProcessorClass as xo, setInitialState as xp, MutationReorderStateExamplesArgs as xr, isReservedOperationName as xs, AssertIsStateOfType as xt, AuthActionNotAllowedError as xu, PHConnectHome as y, SetOperationSchemaAction as ya, SetAuthorWebsiteInputSchema as yc, MAX_AUTH_GRANTS as yd, TransportActionContext as yf, Operation as yh, ReorderModulesAction as yi, DOCUMENT_PURGE_PROTOCOL as yl, merge as ym, DocumentModelUtils as yn, IRelationalQueryMethods as yo, setAuthorName as yp, MutationReorderOperationErrorsArgs as yr, findOperationOrThrow as ys, AddStateExampleInput as yt, computeUpgradeTransitions as yu, PHLength as z, SkipHeaderOperationIndex as za, SetPreferredEditorActionInputSchema as zc, AuthSubject as zd, actionFromAction as zf, PROCESSOR_APPS as zh, SetAuthorNameInput as zi, readPeerManifest as zl, Grant as zm, Incremental as zn, NodeRouteSpec as zo, setPreferredEditor as zp, MutationSetOperationSchemaArgs as zr, ConfigEntryTypeSchema as zs, DeleteDocumentActionInput as zt, DocumentModelPHStateSchema as zu };
4330
+ export {};
4331
+ //# sourceMappingURL=types-BpO4LIKj.d.ts.map