dineway 0.1.9 → 0.1.11

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 (689) hide show
  1. package/README.md +63 -17
  2. package/dist/activity-events-BsMaXdJa.mjs +540 -0
  3. package/dist/allowed-origins-DG86sH8U.mjs +68 -0
  4. package/dist/api/route-utils.d.mts +41 -0
  5. package/dist/api/route-utils.mjs +26 -0
  6. package/dist/api/schemas/index.d.mts +3 -0
  7. package/dist/api/schemas/index.mjs +6 -0
  8. package/dist/api/schemas/setup.d.mts +42 -0
  9. package/dist/api/schemas/setup.mjs +39 -0
  10. package/dist/api-Cmy8Rjk5.mjs +2704 -0
  11. package/dist/api-tokens-Bu3ez1MO.mjs +153 -0
  12. package/dist/api-tokens-DzloJxuh.mjs +3 -0
  13. package/dist/{apply-iVSqz2qs.mjs → apply-Co5imxxT.mjs} +15 -689
  14. package/dist/astro/index.d.mts +10 -6
  15. package/dist/astro/index.mjs +86 -11
  16. package/dist/astro/middleware/auth.d.mts +10 -7
  17. package/dist/astro/middleware/auth.mjs +19 -104
  18. package/dist/astro/middleware/redirect.mjs +24 -14
  19. package/dist/astro/middleware/request-context.mjs +9 -6
  20. package/dist/astro/middleware/setup.mjs +1 -1
  21. package/dist/astro/middleware.mjs +86 -145
  22. package/dist/astro/routes/PluginRegistry.d.mts +14 -0
  23. package/dist/astro/routes/PluginRegistry.mjs +24 -0
  24. package/dist/astro/routes/api/admin/allowed-domains/_domain_.d.mts +14 -0
  25. package/dist/astro/routes/api/admin/allowed-domains/_domain_.mjs +65 -0
  26. package/dist/astro/routes/api/admin/allowed-domains/index.d.mts +14 -0
  27. package/dist/astro/routes/api/admin/allowed-domains/index.mjs +65 -0
  28. package/dist/astro/routes/api/admin/api-tokens/_id_.d.mts +10 -0
  29. package/dist/astro/routes/api/admin/api-tokens/_id_.mjs +33 -0
  30. package/dist/astro/routes/api/admin/api-tokens/index.d.mts +16 -0
  31. package/dist/astro/routes/api/admin/api-tokens/index.mjs +59 -0
  32. package/dist/astro/routes/api/admin/briefing.d.mts +7 -0
  33. package/dist/astro/routes/api/admin/briefing.mjs +71 -0
  34. package/dist/astro/routes/api/admin/bylines/_id_/index.d.mts +9 -0
  35. package/dist/astro/routes/api/admin/bylines/_id_/index.mjs +74 -0
  36. package/dist/astro/routes/api/admin/bylines/index.d.mts +8 -0
  37. package/dist/astro/routes/api/admin/bylines/index.mjs +61 -0
  38. package/dist/astro/routes/api/admin/comments/_id_/status.d.mts +7 -0
  39. package/dist/astro/routes/api/admin/comments/_id_/status.mjs +80 -0
  40. package/dist/astro/routes/api/admin/comments/_id_.d.mts +14 -0
  41. package/dist/astro/routes/api/admin/comments/_id_.mjs +46 -0
  42. package/dist/astro/routes/api/admin/comments/bulk.d.mts +7 -0
  43. package/dist/astro/routes/api/admin/comments/bulk.mjs +36 -0
  44. package/dist/astro/routes/api/admin/comments/counts.d.mts +7 -0
  45. package/dist/astro/routes/api/admin/comments/counts.mjs +24 -0
  46. package/dist/astro/routes/api/admin/comments/index.d.mts +10 -0
  47. package/dist/astro/routes/api/admin/comments/index.mjs +40 -0
  48. package/dist/astro/routes/api/admin/context/_id_/history.d.mts +7 -0
  49. package/dist/astro/routes/api/admin/context/_id_/history.mjs +45 -0
  50. package/dist/astro/routes/api/admin/context/_id_/index.d.mts +7 -0
  51. package/dist/astro/routes/api/admin/context/_id_/index.mjs +45 -0
  52. package/dist/astro/routes/api/admin/context/_id_/review.d.mts +7 -0
  53. package/dist/astro/routes/api/admin/context/_id_/review.mjs +60 -0
  54. package/dist/astro/routes/api/admin/context/_id_/supersede.d.mts +7 -0
  55. package/dist/astro/routes/api/admin/context/_id_/supersede.mjs +63 -0
  56. package/dist/astro/routes/api/admin/context/diff.d.mts +7 -0
  57. package/dist/astro/routes/api/admin/context/diff.mjs +49 -0
  58. package/dist/astro/routes/api/admin/context/index.d.mts +8 -0
  59. package/dist/astro/routes/api/admin/context/index.mjs +71 -0
  60. package/dist/astro/routes/api/admin/context/stale.d.mts +7 -0
  61. package/dist/astro/routes/api/admin/context/stale.mjs +49 -0
  62. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.d.mts +7 -0
  63. package/dist/astro/routes/api/admin/hitl-requests/_id_/index.mjs +51 -0
  64. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.d.mts +7 -0
  65. package/dist/astro/routes/api/admin/hitl-requests/_id_/resolve.mjs +67 -0
  66. package/dist/astro/routes/api/admin/hitl-requests/index.d.mts +7 -0
  67. package/dist/astro/routes/api/admin/hitl-requests/index.mjs +55 -0
  68. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.d.mts +7 -0
  69. package/dist/astro/routes/api/admin/hooks/exclusive/_hookName_.mjs +98 -0
  70. package/dist/astro/routes/api/admin/hooks/exclusive/index.d.mts +7 -0
  71. package/dist/astro/routes/api/admin/hooks/exclusive/index.mjs +33 -0
  72. package/dist/astro/routes/api/admin/oauth-clients/_id_.d.mts +18 -0
  73. package/dist/astro/routes/api/admin/oauth-clients/_id_.mjs +79 -0
  74. package/dist/astro/routes/api/admin/oauth-clients/index.d.mts +14 -0
  75. package/dist/astro/routes/api/admin/oauth-clients/index.mjs +58 -0
  76. package/dist/astro/routes/api/admin/plugins/_id_/disable.d.mts +7 -0
  77. package/dist/astro/routes/api/admin/plugins/_id_/disable.mjs +89 -0
  78. package/dist/astro/routes/api/admin/plugins/_id_/enable.d.mts +7 -0
  79. package/dist/astro/routes/api/admin/plugins/_id_/enable.mjs +89 -0
  80. package/dist/astro/routes/api/admin/plugins/_id_/index.d.mts +7 -0
  81. package/dist/astro/routes/api/admin/plugins/_id_/index.mjs +54 -0
  82. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.d.mts +7 -0
  83. package/dist/astro/routes/api/admin/plugins/_id_/uninstall.mjs +98 -0
  84. package/dist/astro/routes/api/admin/plugins/_id_/update.d.mts +7 -0
  85. package/dist/astro/routes/api/admin/plugins/_id_/update.mjs +131 -0
  86. package/dist/astro/routes/api/admin/plugins/index.d.mts +7 -0
  87. package/dist/astro/routes/api/admin/plugins/index.mjs +52 -0
  88. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.d.mts +7 -0
  89. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/icon.mjs +36 -0
  90. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.d.mts +7 -0
  91. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/index.mjs +54 -0
  92. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.d.mts +7 -0
  93. package/dist/astro/routes/api/admin/plugins/marketplace/_id_/install.mjs +128 -0
  94. package/dist/astro/routes/api/admin/plugins/marketplace/index.d.mts +7 -0
  95. package/dist/astro/routes/api/admin/plugins/marketplace/index.mjs +61 -0
  96. package/dist/astro/routes/api/admin/plugins/updates.d.mts +7 -0
  97. package/dist/astro/routes/api/admin/plugins/updates.mjs +52 -0
  98. package/dist/astro/routes/api/admin/review-requests/_id_/index.d.mts +7 -0
  99. package/dist/astro/routes/api/admin/review-requests/_id_/index.mjs +26 -0
  100. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.d.mts +7 -0
  101. package/dist/astro/routes/api/admin/review-requests/_id_/resolve.mjs +97 -0
  102. package/dist/astro/routes/api/admin/review-requests/index.d.mts +7 -0
  103. package/dist/astro/routes/api/admin/review-requests/index.mjs +31 -0
  104. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.d.mts +7 -0
  105. package/dist/astro/routes/api/admin/themes/marketplace/_id_/index.mjs +54 -0
  106. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.d.mts +7 -0
  107. package/dist/astro/routes/api/admin/themes/marketplace/_id_/thumbnail.mjs +36 -0
  108. package/dist/astro/routes/api/admin/themes/marketplace/index.d.mts +7 -0
  109. package/dist/astro/routes/api/admin/themes/marketplace/index.mjs +70 -0
  110. package/dist/astro/routes/api/admin/users/_id_/disable.d.mts +7 -0
  111. package/dist/astro/routes/api/admin/users/_id_/disable.mjs +38 -0
  112. package/dist/astro/routes/api/admin/users/_id_/enable.d.mts +7 -0
  113. package/dist/astro/routes/api/admin/users/_id_/enable.mjs +29 -0
  114. package/dist/astro/routes/api/admin/users/_id_/index.d.mts +8 -0
  115. package/dist/astro/routes/api/admin/users/_id_/index.mjs +104 -0
  116. package/dist/astro/routes/api/admin/users/_id_/send-recovery.d.mts +7 -0
  117. package/dist/astro/routes/api/admin/users/_id_/send-recovery.mjs +43 -0
  118. package/dist/astro/routes/api/admin/users/index.d.mts +7 -0
  119. package/dist/astro/routes/api/admin/users/index.mjs +54 -0
  120. package/dist/astro/routes/api/auth/dev-bypass.d.mts +8 -0
  121. package/dist/astro/routes/api/auth/dev-bypass.mjs +81 -0
  122. package/dist/astro/routes/api/auth/invite/accept.d.mts +7 -0
  123. package/dist/astro/routes/api/auth/invite/accept.mjs +31 -0
  124. package/dist/astro/routes/api/auth/invite/complete.d.mts +7 -0
  125. package/dist/astro/routes/api/auth/invite/complete.mjs +54 -0
  126. package/dist/astro/routes/api/auth/invite/index.d.mts +7 -0
  127. package/dist/astro/routes/api/auth/invite/index.mjs +51 -0
  128. package/dist/astro/routes/api/auth/invite/register-options.d.mts +7 -0
  129. package/dist/astro/routes/api/auth/invite/register-options.mjs +44 -0
  130. package/dist/astro/routes/api/auth/logout.d.mts +7 -0
  131. package/dist/astro/routes/api/auth/logout.mjs +24 -0
  132. package/dist/astro/routes/api/auth/magic-link/send.d.mts +7 -0
  133. package/dist/astro/routes/api/auth/magic-link/send.mjs +48 -0
  134. package/dist/astro/routes/api/auth/magic-link/verify.d.mts +7 -0
  135. package/dist/astro/routes/api/auth/magic-link/verify.mjs +32 -0
  136. package/dist/astro/routes/api/auth/me.d.mts +13 -0
  137. package/dist/astro/routes/api/auth/me.mjs +41 -0
  138. package/dist/astro/routes/api/auth/mode.d.mts +7 -0
  139. package/dist/astro/routes/api/auth/mode.mjs +28 -0
  140. package/dist/astro/routes/api/auth/oauth/_provider_/callback.d.mts +7 -0
  141. package/dist/astro/routes/api/auth/oauth/_provider_/callback.mjs +114 -0
  142. package/dist/astro/routes/api/auth/oauth/_provider_.d.mts +7 -0
  143. package/dist/astro/routes/api/auth/oauth/_provider_.mjs +58 -0
  144. package/dist/astro/routes/api/auth/passkey/_id_.d.mts +14 -0
  145. package/dist/astro/routes/api/auth/passkey/_id_.mjs +62 -0
  146. package/dist/astro/routes/api/auth/passkey/index.d.mts +7 -0
  147. package/dist/astro/routes/api/auth/passkey/index.mjs +25 -0
  148. package/dist/astro/routes/api/auth/passkey/options.d.mts +7 -0
  149. package/dist/astro/routes/api/auth/passkey/options.mjs +46 -0
  150. package/dist/astro/routes/api/auth/passkey/register/options.d.mts +7 -0
  151. package/dist/astro/routes/api/auth/passkey/register/options.mjs +44 -0
  152. package/dist/astro/routes/api/auth/passkey/register/verify.d.mts +7 -0
  153. package/dist/astro/routes/api/auth/passkey/register/verify.mjs +59 -0
  154. package/dist/astro/routes/api/auth/passkey/verify.d.mts +7 -0
  155. package/dist/astro/routes/api/auth/passkey/verify.mjs +47 -0
  156. package/dist/astro/routes/api/auth/signup/complete.d.mts +7 -0
  157. package/dist/astro/routes/api/auth/signup/complete.mjs +55 -0
  158. package/dist/astro/routes/api/auth/signup/request.d.mts +7 -0
  159. package/dist/astro/routes/api/auth/signup/request.mjs +44 -0
  160. package/dist/astro/routes/api/auth/signup/verify.d.mts +7 -0
  161. package/dist/astro/routes/api/auth/signup/verify.mjs +32 -0
  162. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.d.mts +14 -0
  163. package/dist/astro/routes/api/comments/_collection_/_contentId_/index.mjs +193 -0
  164. package/dist/astro/routes/api/content/_collection_/_id_/compare.d.mts +7 -0
  165. package/dist/astro/routes/api/content/_collection_/_id_/compare.mjs +17 -0
  166. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.d.mts +7 -0
  167. package/dist/astro/routes/api/content/_collection_/_id_/discard-draft.mjs +36 -0
  168. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.d.mts +7 -0
  169. package/dist/astro/routes/api/content/_collection_/_id_/duplicate.mjs +39 -0
  170. package/dist/astro/routes/api/content/_collection_/_id_/permanent.d.mts +7 -0
  171. package/dist/astro/routes/api/content/_collection_/_id_/permanent.mjs +31 -0
  172. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.d.mts +7 -0
  173. package/dist/astro/routes/api/content/_collection_/_id_/preview-url.mjs +78 -0
  174. package/dist/astro/routes/api/content/_collection_/_id_/publish.d.mts +7 -0
  175. package/dist/astro/routes/api/content/_collection_/_id_/publish.mjs +92 -0
  176. package/dist/astro/routes/api/content/_collection_/_id_/restore.d.mts +7 -0
  177. package/dist/astro/routes/api/content/_collection_/_id_/restore.mjs +36 -0
  178. package/dist/astro/routes/api/content/_collection_/_id_/revisions.d.mts +7 -0
  179. package/dist/astro/routes/api/content/_collection_/_id_/revisions.mjs +19 -0
  180. package/dist/astro/routes/api/content/_collection_/_id_/schedule.d.mts +8 -0
  181. package/dist/astro/routes/api/content/_collection_/_id_/schedule.mjs +75 -0
  182. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.d.mts +14 -0
  183. package/dist/astro/routes/api/content/_collection_/_id_/terms/_taxonomy_.mjs +85 -0
  184. package/dist/astro/routes/api/content/_collection_/_id_/translations.d.mts +7 -0
  185. package/dist/astro/routes/api/content/_collection_/_id_/translations.mjs +40 -0
  186. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.d.mts +7 -0
  187. package/dist/astro/routes/api/content/_collection_/_id_/unpublish.mjs +36 -0
  188. package/dist/astro/routes/api/content/_collection_/_id_.d.mts +9 -0
  189. package/dist/astro/routes/api/content/_collection_/_id_.mjs +114 -0
  190. package/dist/astro/routes/api/content/_collection_/index.d.mts +8 -0
  191. package/dist/astro/routes/api/content/_collection_/index.mjs +74 -0
  192. package/dist/astro/routes/api/content/_collection_/trash.d.mts +7 -0
  193. package/dist/astro/routes/api/content/_collection_/trash.mjs +23 -0
  194. package/dist/astro/routes/api/dashboard.d.mts +7 -0
  195. package/dist/astro/routes/api/dashboard.mjs +26 -0
  196. package/dist/astro/routes/api/dev/emails.d.mts +8 -0
  197. package/dist/astro/routes/api/dev/emails.mjs +17 -0
  198. package/dist/astro/routes/api/health.d.mts +7 -0
  199. package/dist/astro/routes/api/health.mjs +34 -0
  200. package/dist/astro/routes/api/import/probe.d.mts +17 -0
  201. package/dist/astro/routes/api/import/probe.mjs +33 -0
  202. package/dist/astro/routes/api/import/wordpress/analyze.d.mts +87 -0
  203. package/dist/astro/routes/api/import/wordpress/analyze.mjs +305 -0
  204. package/dist/astro/routes/api/import/wordpress/execute.d.mts +37 -0
  205. package/dist/astro/routes/api/import/wordpress/execute.mjs +197 -0
  206. package/dist/astro/routes/api/import/wordpress/media.d.mts +35 -0
  207. package/dist/astro/routes/api/import/wordpress/media.mjs +222 -0
  208. package/dist/astro/routes/api/import/wordpress/prepare.d.mts +19 -0
  209. package/dist/astro/routes/api/import/wordpress/prepare.mjs +155 -0
  210. package/dist/astro/routes/api/import/wordpress/rewrite-urls.d.mts +21 -0
  211. package/dist/astro/routes/api/import/wordpress/rewrite-urls.mjs +289 -0
  212. package/dist/astro/routes/api/import/wordpress-plugin/analyze.d.mts +15 -0
  213. package/dist/astro/routes/api/import/wordpress-plugin/analyze.mjs +69 -0
  214. package/dist/astro/routes/api/import/wordpress-plugin/callback.d.mts +7 -0
  215. package/dist/astro/routes/api/import/wordpress-plugin/callback.mjs +28 -0
  216. package/dist/astro/routes/api/import/wordpress-plugin/execute.d.mts +19 -0
  217. package/dist/astro/routes/api/import/wordpress-plugin/execute.mjs +268 -0
  218. package/dist/astro/routes/api/manifest.d.mts +7 -0
  219. package/dist/astro/routes/api/manifest.mjs +50 -0
  220. package/dist/astro/routes/api/mcp.d.mts +15 -0
  221. package/dist/astro/routes/api/mcp.mjs +2700 -0
  222. package/dist/astro/routes/api/media/_id_/confirm.d.mts +10 -0
  223. package/dist/astro/routes/api/media/_id_/confirm.mjs +59 -0
  224. package/dist/astro/routes/api/media/_id_.d.mts +22 -0
  225. package/dist/astro/routes/api/media/_id_.mjs +81 -0
  226. package/dist/astro/routes/api/media/file/_...key_.d.mts +7 -0
  227. package/dist/astro/routes/api/media/file/_...key_.mjs +49 -0
  228. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.d.mts +14 -0
  229. package/dist/astro/routes/api/media/providers/_providerId_/_itemId_.mjs +49 -0
  230. package/dist/astro/routes/api/media/providers/_providerId_/index.d.mts +14 -0
  231. package/dist/astro/routes/api/media/providers/_providerId_/index.mjs +72 -0
  232. package/dist/astro/routes/api/media/providers/index.d.mts +10 -0
  233. package/dist/astro/routes/api/media/providers/index.mjs +18 -0
  234. package/dist/astro/routes/api/media/upload-url.d.mts +10 -0
  235. package/dist/astro/routes/api/media/upload-url.mjs +82 -0
  236. package/dist/astro/routes/api/media.d.mts +16 -0
  237. package/dist/astro/routes/api/media.mjs +137 -0
  238. package/dist/astro/routes/api/menus/_name_/items.d.mts +9 -0
  239. package/{src/astro/routes/api/menus/[name]/items.ts → dist/astro/routes/api/menus/_name_/items.mjs} +63 -105
  240. package/dist/astro/routes/api/menus/_name_/reorder.d.mts +7 -0
  241. package/dist/astro/routes/api/menus/_name_/reorder.mjs +77 -0
  242. package/dist/astro/routes/api/menus/_name_.d.mts +9 -0
  243. package/dist/astro/routes/api/menus/_name_.mjs +123 -0
  244. package/dist/astro/routes/api/menus/index.d.mts +8 -0
  245. package/dist/astro/routes/api/menus/index.mjs +84 -0
  246. package/dist/astro/routes/api/oauth/authorize.d.mts +8 -0
  247. package/dist/astro/routes/api/oauth/authorize.mjs +265 -0
  248. package/dist/astro/routes/api/oauth/device/authorize.d.mts +7 -0
  249. package/dist/astro/routes/api/oauth/device/authorize.mjs +30 -0
  250. package/dist/astro/routes/api/oauth/device/code.d.mts +7 -0
  251. package/dist/astro/routes/api/oauth/device/code.mjs +34 -0
  252. package/dist/astro/routes/api/oauth/device/token.d.mts +7 -0
  253. package/dist/astro/routes/api/oauth/device/token.mjs +45 -0
  254. package/dist/astro/routes/api/oauth/register.d.mts +8 -0
  255. package/dist/astro/routes/api/oauth/register.mjs +115 -0
  256. package/dist/astro/routes/api/oauth/token/refresh.d.mts +7 -0
  257. package/dist/astro/routes/api/oauth/token/refresh.mjs +28 -0
  258. package/dist/astro/routes/api/oauth/token/revoke.d.mts +7 -0
  259. package/dist/astro/routes/api/oauth/token/revoke.mjs +25 -0
  260. package/dist/astro/routes/api/oauth/token.d.mts +8 -0
  261. package/dist/astro/routes/api/oauth/token.mjs +138 -0
  262. package/dist/astro/routes/api/openapi.json.d.mts +7 -0
  263. package/dist/astro/routes/api/openapi.json.mjs +2638 -0
  264. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.d.mts +11 -0
  265. package/dist/astro/routes/api/plugins/_pluginId_/_...path_.mjs +77 -0
  266. package/dist/astro/routes/api/redirects/404s/index.d.mts +9 -0
  267. package/dist/astro/routes/api/redirects/404s/index.mjs +62 -0
  268. package/dist/astro/routes/api/redirects/404s/summary.d.mts +7 -0
  269. package/dist/astro/routes/api/redirects/404s/summary.mjs +34 -0
  270. package/dist/astro/routes/api/redirects/_id_.d.mts +9 -0
  271. package/dist/astro/routes/api/redirects/_id_.mjs +152 -0
  272. package/dist/astro/routes/api/redirects/index.d.mts +8 -0
  273. package/dist/astro/routes/api/redirects/index.mjs +97 -0
  274. package/dist/astro/routes/api/revisions/_revisionId_/index.d.mts +7 -0
  275. package/dist/astro/routes/api/revisions/_revisionId_/index.mjs +16 -0
  276. package/dist/astro/routes/api/revisions/_revisionId_/restore.d.mts +7 -0
  277. package/dist/astro/routes/api/revisions/_revisionId_/restore.mjs +23 -0
  278. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.d.mts +9 -0
  279. package/dist/astro/routes/api/schema/collections/_slug_/fields/_fieldSlug_.mjs +98 -0
  280. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.d.mts +8 -0
  281. package/dist/astro/routes/api/schema/collections/_slug_/fields/index.mjs +80 -0
  282. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.d.mts +7 -0
  283. package/dist/astro/routes/api/schema/collections/_slug_/fields/reorder.mjs +67 -0
  284. package/dist/astro/routes/api/schema/collections/_slug_/index.d.mts +9 -0
  285. package/dist/astro/routes/api/schema/collections/_slug_/index.mjs +97 -0
  286. package/dist/astro/routes/api/schema/collections/index.d.mts +8 -0
  287. package/dist/astro/routes/api/schema/collections/index.mjs +77 -0
  288. package/dist/astro/routes/api/schema/index.d.mts +7 -0
  289. package/dist/astro/routes/api/schema/index.mjs +79 -0
  290. package/dist/astro/routes/api/schema/orphans/_slug_.d.mts +7 -0
  291. package/dist/astro/routes/api/schema/orphans/_slug_.mjs +58 -0
  292. package/dist/astro/routes/api/schema/orphans/index.d.mts +7 -0
  293. package/dist/astro/routes/api/schema/orphans/index.mjs +53 -0
  294. package/dist/astro/routes/api/search/enable.d.mts +15 -0
  295. package/dist/astro/routes/api/search/enable.mjs +55 -0
  296. package/dist/astro/routes/api/search/index.d.mts +16 -0
  297. package/dist/astro/routes/api/search/index.mjs +52 -0
  298. package/dist/astro/routes/api/search/rebuild.d.mts +13 -0
  299. package/dist/astro/routes/api/search/rebuild.mjs +48 -0
  300. package/dist/astro/routes/api/search/stats.d.mts +10 -0
  301. package/dist/astro/routes/api/search/stats.mjs +28 -0
  302. package/dist/astro/routes/api/search/suggest.d.mts +15 -0
  303. package/dist/astro/routes/api/search/suggest.mjs +43 -0
  304. package/dist/astro/routes/api/sections/_slug_.d.mts +9 -0
  305. package/dist/astro/routes/api/sections/_slug_.mjs +156 -0
  306. package/dist/astro/routes/api/sections/index.d.mts +8 -0
  307. package/dist/astro/routes/api/sections/index.mjs +99 -0
  308. package/dist/astro/routes/api/settings/email.d.mts +17 -0
  309. package/dist/astro/routes/api/settings/email.mjs +102 -0
  310. package/dist/astro/routes/api/settings.d.mts +20 -0
  311. package/dist/astro/routes/api/settings.mjs +101 -0
  312. package/dist/astro/routes/api/setup/admin-verify.d.mts +7 -0
  313. package/dist/astro/routes/api/setup/admin-verify.mjs +67 -0
  314. package/dist/astro/routes/api/setup/admin.d.mts +7 -0
  315. package/dist/astro/routes/api/setup/admin.mjs +68 -0
  316. package/dist/astro/routes/api/setup/dev-bypass.d.mts +8 -0
  317. package/dist/astro/routes/api/setup/dev-bypass.mjs +137 -0
  318. package/dist/astro/routes/api/setup/dev-reset.d.mts +7 -0
  319. package/dist/astro/routes/api/setup/dev-reset.mjs +22 -0
  320. package/dist/astro/routes/api/setup/index.d.mts +7 -0
  321. package/dist/astro/routes/api/setup/index.mjs +93 -0
  322. package/dist/astro/routes/api/setup/status.d.mts +7 -0
  323. package/dist/astro/routes/api/setup/status.mjs +57 -0
  324. package/dist/astro/routes/api/snapshot.d.mts +7 -0
  325. package/dist/astro/routes/api/snapshot.mjs +227 -0
  326. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.d.mts +18 -0
  327. package/dist/astro/routes/api/taxonomies/_name_/terms/_slug_.mjs +189 -0
  328. package/dist/astro/routes/api/taxonomies/_name_/terms/index.d.mts +14 -0
  329. package/dist/astro/routes/api/taxonomies/_name_/terms/index.mjs +113 -0
  330. package/dist/astro/routes/api/taxonomies/index.d.mts +14 -0
  331. package/dist/astro/routes/api/taxonomies/index.mjs +103 -0
  332. package/dist/astro/routes/api/themes/preview.d.mts +7 -0
  333. package/dist/astro/routes/api/themes/preview.mjs +47 -0
  334. package/dist/astro/routes/api/typegen.d.mts +17 -0
  335. package/dist/astro/routes/api/typegen.mjs +75 -0
  336. package/dist/astro/routes/api/well-known/auth.d.mts +7 -0
  337. package/dist/astro/routes/api/well-known/auth.mjs +42 -0
  338. package/dist/astro/routes/api/well-known/oauth-authorization-server.d.mts +7 -0
  339. package/dist/astro/routes/api/well-known/oauth-authorization-server.mjs +33 -0
  340. package/dist/astro/routes/api/well-known/oauth-protected-resource.d.mts +7 -0
  341. package/dist/astro/routes/api/well-known/oauth-protected-resource.mjs +21 -0
  342. package/dist/astro/routes/api/widget-areas/_name_/reorder.d.mts +7 -0
  343. package/dist/astro/routes/api/widget-areas/_name_/reorder.mjs +88 -0
  344. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.d.mts +8 -0
  345. package/dist/astro/routes/api/widget-areas/_name_/widgets/_id_.mjs +158 -0
  346. package/dist/astro/routes/api/widget-areas/_name_/widgets.d.mts +7 -0
  347. package/dist/astro/routes/api/widget-areas/_name_/widgets.mjs +104 -0
  348. package/dist/astro/routes/api/widget-areas/_name_.d.mts +8 -0
  349. package/dist/astro/routes/api/widget-areas/_name_.mjs +99 -0
  350. package/dist/astro/routes/api/widget-areas/index.d.mts +8 -0
  351. package/dist/astro/routes/api/widget-areas/index.mjs +108 -0
  352. package/dist/astro/routes/api/widget-components.d.mts +7 -0
  353. package/dist/astro/routes/api/widget-components.mjs +15 -0
  354. package/dist/astro/routes/robots.txt.d.mts +7 -0
  355. package/dist/astro/routes/robots.txt.mjs +60 -0
  356. package/dist/astro/routes/sitemap-_collection_.xml.d.mts +7 -0
  357. package/dist/astro/routes/sitemap-_collection_.xml.mjs +70 -0
  358. package/dist/astro/routes/sitemap.xml.d.mts +7 -0
  359. package/dist/astro/routes/sitemap.xml.mjs +63 -0
  360. package/dist/astro/types.d.mts +41 -9
  361. package/dist/auth/providers/github-admin.d.mts +9 -0
  362. package/dist/auth/providers/github-admin.mjs +27 -0
  363. package/dist/auth/providers/github.d.mts +12 -0
  364. package/dist/auth/providers/github.mjs +17 -0
  365. package/dist/auth/providers/google-admin.d.mts +9 -0
  366. package/dist/auth/providers/google-admin.mjs +43 -0
  367. package/dist/auth/providers/google.d.mts +12 -0
  368. package/dist/auth/providers/google.mjs +17 -0
  369. package/dist/auth-control-guard-DKUe_1oa.mjs +13 -0
  370. package/dist/authorize-BBj8C6Y8.mjs +36 -0
  371. package/dist/briefing-BrXCuMEE.mjs +1294 -0
  372. package/dist/briefing-ClWw4mc9.mjs +29 -0
  373. package/dist/{byline-OhH2dlRu.mjs → byline-naZxOPSa.mjs} +3 -3
  374. package/dist/{bylines-BGpD9_hy.mjs → bylines-BcOPh6Ej.mjs} +20 -53
  375. package/dist/bylines-HfUKum_j.d.mts +2023 -0
  376. package/dist/{cache-BdSY-gQN.mjs → cache-DEbQ13c9.mjs} +21 -11
  377. package/dist/challenge-store-DHMgBGOq.mjs +48 -0
  378. package/dist/cli/index.mjs +142 -22
  379. package/dist/client/external-auth-headers.d.mts +1 -1
  380. package/dist/client/index.d.mts +1 -1
  381. package/dist/client/index.mjs +3 -3
  382. package/dist/comment-DFO-gWDH.mjs +246 -0
  383. package/dist/comments-Gy3zLBaP.mjs +186 -0
  384. package/dist/components-DND2rd3D.mjs +107 -0
  385. package/dist/{content-DWi4d0rT.mjs → content-CyLkb-qH.mjs} +33 -44
  386. package/dist/context-bE5Kyvcj.mjs +184 -0
  387. package/dist/context-nxMyOe3p.mjs +849 -0
  388. package/dist/context-route-helpers-D-6uCQ0S.mjs +45 -0
  389. package/dist/context-types-C-LwdAxx.mjs +23 -0
  390. package/dist/cron-DGzVTtJp.mjs +263 -0
  391. package/dist/dashboard-DqnYU8EU.mjs +120 -0
  392. package/dist/db/index.d.mts +3 -3
  393. package/dist/db/libsql.d.mts +1 -1
  394. package/dist/db/libsql.mjs +3 -3
  395. package/dist/db/postgres.d.mts +1 -1
  396. package/dist/db/sqlite.d.mts +1 -1
  397. package/dist/db/sqlite.mjs +1 -2
  398. package/dist/device-flow-7AhWNwCK.mjs +487 -0
  399. package/dist/email-console-CgLVZbcn.mjs +36 -0
  400. package/dist/entity-aliases-C0v-yNET.mjs +51 -0
  401. package/dist/error-DEGjx2Xw.mjs +435 -0
  402. package/dist/escape-mNZr4t2A.mjs +8 -0
  403. package/dist/experimental-workflows-DldxJlqV.mjs +38 -0
  404. package/dist/fts-manager-B1pTNEG_.mjs +297 -0
  405. package/dist/hash-CDX7M0ze.mjs +32 -0
  406. package/dist/hitl-requests-Bx3Bkk9l.mjs +118 -0
  407. package/dist/hitl-route-helpers-DMmJRS7B.mjs +96 -0
  408. package/dist/import-DD3f2jkc.mjs +243 -0
  409. package/dist/import-DVZcYlDp.mjs +1323 -0
  410. package/dist/index-CkljPf5F.d.mts +227 -0
  411. package/dist/index.d.mts +15 -11
  412. package/dist/index.mjs +60 -22
  413. package/dist/{loader-sMG4TZ-u.mjs → loader-PZnPxFLc.mjs} +42 -5
  414. package/dist/{manifest-schema-D1MSVnoI.mjs → manifest-schema-DYoCQ5np.mjs} +22 -10
  415. package/dist/media/index.d.mts +1 -1
  416. package/dist/media/index.mjs +2 -1
  417. package/dist/media/local-runtime.d.mts +11 -7
  418. package/dist/media/local-runtime.mjs +3 -3
  419. package/dist/{media-DMTr80Gv.mjs → media-_7Fxdu45.mjs} +1 -1
  420. package/dist/menus-BacxVCCo.mjs +312 -0
  421. package/dist/menus-CrzHokKj.mjs +3502 -0
  422. package/dist/normalize-C49G_o1k.mjs +126 -0
  423. package/dist/oauth-authorization-C1qiw4hd.mjs +283 -0
  424. package/dist/oauth-clients-CvWatf5p.mjs +298 -0
  425. package/dist/oauth-state-store-hSdzxsEe.mjs +48 -0
  426. package/dist/oauth-user-lookup-B4OcmsLV.mjs +25 -0
  427. package/dist/options-z8VVg1Ll.mjs +114 -0
  428. package/dist/page/index.d.mts +2 -2
  429. package/dist/parse-BeQXIt1U.mjs +88 -0
  430. package/dist/passkey-config-Daqs5fjq.mjs +42 -0
  431. package/dist/{patterns-CrCYkMBb.mjs → patterns-K0DLqWir.mjs} +53 -1
  432. package/dist/{placeholder-Cp8g5Emj.mjs → placeholder-C2P5fKa4.mjs} +1 -126
  433. package/dist/plugins/adapt-sandbox-entry.d.mts +9 -5
  434. package/dist/plugins/adapt-sandbox-entry.mjs +4 -4
  435. package/dist/preview-C_4DyVox.mjs +788 -0
  436. package/dist/public-url-BB_umF5G.mjs +71 -0
  437. package/dist/{query-kDmwCsHh.mjs → query-RiobVwB5.mjs} +93 -19
  438. package/dist/rate-limit-CbJoj_fT.mjs +112 -0
  439. package/dist/{redirect-DnEWAkVg.mjs → redirect-CGl64yOX.mjs} +9 -5
  440. package/dist/redirect-ClSmMOtC.mjs +16 -0
  441. package/dist/redirects-B69T59hK.mjs +499 -0
  442. package/dist/redirects-CqaxraTO.mjs +1070 -0
  443. package/dist/{registry-C0zjeB9P.mjs → registry-C-_hxLqa.mjs} +26 -294
  444. package/dist/request-meta-Bd0mQfiS.mjs +130 -0
  445. package/dist/review-requests-C2DIHwlJ.mjs +148 -0
  446. package/dist/review-requests-DIyjw-K_.mjs +79 -0
  447. package/dist/{runner-CFI6B6J2.d.mts → runner-9eIQXuc2.d.mts} +1 -1
  448. package/dist/{index-yvc6E_17.d.mts → runtime-C4-7y7xK.d.mts} +1539 -2007
  449. package/dist/runtime.d.mts +10 -6
  450. package/dist/runtime.mjs +3 -3
  451. package/dist/schema-BNpI53of.mjs +40 -0
  452. package/dist/search-DM6CVti3.mjs +337 -0
  453. package/dist/secrets-dI8zzTV7.mjs +160 -0
  454. package/dist/sections-DZFyAQXd.mjs +338 -0
  455. package/dist/seed/index.d.mts +2 -2
  456. package/dist/seed/index.mjs +18 -13
  457. package/dist/seo/index.d.mts +1 -1
  458. package/dist/seo-BBgTCOYU.mjs +85 -0
  459. package/dist/seo-CUQctrog.mjs +129 -0
  460. package/dist/service-CSfcQguB.mjs +194 -0
  461. package/dist/settings-4XnpVMOS.mjs +223 -0
  462. package/dist/settings-Bw93cLfe.mjs +50 -0
  463. package/dist/setup-complete-DidsDQ1e.mjs +21 -0
  464. package/dist/setup-nonce-pml1PMKo.mjs +17 -0
  465. package/dist/sidecar-client-vzwV98K4.mjs +66 -0
  466. package/dist/site-activity-B8FjLIVh.mjs +104 -0
  467. package/dist/site-context-Bpu_Paur.mjs +4122 -0
  468. package/dist/site-url-CYIcO0Tj.mjs +12 -0
  469. package/dist/slugify-PDTDtMXp.mjs +30 -0
  470. package/dist/ssrf-CmM76lLV.mjs +248 -0
  471. package/dist/storage/local.d.mts +1 -1
  472. package/dist/storage/local.mjs +1 -1
  473. package/dist/storage/s3.d.mts +1 -1
  474. package/dist/storage/s3.mjs +2 -2
  475. package/dist/{taxonomies-1s5PaS_8.mjs → taxonomies-BvBgfzn3.mjs} +11 -7
  476. package/dist/taxonomies-CpqGcIJD.mjs +355 -0
  477. package/dist/taxonomy-D5cbhc8u.mjs +165 -0
  478. package/dist/{tokens-CJz9ubV6.mjs → tokens-DLTo4dO2.mjs} +1 -1
  479. package/dist/{transport-DB5eDN4x.mjs → transport-C9e_h-BF.mjs} +5 -4
  480. package/dist/trusted-proxy-Bi0Cuk5n.mjs +30 -0
  481. package/dist/{types-BawVha09.mjs → types-Bs6lTBBW.mjs} +1 -1
  482. package/dist/types-C982qI5I.d.mts +344 -0
  483. package/dist/types-D4XVOt01.d.mts +165 -0
  484. package/dist/{types-Cj0KMIZV.d.mts → types-DgfUZqcd.d.mts} +54 -16
  485. package/dist/{types-BuMDPy5C.d.mts → types-IPACEM14.d.mts} +6 -0
  486. package/dist/user-CcXq-zoL.mjs +154 -0
  487. package/dist/utils-D2in-zwy.mjs +285 -0
  488. package/dist/{validate-BZ5wnLLp.mjs → validate-BJgA6TW_.mjs} +1 -1
  489. package/dist/{validate-IPf8n4Fj.d.mts → validate-JCZihRIa.d.mts} +3 -3
  490. package/dist/version-DH53KCQd.mjs +6 -0
  491. package/dist/widgets-B7Q_7bxN.mjs +104 -0
  492. package/dist/wordpress-slugs-BevajWrC.mjs +14 -0
  493. package/dist/zod-generator-DBVP8D0P.mjs +132 -0
  494. package/locals.d.ts +1 -6
  495. package/package.json +67 -11
  496. package/src/components/DinewayHead.astro +8 -4
  497. package/src/components/DinewayImage.astro +7 -5
  498. package/src/components/DinewayMedia.astro +9 -3
  499. package/src/components/Gallery.astro +5 -3
  500. package/src/components/Image.astro +5 -1
  501. package/src/components/InlinePortableTextEditor.tsx +68 -19
  502. package/dist/error-BmL6QipT.mjs +0 -30
  503. package/dist/search-DxopAWxs.mjs +0 -11200
  504. package/dist/version-BPz1imu2.mjs +0 -6
  505. package/src/astro/routes/PluginRegistry.tsx +0 -21
  506. package/src/astro/routes/api/admin/allowed-domains/[domain].ts +0 -112
  507. package/src/astro/routes/api/admin/allowed-domains/index.ts +0 -108
  508. package/src/astro/routes/api/admin/api-tokens/[id].ts +0 -44
  509. package/src/astro/routes/api/admin/api-tokens/index.ts +0 -90
  510. package/src/astro/routes/api/admin/briefing.ts +0 -76
  511. package/src/astro/routes/api/admin/bylines/[id]/index.ts +0 -90
  512. package/src/astro/routes/api/admin/bylines/index.ts +0 -74
  513. package/src/astro/routes/api/admin/comments/[id]/status.ts +0 -120
  514. package/src/astro/routes/api/admin/comments/[id].ts +0 -64
  515. package/src/astro/routes/api/admin/comments/bulk.ts +0 -42
  516. package/src/astro/routes/api/admin/comments/counts.ts +0 -30
  517. package/src/astro/routes/api/admin/comments/index.ts +0 -46
  518. package/src/astro/routes/api/admin/context/[id]/history.ts +0 -35
  519. package/src/astro/routes/api/admin/context/[id]/index.ts +0 -35
  520. package/src/astro/routes/api/admin/context/[id]/review.ts +0 -57
  521. package/src/astro/routes/api/admin/context/[id]/supersede.ts +0 -58
  522. package/src/astro/routes/api/admin/context/diff.ts +0 -35
  523. package/src/astro/routes/api/admin/context/index.ts +0 -69
  524. package/src/astro/routes/api/admin/context/stale.ts +0 -35
  525. package/src/astro/routes/api/admin/hitl-requests/[id]/index.ts +0 -38
  526. package/src/astro/routes/api/admin/hitl-requests/[id]/resolve.ts +0 -54
  527. package/src/astro/routes/api/admin/hitl-requests/index.ts +0 -38
  528. package/src/astro/routes/api/admin/hooks/exclusive/[hookName].ts +0 -132
  529. package/src/astro/routes/api/admin/hooks/exclusive/index.ts +0 -51
  530. package/src/astro/routes/api/admin/oauth-clients/[id].ts +0 -137
  531. package/src/astro/routes/api/admin/oauth-clients/index.ts +0 -95
  532. package/src/astro/routes/api/admin/plugins/[id]/disable.ts +0 -91
  533. package/src/astro/routes/api/admin/plugins/[id]/enable.ts +0 -91
  534. package/src/astro/routes/api/admin/plugins/[id]/index.ts +0 -38
  535. package/src/astro/routes/api/admin/plugins/[id]/uninstall.ts +0 -98
  536. package/src/astro/routes/api/admin/plugins/[id]/update.ts +0 -154
  537. package/src/astro/routes/api/admin/plugins/index.ts +0 -32
  538. package/src/astro/routes/api/admin/plugins/marketplace/[id]/icon.ts +0 -62
  539. package/src/astro/routes/api/admin/plugins/marketplace/[id]/index.ts +0 -33
  540. package/src/astro/routes/api/admin/plugins/marketplace/[id]/install.ts +0 -135
  541. package/src/astro/routes/api/admin/plugins/marketplace/index.ts +0 -38
  542. package/src/astro/routes/api/admin/plugins/updates.ts +0 -28
  543. package/src/astro/routes/api/admin/review-requests/[id]/index.ts +0 -35
  544. package/src/astro/routes/api/admin/review-requests/[id]/resolve.ts +0 -52
  545. package/src/astro/routes/api/admin/review-requests/index.ts +0 -35
  546. package/src/astro/routes/api/admin/themes/marketplace/[id]/index.ts +0 -33
  547. package/src/astro/routes/api/admin/themes/marketplace/[id]/thumbnail.ts +0 -62
  548. package/src/astro/routes/api/admin/themes/marketplace/index.ts +0 -45
  549. package/src/astro/routes/api/admin/users/[id]/disable.ts +0 -72
  550. package/src/astro/routes/api/admin/users/[id]/enable.ts +0 -48
  551. package/src/astro/routes/api/admin/users/[id]/index.ts +0 -166
  552. package/src/astro/routes/api/admin/users/[id]/send-recovery.ts +0 -72
  553. package/src/astro/routes/api/admin/users/index.ts +0 -66
  554. package/src/astro/routes/api/auth/dev-bypass.ts +0 -139
  555. package/src/astro/routes/api/auth/invite/accept.ts +0 -52
  556. package/src/astro/routes/api/auth/invite/complete.ts +0 -86
  557. package/src/astro/routes/api/auth/invite/index.ts +0 -99
  558. package/src/astro/routes/api/auth/invite/register-options.ts +0 -73
  559. package/src/astro/routes/api/auth/logout.ts +0 -40
  560. package/src/astro/routes/api/auth/magic-link/send.ts +0 -90
  561. package/src/astro/routes/api/auth/magic-link/verify.ts +0 -71
  562. package/src/astro/routes/api/auth/me.ts +0 -60
  563. package/src/astro/routes/api/auth/oauth/[provider]/callback.ts +0 -221
  564. package/src/astro/routes/api/auth/oauth/[provider].ts +0 -120
  565. package/src/astro/routes/api/auth/passkey/[id].ts +0 -124
  566. package/src/astro/routes/api/auth/passkey/index.ts +0 -54
  567. package/src/astro/routes/api/auth/passkey/options.ts +0 -85
  568. package/src/astro/routes/api/auth/passkey/register/options.ts +0 -88
  569. package/src/astro/routes/api/auth/passkey/register/verify.ts +0 -119
  570. package/src/astro/routes/api/auth/passkey/verify.ts +0 -72
  571. package/src/astro/routes/api/auth/signup/complete.ts +0 -87
  572. package/src/astro/routes/api/auth/signup/request.ts +0 -89
  573. package/src/astro/routes/api/auth/signup/verify.ts +0 -53
  574. package/src/astro/routes/api/comments/[collection]/[contentId]/index.ts +0 -310
  575. package/src/astro/routes/api/content/[collection]/[id]/compare.ts +0 -28
  576. package/src/astro/routes/api/content/[collection]/[id]/discard-draft.ts +0 -68
  577. package/src/astro/routes/api/content/[collection]/[id]/duplicate.ts +0 -77
  578. package/src/astro/routes/api/content/[collection]/[id]/permanent.ts +0 -42
  579. package/src/astro/routes/api/content/[collection]/[id]/preview-url.ts +0 -107
  580. package/src/astro/routes/api/content/[collection]/[id]/publish.ts +0 -100
  581. package/src/astro/routes/api/content/[collection]/[id]/restore.ts +0 -64
  582. package/src/astro/routes/api/content/[collection]/[id]/revisions.ts +0 -31
  583. package/src/astro/routes/api/content/[collection]/[id]/schedule.ts +0 -129
  584. package/src/astro/routes/api/content/[collection]/[id]/terms/[taxonomy].ts +0 -143
  585. package/src/astro/routes/api/content/[collection]/[id]/translations.ts +0 -50
  586. package/src/astro/routes/api/content/[collection]/[id]/unpublish.ts +0 -69
  587. package/src/astro/routes/api/content/[collection]/[id].ts +0 -173
  588. package/src/astro/routes/api/content/[collection]/index.ts +0 -103
  589. package/src/astro/routes/api/content/[collection]/trash.ts +0 -33
  590. package/src/astro/routes/api/dashboard.ts +0 -32
  591. package/src/astro/routes/api/dev/emails.ts +0 -36
  592. package/src/astro/routes/api/health.ts +0 -54
  593. package/src/astro/routes/api/import/probe.ts +0 -47
  594. package/src/astro/routes/api/import/wordpress/analyze.ts +0 -523
  595. package/src/astro/routes/api/import/wordpress/execute.ts +0 -330
  596. package/src/astro/routes/api/import/wordpress/media.ts +0 -338
  597. package/src/astro/routes/api/import/wordpress/prepare.ts +0 -212
  598. package/src/astro/routes/api/import/wordpress/rewrite-urls.ts +0 -425
  599. package/src/astro/routes/api/import/wordpress-plugin/analyze.ts +0 -111
  600. package/src/astro/routes/api/import/wordpress-plugin/callback.ts +0 -58
  601. package/src/astro/routes/api/import/wordpress-plugin/execute.ts +0 -399
  602. package/src/astro/routes/api/manifest.ts +0 -75
  603. package/src/astro/routes/api/mcp.ts +0 -125
  604. package/src/astro/routes/api/media/[id]/confirm.ts +0 -93
  605. package/src/astro/routes/api/media/[id].ts +0 -145
  606. package/src/astro/routes/api/media/file/[...key].ts +0 -79
  607. package/src/astro/routes/api/media/providers/[providerId]/[itemId].ts +0 -91
  608. package/src/astro/routes/api/media/providers/[providerId]/index.ts +0 -111
  609. package/src/astro/routes/api/media/providers/index.ts +0 -30
  610. package/src/astro/routes/api/media/upload-url.ts +0 -146
  611. package/src/astro/routes/api/media.ts +0 -204
  612. package/src/astro/routes/api/menus/[name]/reorder.ts +0 -79
  613. package/src/astro/routes/api/menus/[name].ts +0 -145
  614. package/src/astro/routes/api/menus/index.ts +0 -91
  615. package/src/astro/routes/api/oauth/authorize.ts +0 -430
  616. package/src/astro/routes/api/oauth/device/authorize.ts +0 -45
  617. package/src/astro/routes/api/oauth/device/code.ts +0 -56
  618. package/src/astro/routes/api/oauth/device/token.ts +0 -70
  619. package/src/astro/routes/api/oauth/register.ts +0 -182
  620. package/src/astro/routes/api/oauth/token/refresh.ts +0 -38
  621. package/src/astro/routes/api/oauth/token/revoke.ts +0 -38
  622. package/src/astro/routes/api/oauth/token.ts +0 -195
  623. package/src/astro/routes/api/openapi.json.ts +0 -33
  624. package/src/astro/routes/api/plugins/[pluginId]/[...path].ts +0 -109
  625. package/src/astro/routes/api/redirects/404s/index.ts +0 -72
  626. package/src/astro/routes/api/redirects/404s/summary.ts +0 -33
  627. package/src/astro/routes/api/redirects/[id].ts +0 -183
  628. package/src/astro/routes/api/redirects/index.ts +0 -100
  629. package/src/astro/routes/api/revisions/[revisionId]/index.ts +0 -29
  630. package/src/astro/routes/api/revisions/[revisionId]/restore.ts +0 -62
  631. package/src/astro/routes/api/schema/collections/[slug]/fields/[fieldSlug].ts +0 -104
  632. package/src/astro/routes/api/schema/collections/[slug]/fields/index.ts +0 -67
  633. package/src/astro/routes/api/schema/collections/[slug]/fields/reorder.ts +0 -45
  634. package/src/astro/routes/api/schema/collections/[slug]/index.ts +0 -107
  635. package/src/astro/routes/api/schema/collections/index.ts +0 -61
  636. package/src/astro/routes/api/schema/index.ts +0 -109
  637. package/src/astro/routes/api/schema/orphans/[slug].ts +0 -36
  638. package/src/astro/routes/api/schema/orphans/index.ts +0 -26
  639. package/src/astro/routes/api/search/enable.ts +0 -64
  640. package/src/astro/routes/api/search/index.ts +0 -52
  641. package/src/astro/routes/api/search/rebuild.ts +0 -72
  642. package/src/astro/routes/api/search/stats.ts +0 -35
  643. package/src/astro/routes/api/search/suggest.ts +0 -50
  644. package/src/astro/routes/api/sections/[slug].ts +0 -203
  645. package/src/astro/routes/api/sections/index.ts +0 -107
  646. package/src/astro/routes/api/settings/email.ts +0 -150
  647. package/src/astro/routes/api/settings.ts +0 -116
  648. package/src/astro/routes/api/setup/admin-verify.ts +0 -122
  649. package/src/astro/routes/api/setup/admin.ts +0 -104
  650. package/src/astro/routes/api/setup/dev-bypass.ts +0 -200
  651. package/src/astro/routes/api/setup/dev-reset.ts +0 -40
  652. package/src/astro/routes/api/setup/index.ts +0 -128
  653. package/src/astro/routes/api/setup/status.ts +0 -122
  654. package/src/astro/routes/api/snapshot.ts +0 -76
  655. package/src/astro/routes/api/taxonomies/[name]/terms/[slug].ts +0 -232
  656. package/src/astro/routes/api/taxonomies/[name]/terms/index.ts +0 -131
  657. package/src/astro/routes/api/taxonomies/index.ts +0 -114
  658. package/src/astro/routes/api/themes/preview.ts +0 -78
  659. package/src/astro/routes/api/typegen.ts +0 -114
  660. package/src/astro/routes/api/well-known/auth.ts +0 -71
  661. package/src/astro/routes/api/well-known/oauth-authorization-server.ts +0 -48
  662. package/src/astro/routes/api/well-known/oauth-protected-resource.ts +0 -39
  663. package/src/astro/routes/api/widget-areas/[name]/reorder.ts +0 -114
  664. package/src/astro/routes/api/widget-areas/[name]/widgets/[id].ts +0 -213
  665. package/src/astro/routes/api/widget-areas/[name]/widgets.ts +0 -126
  666. package/src/astro/routes/api/widget-areas/[name].ts +0 -135
  667. package/src/astro/routes/api/widget-areas/index.ts +0 -149
  668. package/src/astro/routes/api/widget-components.ts +0 -22
  669. package/src/astro/routes/robots.txt.ts +0 -81
  670. package/src/astro/routes/sitemap-[collection].xml.ts +0 -104
  671. package/src/astro/routes/sitemap.xml.ts +0 -92
  672. /package/dist/{adapters-C2ypTrZZ.d.mts → adapters-BLDldpJg.d.mts} +0 -0
  673. /package/{src → dist}/astro/routes/admin.astro +0 -0
  674. /package/dist/{base64-F8-DUraK.mjs → base64-Cz-aU0X1.mjs} +0 -0
  675. /package/dist/{chunks--4F8ddV4.mjs → chunks-D_jVet6z.mjs} +0 -0
  676. /package/dist/{config-BXwuX8Bx.mjs → config-CAMFxGaV.mjs} +0 -0
  677. /package/dist/{db-errors-CEqD7qH9.mjs → db-errors-DKUg_NgF.mjs} +0 -0
  678. /package/dist/{default-VjJyuuG9.mjs → default-C3PZN-bz.mjs} +0 -0
  679. /package/dist/{load-Coc9HpHH.mjs → load-D-9NhLmF.mjs} +0 -0
  680. /package/dist/{mode-47goXBBK.mjs → mode-C80mAZQv.mjs} +0 -0
  681. /package/dist/{placeholder--wOi4TbO.d.mts → placeholder-CHkLckzK.d.mts} +0 -0
  682. /package/dist/{request-cache-Dk5qPSOx.mjs → request-cache-DHMRr2Lf.mjs} +0 -0
  683. /package/dist/{transaction-Cn2rjY78.mjs → transaction-x2tJQ-A1.mjs} +0 -0
  684. /package/dist/{transport-Wge_IzKl.d.mts → transport-6RefuBdV.d.mts} +0 -0
  685. /package/dist/{types-griIBQOQ.mjs → types-B9gKVOHk.mjs} +0 -0
  686. /package/dist/{types-CWbdtiux.d.mts → types-B9qVtiHb.d.mts} +0 -0
  687. /package/dist/{types-COeOq9nK.mjs → types-DL7Y8D_t.mjs} +0 -0
  688. /package/dist/{types-BzcUjoqg.d.mts → types-Djdp0cZO.d.mts} +0 -0
  689. /package/dist/{types-DOrVigru.d.mts → types-Du8jreyC.d.mts} +0 -0
@@ -0,0 +1,1294 @@
1
+ import { n as decodeCursor, r as encodeCursor } from "./types-Bs6lTBBW.mjs";
2
+ import { t as SiteActivityRepository } from "./site-activity-B8FjLIVh.mjs";
3
+ import { t as ReviewRequestRepository } from "./review-requests-C2DIHwlJ.mjs";
4
+ import { t as withTransaction } from "./transaction-x2tJQ-A1.mjs";
5
+ import { n as isSiteContextType, t as SITE_CONTEXT_TYPES } from "./context-types-C-LwdAxx.mjs";
6
+ import { n as SchemaRegistry } from "./registry-C-_hxLqa.mjs";
7
+ import { a as getSiteSettingsWithDb } from "./settings-4XnpVMOS.mjs";
8
+ import { sql } from "kysely";
9
+ import { ulid } from "ulidx";
10
+
11
+ //#region src/plugins/state.ts
12
+ function toPluginStatus(value) {
13
+ if (value === "active") return "active";
14
+ return "inactive";
15
+ }
16
+ function toPluginSource(value) {
17
+ if (value === "marketplace") return "marketplace";
18
+ return "config";
19
+ }
20
+ /**
21
+ * Repository for plugin state in the database
22
+ */
23
+ var PluginStateRepository = class {
24
+ constructor(db) {
25
+ this.db = db;
26
+ }
27
+ /**
28
+ * Get state for a specific plugin
29
+ */
30
+ async get(pluginId) {
31
+ const row = await this.db.selectFrom("_plugin_state").selectAll().where("plugin_id", "=", pluginId).executeTakeFirst();
32
+ if (!row) return null;
33
+ return {
34
+ pluginId: row.plugin_id,
35
+ status: toPluginStatus(row.status),
36
+ version: row.version,
37
+ installedAt: new Date(row.installed_at),
38
+ activatedAt: row.activated_at ? new Date(row.activated_at) : null,
39
+ deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
40
+ source: toPluginSource(row.source),
41
+ marketplaceVersion: row.marketplace_version ?? null,
42
+ displayName: row.display_name ?? null,
43
+ description: row.description ?? null
44
+ };
45
+ }
46
+ /**
47
+ * Get all plugin states
48
+ */
49
+ async getAll() {
50
+ return (await this.db.selectFrom("_plugin_state").selectAll().execute()).map((row) => ({
51
+ pluginId: row.plugin_id,
52
+ status: toPluginStatus(row.status),
53
+ version: row.version,
54
+ installedAt: new Date(row.installed_at),
55
+ activatedAt: row.activated_at ? new Date(row.activated_at) : null,
56
+ deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
57
+ source: toPluginSource(row.source),
58
+ marketplaceVersion: row.marketplace_version ?? null,
59
+ displayName: row.display_name ?? null,
60
+ description: row.description ?? null
61
+ }));
62
+ }
63
+ /**
64
+ * Get all marketplace-installed plugin states
65
+ */
66
+ async getMarketplacePlugins() {
67
+ return (await this.db.selectFrom("_plugin_state").selectAll().where("source", "=", "marketplace").execute()).map((row) => ({
68
+ pluginId: row.plugin_id,
69
+ status: toPluginStatus(row.status),
70
+ version: row.version,
71
+ installedAt: new Date(row.installed_at),
72
+ activatedAt: row.activated_at ? new Date(row.activated_at) : null,
73
+ deactivatedAt: row.deactivated_at ? new Date(row.deactivated_at) : null,
74
+ source: toPluginSource(row.source),
75
+ marketplaceVersion: row.marketplace_version ?? null,
76
+ displayName: row.display_name ?? null,
77
+ description: row.description ?? null
78
+ }));
79
+ }
80
+ /**
81
+ * Create or update plugin state
82
+ */
83
+ async upsert(pluginId, version, status, opts) {
84
+ const now = (/* @__PURE__ */ new Date()).toISOString();
85
+ const existing = await this.get(pluginId);
86
+ if (existing) {
87
+ const updates = {
88
+ status,
89
+ version
90
+ };
91
+ if (status === "active" && existing.status !== "active") updates.activated_at = now;
92
+ else if (status === "inactive" && existing.status !== "inactive") updates.deactivated_at = now;
93
+ if (opts?.source) updates.source = opts.source;
94
+ if (opts?.marketplaceVersion !== void 0) updates.marketplace_version = opts.marketplaceVersion;
95
+ if (opts?.displayName !== void 0) updates.display_name = opts.displayName;
96
+ if (opts?.description !== void 0) updates.description = opts.description;
97
+ await this.db.updateTable("_plugin_state").set(updates).where("plugin_id", "=", pluginId).execute();
98
+ } else await this.db.insertInto("_plugin_state").values({
99
+ plugin_id: pluginId,
100
+ status,
101
+ version,
102
+ installed_at: now,
103
+ activated_at: status === "active" ? now : null,
104
+ deactivated_at: null,
105
+ data: null,
106
+ source: opts?.source ?? "config",
107
+ marketplace_version: opts?.marketplaceVersion ?? null,
108
+ display_name: opts?.displayName ?? null,
109
+ description: opts?.description ?? null
110
+ }).execute();
111
+ return await this.get(pluginId);
112
+ }
113
+ /**
114
+ * Enable a plugin
115
+ */
116
+ async enable(pluginId, version) {
117
+ return this.upsert(pluginId, version, "active");
118
+ }
119
+ /**
120
+ * Disable a plugin
121
+ */
122
+ async disable(pluginId, version) {
123
+ return this.upsert(pluginId, version, "inactive");
124
+ }
125
+ /**
126
+ * Delete plugin state
127
+ */
128
+ async delete(pluginId) {
129
+ return ((await this.db.deleteFrom("_plugin_state").where("plugin_id", "=", pluginId).executeTakeFirst()).numDeletedRows ?? 0) > 0;
130
+ }
131
+ };
132
+
133
+ //#endregion
134
+ //#region src/api/handlers/plugins.ts
135
+ function marketplaceIconUrl(marketplaceUrl, pluginId) {
136
+ return `${marketplaceUrl}/api/v1/plugins/${encodeURIComponent(pluginId)}/icon`;
137
+ }
138
+ /**
139
+ * Get plugin info from configured plugin and database state
140
+ */
141
+ function buildPluginInfo(plugin, state, marketplaceUrl) {
142
+ const status = state?.status ?? "active";
143
+ const enabled = status === "active";
144
+ const isMarketplace = (state?.source ?? "config") === "marketplace";
145
+ return {
146
+ id: plugin.id,
147
+ name: state?.displayName || plugin.id,
148
+ version: plugin.version,
149
+ package: void 0,
150
+ enabled,
151
+ status,
152
+ source: state?.source ?? "config",
153
+ marketplaceVersion: state?.marketplaceVersion ?? void 0,
154
+ capabilities: plugin.capabilities,
155
+ hasAdminPages: (plugin.admin.pages?.length ?? 0) > 0,
156
+ hasDashboardWidgets: (plugin.admin.widgets?.length ?? 0) > 0,
157
+ hasHooks: Object.keys(plugin.hooks ?? {}).length > 0,
158
+ installedAt: state?.installedAt?.toISOString(),
159
+ activatedAt: state?.activatedAt?.toISOString() ?? void 0,
160
+ deactivatedAt: state?.deactivatedAt?.toISOString() ?? void 0,
161
+ description: state?.description ?? void 0,
162
+ iconUrl: isMarketplace && marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, plugin.id) : void 0
163
+ };
164
+ }
165
+ /**
166
+ * List all configured plugins with their state
167
+ */
168
+ async function handlePluginList(db, configuredPlugins, marketplaceUrl) {
169
+ try {
170
+ const allStates = await new PluginStateRepository(db).getAll();
171
+ const stateMap = new Map(allStates.map((s) => [s.pluginId, s]));
172
+ const configuredIds = new Set(configuredPlugins.map((p) => p.id));
173
+ const items = configuredPlugins.map((plugin) => {
174
+ return buildPluginInfo(plugin, stateMap.get(plugin.id) ?? null, marketplaceUrl);
175
+ });
176
+ for (const state of allStates) {
177
+ if (state.source !== "marketplace") continue;
178
+ if (configuredIds.has(state.pluginId)) continue;
179
+ items.push({
180
+ id: state.pluginId,
181
+ name: state.displayName || state.pluginId,
182
+ version: state.marketplaceVersion ?? state.version,
183
+ enabled: state.status === "active",
184
+ status: state.status,
185
+ source: "marketplace",
186
+ marketplaceVersion: state.marketplaceVersion ?? void 0,
187
+ capabilities: [],
188
+ hasAdminPages: false,
189
+ hasDashboardWidgets: false,
190
+ hasHooks: false,
191
+ installedAt: state.installedAt?.toISOString(),
192
+ activatedAt: state.activatedAt?.toISOString() ?? void 0,
193
+ deactivatedAt: state.deactivatedAt?.toISOString() ?? void 0,
194
+ description: state.description ?? void 0,
195
+ iconUrl: marketplaceUrl ? marketplaceIconUrl(marketplaceUrl, state.pluginId) : void 0
196
+ });
197
+ }
198
+ return {
199
+ success: true,
200
+ data: { items }
201
+ };
202
+ } catch {
203
+ return {
204
+ success: false,
205
+ error: {
206
+ code: "PLUGIN_LIST_ERROR",
207
+ message: "Failed to list plugins"
208
+ }
209
+ };
210
+ }
211
+ }
212
+ /**
213
+ * Get a single plugin's info
214
+ */
215
+ async function handlePluginGet(db, configuredPlugins, pluginId, marketplaceUrl) {
216
+ try {
217
+ const plugin = configuredPlugins.find((p) => p.id === pluginId);
218
+ if (!plugin) return {
219
+ success: false,
220
+ error: {
221
+ code: "NOT_FOUND",
222
+ message: `Plugin not found: ${pluginId}`
223
+ }
224
+ };
225
+ return {
226
+ success: true,
227
+ data: { item: buildPluginInfo(plugin, await new PluginStateRepository(db).get(pluginId), marketplaceUrl) }
228
+ };
229
+ } catch {
230
+ return {
231
+ success: false,
232
+ error: {
233
+ code: "PLUGIN_GET_ERROR",
234
+ message: "Failed to get plugin"
235
+ }
236
+ };
237
+ }
238
+ }
239
+ /**
240
+ * Enable a plugin
241
+ */
242
+ async function handlePluginEnable(db, configuredPlugins, pluginId) {
243
+ try {
244
+ const plugin = configuredPlugins.find((p) => p.id === pluginId);
245
+ if (!plugin) return {
246
+ success: false,
247
+ error: {
248
+ code: "NOT_FOUND",
249
+ message: `Plugin not found: ${pluginId}`
250
+ }
251
+ };
252
+ return {
253
+ success: true,
254
+ data: { item: buildPluginInfo(plugin, await new PluginStateRepository(db).enable(pluginId, plugin.version)) }
255
+ };
256
+ } catch {
257
+ return {
258
+ success: false,
259
+ error: {
260
+ code: "PLUGIN_ENABLE_ERROR",
261
+ message: "Failed to enable plugin"
262
+ }
263
+ };
264
+ }
265
+ }
266
+ /**
267
+ * Disable a plugin
268
+ */
269
+ async function handlePluginDisable(db, configuredPlugins, pluginId) {
270
+ try {
271
+ const plugin = configuredPlugins.find((p) => p.id === pluginId);
272
+ if (!plugin) return {
273
+ success: false,
274
+ error: {
275
+ code: "NOT_FOUND",
276
+ message: `Plugin not found: ${pluginId}`
277
+ }
278
+ };
279
+ return {
280
+ success: true,
281
+ data: { item: buildPluginInfo(plugin, await new PluginStateRepository(db).disable(pluginId, plugin.version)) }
282
+ };
283
+ } catch {
284
+ return {
285
+ success: false,
286
+ error: {
287
+ code: "PLUGIN_DISABLE_ERROR",
288
+ message: "Failed to disable plugin"
289
+ }
290
+ };
291
+ }
292
+ }
293
+
294
+ //#endregion
295
+ //#region src/database/repositories/context-entries.ts
296
+ var ContextRepository = class {
297
+ constructor(db) {
298
+ this.db = db;
299
+ }
300
+ async create(input) {
301
+ validateContextType(input.contextType);
302
+ const id = ulid();
303
+ const now = (/* @__PURE__ */ new Date()).toISOString();
304
+ const tags = normalizeTags(input.tags);
305
+ await withTransaction(this.db, async (trx) => {
306
+ await trx.insertInto("_dineway_context_entries").values(toInsertableContextEntry(id, input, now)).execute();
307
+ await insertTags(trx, id, tags);
308
+ });
309
+ const entry = await this.findById(id);
310
+ if (!entry) throw new Error("Failed to create context entry");
311
+ return entry;
312
+ }
313
+ async findById(id) {
314
+ const row = await this.db.selectFrom("_dineway_context_entries").selectAll().where("id", "=", id).executeTakeFirst();
315
+ if (!row) return null;
316
+ return rowToContextEntry(row, (await this.loadTags([id])).get(id) ?? []);
317
+ }
318
+ async findSupersedeHistory(id) {
319
+ const seen = /* @__PURE__ */ new Set();
320
+ const entries = /* @__PURE__ */ new Map();
321
+ const queue = [id];
322
+ while (queue.length > 0) {
323
+ const nextId = queue.shift();
324
+ if (seen.has(nextId)) continue;
325
+ seen.add(nextId);
326
+ const entry = await this.findById(nextId);
327
+ if (!entry) continue;
328
+ entries.set(entry.id, entry);
329
+ if (entry.supersedesId) queue.push(entry.supersedesId);
330
+ const replacements = await this.findSupersedingEntries(entry.id);
331
+ for (const replacement of replacements) queue.push(replacement.id);
332
+ }
333
+ return [...entries.values()].toSorted(compareHistoryEntries);
334
+ }
335
+ async list(query = {}) {
336
+ const rows = await this.queryRows(query).execute();
337
+ return this.rowsToPaginatedEntries(rows, clampLimit$1(query.limit));
338
+ }
339
+ async search(query) {
340
+ const term = `%${query.query.toLowerCase()}%`;
341
+ let q = this.queryRows(query);
342
+ q = q.where((eb) => eb.or([
343
+ sql`lower(title) like ${term}`,
344
+ sql`lower(body) like ${term}`,
345
+ sql`lower(scope) like ${term}`,
346
+ sql`lower(coalesce(policy_key, '')) like ${term}`
347
+ ]));
348
+ const rows = await q.execute();
349
+ return this.rowsToPaginatedEntries(rows, clampLimit$1(query.limit));
350
+ }
351
+ async supersede(id, input) {
352
+ const newId = ulid();
353
+ const now = (/* @__PURE__ */ new Date()).toISOString();
354
+ const tags = normalizeTags(input.tags);
355
+ const createdId = await withTransaction(this.db, async (trx) => {
356
+ const existing = await trx.selectFrom("_dineway_context_entries").selectAll().where("id", "=", id).executeTakeFirst();
357
+ if (!existing) return null;
358
+ const contextType = input.contextType ?? existing.context_type;
359
+ validateContextType(contextType);
360
+ await trx.updateTable("_dineway_context_entries").set({
361
+ is_current: 0,
362
+ updated_at: now
363
+ }).where("id", "=", id).execute();
364
+ await trx.insertInto("_dineway_context_entries").values(toInsertableContextEntry(newId, {
365
+ scope: input.scope ?? existing.scope,
366
+ contextType,
367
+ title: input.title,
368
+ body: input.body,
369
+ policyKey: input.policyKey ?? existing.policy_key,
370
+ sourceActivityId: input.sourceActivityId ?? existing.source_activity_id,
371
+ createdByActorType: input.createdByActorType,
372
+ createdByActorId: input.createdByActorId,
373
+ createdAuthMetadata: input.createdAuthMetadata,
374
+ supersedesId: existing.id,
375
+ version: existing.version + 1,
376
+ isCurrent: true,
377
+ validUntil: input.validUntil ?? existing.valid_until,
378
+ tags,
379
+ createdAt: input.createdAt,
380
+ updatedAt: input.createdAt
381
+ }, now)).execute();
382
+ await insertTags(trx, newId, tags);
383
+ return newId;
384
+ });
385
+ return createdId ? this.findById(createdId) : null;
386
+ }
387
+ async review(id, input) {
388
+ const reviewedAt = input.reviewedAt ?? (/* @__PURE__ */ new Date()).toISOString();
389
+ await this.db.updateTable("_dineway_context_entries").set({
390
+ reviewed_at: reviewedAt,
391
+ reviewed_by_actor_type: input.reviewedByActorType,
392
+ reviewed_by_actor_id: input.reviewedByActorId,
393
+ review_note: input.reviewNote ?? null,
394
+ valid_until: input.validUntil ?? void 0,
395
+ updated_at: reviewedAt
396
+ }).where("id", "=", id).execute();
397
+ return this.findById(id);
398
+ }
399
+ async listStale(query = {}) {
400
+ const now = query.now ?? (/* @__PURE__ */ new Date()).toISOString();
401
+ let q = this.queryRows({
402
+ ...query,
403
+ currentOnly: true
404
+ });
405
+ q = q.where("valid_until", "is not", null).where("valid_until", "<", now);
406
+ const rows = await q.execute();
407
+ return this.rowsToPaginatedEntries(rows, clampLimit$1(query.limit));
408
+ }
409
+ async diff(query) {
410
+ const [newEntries, supersededEntries, staleEntries, reviewedEntries] = await Promise.all([
411
+ this.rowsForDiff({
412
+ scopes: query.scopes,
413
+ sinceColumn: "created_at",
414
+ since: query.since,
415
+ excludeSupersedeReplacements: true
416
+ }),
417
+ this.rowsForDiff({
418
+ scopes: query.scopes,
419
+ sinceColumn: "updated_at",
420
+ since: query.since,
421
+ currentOnly: false,
422
+ onlySuperseded: true
423
+ }),
424
+ this.staleRowsForDiff({
425
+ scopes: query.scopes,
426
+ since: query.since,
427
+ now: query.now
428
+ }),
429
+ this.rowsForDiff({
430
+ scopes: query.scopes,
431
+ sinceColumn: "reviewed_at",
432
+ since: query.since,
433
+ reviewedOnly: true
434
+ })
435
+ ]);
436
+ return {
437
+ newEntries,
438
+ supersededEntries,
439
+ staleEntries,
440
+ reviewedEntries
441
+ };
442
+ }
443
+ queryRows(query) {
444
+ const limit = clampLimit$1(query.limit);
445
+ let q = this.db.selectFrom("_dineway_context_entries").selectAll().orderBy("updated_at", "desc").orderBy("id", "desc").limit(limit + 1);
446
+ if (query.currentOnly !== false) q = q.where("is_current", "=", 1);
447
+ if (query.scopes) if (query.scopes.length === 0) q = q.where("id", "=", "__no_context_entries__");
448
+ else q = q.where("scope", "in", query.scopes);
449
+ if (query.contextTypes && query.contextTypes.length > 0) q = q.where("context_type", "in", query.contextTypes);
450
+ if (query.createdByActorType) q = q.where("created_by_actor_type", "=", query.createdByActorType);
451
+ if (query.createdByActorId) q = q.where("created_by_actor_id", "=", query.createdByActorId);
452
+ const tags = normalizeTags(query.tags);
453
+ if (tags.length > 0) {
454
+ const taggedIds = this.db.selectFrom("_dineway_context_tags").select("context_entry_id").where("tag", "in", tags);
455
+ q = q.where("id", "in", taggedIds);
456
+ }
457
+ if (query.cursor) {
458
+ const decoded = decodeCursor(query.cursor);
459
+ if (decoded) q = q.where((eb) => eb.or([eb("updated_at", "<", decoded.orderValue), eb.and([eb("updated_at", "=", decoded.orderValue), eb("id", "<", decoded.id)])]));
460
+ }
461
+ return q;
462
+ }
463
+ async rowsForDiff(input) {
464
+ let q = this.db.selectFrom("_dineway_context_entries").selectAll().orderBy("updated_at", "desc").orderBy("id", "desc").limit(100);
465
+ if (input.scopes) {
466
+ if (input.scopes.length === 0) return [];
467
+ q = q.where("scope", "in", input.scopes);
468
+ }
469
+ if (input.currentOnly !== false) q = q.where("is_current", "=", 1);
470
+ if (input.onlySuperseded) q = q.where("is_current", "=", 0);
471
+ if (input.reviewedOnly) q = q.where("reviewed_at", "is not", null);
472
+ if (input.excludeSupersedeReplacements) q = q.where("supersedes_id", "is", null);
473
+ q = q.where(input.sinceColumn, ">=", input.since);
474
+ const rows = await q.execute();
475
+ return this.rowsToEntries(rows);
476
+ }
477
+ async staleRowsForDiff(input) {
478
+ const now = input.now ?? (/* @__PURE__ */ new Date()).toISOString();
479
+ let q = this.db.selectFrom("_dineway_context_entries").selectAll().where("is_current", "=", 1).where("valid_until", "is not", null).where("valid_until", ">=", input.since).where("valid_until", "<", now).orderBy("valid_until", "asc").orderBy("updated_at", "desc").orderBy("id", "desc").limit(100);
480
+ if (input.scopes) {
481
+ if (input.scopes.length === 0) return [];
482
+ q = q.where("scope", "in", input.scopes);
483
+ }
484
+ const rows = await q.execute();
485
+ return this.rowsToEntries(rows);
486
+ }
487
+ async rowsToPaginatedEntries(rows, limit) {
488
+ const pageRows = rows.slice(0, limit);
489
+ const items = await this.rowsToEntries(pageRows);
490
+ const result = { items };
491
+ if (rows.length > limit && items.length > 0) {
492
+ const last = items.at(-1);
493
+ result.nextCursor = encodeCursor(last.updatedAt, last.id);
494
+ }
495
+ return result;
496
+ }
497
+ async rowsToEntries(rows) {
498
+ const ids = rows.map((row) => row.id);
499
+ const tagMap = await this.loadTags(ids);
500
+ return rows.map((row) => rowToContextEntry(row, tagMap.get(row.id) ?? []));
501
+ }
502
+ async findSupersedingEntries(id) {
503
+ const rows = await this.db.selectFrom("_dineway_context_entries").selectAll().where("supersedes_id", "=", id).orderBy("version", "asc").orderBy("created_at", "asc").orderBy("id", "asc").execute();
504
+ return this.rowsToEntries(rows);
505
+ }
506
+ async loadTags(ids) {
507
+ const tagMap = /* @__PURE__ */ new Map();
508
+ if (ids.length === 0) return tagMap;
509
+ const rows = await this.db.selectFrom("_dineway_context_tags").select(["context_entry_id", "tag"]).where("context_entry_id", "in", ids).orderBy("tag", "asc").execute();
510
+ for (const row of rows) {
511
+ const tags = tagMap.get(row.context_entry_id) ?? [];
512
+ tags.push(row.tag);
513
+ tagMap.set(row.context_entry_id, tags);
514
+ }
515
+ return tagMap;
516
+ }
517
+ };
518
+ function toInsertableContextEntry(id, input, now) {
519
+ return {
520
+ id,
521
+ scope: input.scope,
522
+ context_type: input.contextType,
523
+ title: input.title,
524
+ body: input.body,
525
+ policy_key: input.policyKey ?? null,
526
+ source_activity_id: input.sourceActivityId ?? null,
527
+ created_by_actor_type: input.createdByActorType,
528
+ created_by_actor_id: input.createdByActorId,
529
+ created_auth_metadata: jsonOrNull(input.createdAuthMetadata),
530
+ supersedes_id: input.supersedesId ?? null,
531
+ version: input.version ?? 1,
532
+ is_current: input.isCurrent === false ? 0 : 1,
533
+ valid_until: input.validUntil ?? null,
534
+ reviewed_at: null,
535
+ reviewed_by_actor_type: null,
536
+ reviewed_by_actor_id: null,
537
+ review_note: null,
538
+ created_at: input.createdAt ?? now,
539
+ updated_at: input.updatedAt ?? input.createdAt ?? now
540
+ };
541
+ }
542
+ async function insertTags(db, entryId, tags) {
543
+ if (tags.length === 0) return;
544
+ await db.insertInto("_dineway_context_tags").values(tags.map((tag) => ({
545
+ context_entry_id: entryId,
546
+ tag
547
+ }))).execute();
548
+ }
549
+ function rowToContextEntry(row, tags) {
550
+ const contextType = row.context_type;
551
+ validateContextType(contextType);
552
+ return {
553
+ id: row.id,
554
+ scope: row.scope,
555
+ contextType,
556
+ title: row.title,
557
+ body: row.body,
558
+ policyKey: row.policy_key,
559
+ sourceActivityId: row.source_activity_id,
560
+ createdByActorType: row.created_by_actor_type,
561
+ createdByActorId: row.created_by_actor_id,
562
+ createdAuthMetadata: parseRecord(row.created_auth_metadata),
563
+ supersedesId: row.supersedes_id,
564
+ version: row.version,
565
+ isCurrent: row.is_current === 1,
566
+ validUntil: row.valid_until,
567
+ reviewedAt: row.reviewed_at,
568
+ reviewedByActorType: row.reviewed_by_actor_type,
569
+ reviewedByActorId: row.reviewed_by_actor_id,
570
+ reviewNote: row.review_note,
571
+ tags,
572
+ createdAt: row.created_at,
573
+ updatedAt: row.updated_at
574
+ };
575
+ }
576
+ function validateContextType(value) {
577
+ if (!isSiteContextType(value)) throw new Error(`Invalid context type: ${value}`);
578
+ }
579
+ function normalizeTags(tags) {
580
+ if (!tags) return [];
581
+ return [...new Set(tags.map((tag) => tag.trim().toLowerCase()).filter((tag) => tag.length > 0))].toSorted();
582
+ }
583
+ function compareHistoryEntries(a, b) {
584
+ if (a.version !== b.version) return a.version - b.version;
585
+ const created = a.createdAt.localeCompare(b.createdAt);
586
+ if (created !== 0) return created;
587
+ return a.id.localeCompare(b.id);
588
+ }
589
+ function jsonOrNull(value) {
590
+ return value ? JSON.stringify(value) : null;
591
+ }
592
+ function parseRecord(value) {
593
+ if (!value) return null;
594
+ try {
595
+ const parsed = JSON.parse(value);
596
+ return isRecord(parsed) ? parsed : null;
597
+ } catch {
598
+ return null;
599
+ }
600
+ }
601
+ function isRecord(value) {
602
+ return typeof value === "object" && value !== null && !Array.isArray(value);
603
+ }
604
+ function clampLimit$1(value) {
605
+ return Math.min(Math.max(1, value ?? 50), 100);
606
+ }
607
+
608
+ //#endregion
609
+ //#region src/site-context/briefing.ts
610
+ const COLLECTION_SLUG_PATTERN = /^[a-z][a-z0-9_]*$/;
611
+ const DEFAULT_ACTIVITY_LIMIT = 10;
612
+ const DEFAULT_REVIEW_REQUEST_LIMIT = 25;
613
+ const MAX_ACTIVITY_LIMIT = 100;
614
+ const DEFAULT_TOKEN_BUDGET = 8e3;
615
+ const TOKEN_CHARS = 4;
616
+ const RELATIVE_SINCE_PATTERN = /^(\d+)(m|h|d|w)$/i;
617
+ var SiteBriefingError = class extends Error {
618
+ constructor(message, code) {
619
+ super(message);
620
+ this.code = code;
621
+ this.name = "SiteBriefingError";
622
+ }
623
+ };
624
+ var SiteBriefingAssembler = class {
625
+ db;
626
+ storage;
627
+ configuredPlugins;
628
+ marketplaceUrl;
629
+ permissions;
630
+ now;
631
+ constructor(options) {
632
+ this.db = options.db;
633
+ this.storage = options.storage ?? null;
634
+ this.configuredPlugins = options.configuredPlugins ?? [];
635
+ this.marketplaceUrl = options.marketplaceUrl;
636
+ this.permissions = {
637
+ canReadContent: false,
638
+ canReadSchema: false,
639
+ canReadSettings: false,
640
+ canReadPlugins: false,
641
+ ...options.permissions
642
+ };
643
+ this.now = options.now ?? /* @__PURE__ */ new Date();
644
+ }
645
+ async assemble(input = {}) {
646
+ const parsedScope = parseSiteBriefingScope(input.scope ?? "site");
647
+ const since = resolveSince(input.since, this.now);
648
+ const contextTypes = parseContextTypes(input.contextTypes ?? []);
649
+ const includeStale = input.includeStale !== false;
650
+ const activityLimit = clampLimit(input.activityLimit ?? DEFAULT_ACTIVITY_LIMIT);
651
+ const tokenBudget = Math.max(1, Math.floor(input.tokenBudget ?? DEFAULT_TOKEN_BUDGET));
652
+ const [schema, contextEntries, activity, plugins, settings, staleWarnings, reviewRequests] = await Promise.all([
653
+ this.loadSchemaSection(parsedScope),
654
+ this.loadContextEntriesSection(parsedScope, contextTypes),
655
+ this.loadActivitySection(parsedScope, since, activityLimit),
656
+ this.loadPluginSection(),
657
+ this.loadSettingsSection(),
658
+ this.loadStaleWarningsSection(parsedScope, contextTypes, includeStale),
659
+ this.loadReviewRequestsSection(parsedScope)
660
+ ]);
661
+ return applyTokenBudget({
662
+ kind: "site_briefing",
663
+ generatedAt: this.now.toISOString(),
664
+ scope: {
665
+ requested: input.scope ?? "site",
666
+ resolved: parsedScope.scope,
667
+ type: parsedScope.type,
668
+ ancestors: parsedScope.ancestors,
669
+ collection: parsedScope.collection,
670
+ contentId: parsedScope.contentId,
671
+ pluginId: parsedScope.pluginId,
672
+ taxonomyId: parsedScope.taxonomyId,
673
+ menuId: parsedScope.menuId
674
+ },
675
+ since,
676
+ contextTypes,
677
+ tokenBudget,
678
+ tokenEstimate: 0,
679
+ truncated: false,
680
+ packing: [],
681
+ sections: {
682
+ schema,
683
+ contextEntries,
684
+ activity,
685
+ plugins,
686
+ settings,
687
+ staleWarnings,
688
+ reviewRequests
689
+ }
690
+ }, tokenBudget);
691
+ }
692
+ async loadSchemaSection(scope) {
693
+ if (!this.permissions.canReadSchema) return omittedSection({ collections: [] }, "missing schema:read permission");
694
+ const registry = new SchemaRegistry(this.db);
695
+ const collections = scope.collection !== void 0 ? compactCollection(await registry.getCollectionWithFields(scope.collection)) : await this.loadAllCollections(registry);
696
+ return includedSection({
697
+ collections,
698
+ currentCollection: scope.collection !== void 0 ? collections.find((item) => item.slug === scope.collection) : void 0
699
+ });
700
+ }
701
+ async loadAllCollections(registry) {
702
+ const collections = await registry.listCollections();
703
+ return (await Promise.all(collections.map((collection) => registry.getCollectionWithFields(collection.slug)))).flatMap((collection) => compactCollection(collection));
704
+ }
705
+ async loadContextEntriesSection(scope, contextTypes) {
706
+ if (!this.permissions.canReadContent) return omittedSection({
707
+ groups: [],
708
+ scopes: scope.ancestors
709
+ }, "missing content:read permission");
710
+ return includedSection({
711
+ groups: groupContextEntries(selectActiveBriefingContextEntries((await new ContextRepository(this.db).list({
712
+ scopes: scope.ancestors,
713
+ contextTypes: contextTypes.length > 0 ? contextTypes : void 0,
714
+ currentOnly: true,
715
+ limit: 50
716
+ })).items, scope.ancestors, this.now).map((entry) => summarizeContextEntry(entry))),
717
+ scopes: scope.ancestors
718
+ });
719
+ }
720
+ async loadActivitySection(scope, since, limit) {
721
+ if (!this.permissions.canReadContent) return omittedSection({
722
+ scopes: scope.ancestors,
723
+ items: []
724
+ }, "missing content:read permission");
725
+ const items = (await new SiteActivityRepository(this.db).findTimeline({
726
+ scopes: scope.ancestors,
727
+ since: since ?? void 0,
728
+ limit
729
+ })).items.filter((activity) => this.canIncludeActivity(activity)).map((activity) => summarizeActivity(activity));
730
+ return includedSection({
731
+ scopes: scope.ancestors,
732
+ items
733
+ });
734
+ }
735
+ async loadPluginSection() {
736
+ if (!this.permissions.canReadPlugins) return omittedSection({ active: [] }, "missing plugins:read permission");
737
+ const result = await handlePluginList(this.db, this.configuredPlugins, this.marketplaceUrl);
738
+ if (!result.success || !result.data) return omittedSection({ active: [] }, "plugin list could not be loaded");
739
+ return includedSection({ active: result.data.items.filter((plugin) => plugin.enabled).map((plugin) => summarizePlugin(plugin)) });
740
+ }
741
+ async loadSettingsSection() {
742
+ if (!this.permissions.canReadSettings) return omittedSection(null, "missing settings:read permission");
743
+ return includedSection(summarizeSettings(await getSiteSettingsWithDb(this.db, this.storage)));
744
+ }
745
+ async loadStaleWarningsSection(scope, contextTypes, includeStale) {
746
+ if (!includeStale) return omittedSection({
747
+ scopes: scope.ancestors,
748
+ items: []
749
+ }, "stale warnings disabled by include_stale=false");
750
+ if (!this.permissions.canReadContent) return omittedSection({
751
+ scopes: scope.ancestors,
752
+ items: []
753
+ }, "missing content:read permission");
754
+ const entries = await new ContextRepository(this.db).listStale({
755
+ scopes: scope.ancestors,
756
+ contextTypes: contextTypes.length > 0 ? contextTypes : void 0,
757
+ limit: 50,
758
+ now: this.now.toISOString()
759
+ });
760
+ return includedSection({
761
+ scopes: scope.ancestors,
762
+ items: entries.items.map((entry) => summarizeStaleWarning(entry))
763
+ });
764
+ }
765
+ async loadReviewRequestsSection(scope) {
766
+ if (!this.permissions.canReadContent) return omittedSection({
767
+ scopes: scope.ancestors,
768
+ items: []
769
+ }, "missing content:read permission");
770
+ const requests = await new ReviewRequestRepository(this.db).list({
771
+ status: "pending",
772
+ scopes: scope.ancestors,
773
+ limit: DEFAULT_REVIEW_REQUEST_LIMIT
774
+ });
775
+ return includedSection({
776
+ scopes: scope.ancestors,
777
+ items: requests.items.map((request) => summarizeReviewRequest(request))
778
+ });
779
+ }
780
+ canIncludeActivity(activity) {
781
+ if (activity.actionType.startsWith("content.")) return this.permissions.canReadContent;
782
+ if (activity.actionType.startsWith("schema.")) return this.permissions.canReadSchema;
783
+ if (activity.actionType.startsWith("plugin.")) return this.permissions.canReadPlugins;
784
+ if (activity.actionType.startsWith("settings.")) return this.permissions.canReadSettings;
785
+ return this.permissions.canReadContent;
786
+ }
787
+ };
788
+ function parseSiteBriefingScope(scope) {
789
+ const parts = scope.split(":");
790
+ if (scope === "site") return {
791
+ type: "site",
792
+ scope: "site",
793
+ ancestors: ["site"]
794
+ };
795
+ if (parts[0] === "collection" && parts.length === 2 && isCollectionSlug(parts[1])) {
796
+ const resolved = `collection:${parts[1]}`;
797
+ return {
798
+ type: "collection",
799
+ scope: resolved,
800
+ ancestors: ["site", resolved],
801
+ collection: parts[1]
802
+ };
803
+ }
804
+ if (parts[0] === "content" && parts.length === 3 && isCollectionSlug(parts[1]) && parts[2].length > 0) {
805
+ const collectionScope = `collection:${parts[1]}`;
806
+ const resolved = `content:${parts[1]}:${parts[2]}`;
807
+ return {
808
+ type: "content",
809
+ scope: resolved,
810
+ ancestors: [
811
+ "site",
812
+ collectionScope,
813
+ resolved
814
+ ],
815
+ collection: parts[1],
816
+ contentId: parts[2]
817
+ };
818
+ }
819
+ if (parts[0] === "plugin" && parts.length === 2 && parts[1].length > 0) {
820
+ const resolved = `plugin:${parts[1]}`;
821
+ return {
822
+ type: "plugin",
823
+ scope: resolved,
824
+ ancestors: ["site", resolved],
825
+ pluginId: parts[1]
826
+ };
827
+ }
828
+ if (parts[0] === "taxonomy" && parts.length === 2 && parts[1].length > 0) {
829
+ const resolved = `taxonomy:${parts[1]}`;
830
+ return {
831
+ type: "taxonomy",
832
+ scope: resolved,
833
+ ancestors: ["site", resolved],
834
+ taxonomyId: parts[1]
835
+ };
836
+ }
837
+ if (parts[0] === "menu" && parts.length === 2 && parts[1].length > 0) {
838
+ const resolved = `menu:${parts[1]}`;
839
+ return {
840
+ type: "menu",
841
+ scope: resolved,
842
+ ancestors: ["site", resolved],
843
+ menuId: parts[1]
844
+ };
845
+ }
846
+ throw new SiteBriefingError(`Invalid scope "${scope}". Expected site, collection:{slug}, content:{collection}:{id}, plugin:{id}, taxonomy:{id}, or menu:{id}.`, "INVALID_SCOPE");
847
+ }
848
+ function formatSiteBriefingText(briefing) {
849
+ const lines = [];
850
+ lines.push(`# Site Briefing: ${briefing.scope.resolved}`);
851
+ lines.push(`Generated: ${briefing.generatedAt}`);
852
+ if (briefing.since) lines.push(`Since: ${briefing.since}`);
853
+ lines.push("");
854
+ if (briefing.sections.schema.status === "included") {
855
+ lines.push("## Schema");
856
+ for (const collection of briefing.sections.schema.data.collections) lines.push(`- ${collection.slug}: ${collection.label} (${collection.fields.length} fields, supports: ${collection.supports.join(", ") || "none"})`);
857
+ lines.push("");
858
+ }
859
+ if (briefing.sections.contextEntries.status === "included") {
860
+ lines.push("## Context Entries");
861
+ for (const group of briefing.sections.contextEntries.data.groups) {
862
+ lines.push(`### ${group.contextType}`);
863
+ for (const entry of group.items) lines.push(`- ${entry.scope}: ${entry.title} - ${entry.body}`);
864
+ }
865
+ if (briefing.sections.contextEntries.data.groups.length === 0) lines.push("- No active context entries.");
866
+ lines.push("");
867
+ }
868
+ if (briefing.sections.activity.status === "included") {
869
+ lines.push("## Recent Activity");
870
+ for (const activity of briefing.sections.activity.data.items) lines.push(`- ${activity.createdAt}: ${activity.actionType} - ${activity.summary}`);
871
+ if (briefing.sections.activity.data.items.length === 0) lines.push("- No matching activity.");
872
+ lines.push("");
873
+ }
874
+ if (briefing.sections.staleWarnings.status === "included") {
875
+ lines.push("## Stale Context Warnings");
876
+ for (const warning of briefing.sections.staleWarnings.data.items) lines.push(`- ${warning.scope} ${warning.contextType} ${warning.title}${warning.validUntil ? ` (expired ${warning.validUntil})` : ""}`);
877
+ if (briefing.sections.staleWarnings.data.items.length === 0) lines.push("- No stale context warnings.");
878
+ lines.push("");
879
+ }
880
+ if (briefing.sections.reviewRequests.status === "included") {
881
+ lines.push("## Open Review Requests");
882
+ for (const request of briefing.sections.reviewRequests.data.items) lines.push(`- ${request.createdAt}: ${request.id} ${request.actionType} for ${request.scope}${request.summary ? ` - ${request.summary}` : ""}`);
883
+ if (briefing.sections.reviewRequests.data.items.length === 0) lines.push("- No open review requests.");
884
+ lines.push("");
885
+ }
886
+ if (briefing.sections.plugins.status === "included") {
887
+ lines.push("## Active Plugins");
888
+ for (const plugin of briefing.sections.plugins.data.active) lines.push(`- ${plugin.id}@${plugin.version}: ${plugin.capabilities.join(", ") || "no capabilities"}`);
889
+ if (briefing.sections.plugins.data.active.length === 0) lines.push("- No active plugins.");
890
+ lines.push("");
891
+ }
892
+ if (briefing.sections.settings.status === "included" && briefing.sections.settings.data) {
893
+ const settings = briefing.sections.settings.data;
894
+ lines.push("## Site Settings");
895
+ lines.push(`- Title: ${settings.title ?? "(unset)"}`);
896
+ if (settings.tagline) lines.push(`- Tagline: ${settings.tagline}`);
897
+ if (settings.url) lines.push(`- URL: ${settings.url}`);
898
+ lines.push("");
899
+ }
900
+ const unavailable = Object.entries(briefing.sections).filter(([, section]) => section.status === "not_available").map(([key, section]) => `${key}: ${section.reason ?? "not available"}`);
901
+ if (unavailable.length > 0) {
902
+ lines.push("## Not Yet Available");
903
+ for (const item of unavailable) lines.push(`- ${item}`);
904
+ }
905
+ return lines.join("\n").trim();
906
+ }
907
+ function compactCollection(collection) {
908
+ if (!collection) return [];
909
+ return [{
910
+ slug: collection.slug,
911
+ label: collection.label,
912
+ labelSingular: collection.labelSingular,
913
+ description: collection.description,
914
+ supports: collection.supports,
915
+ hasSeo: collection.hasSeo,
916
+ urlPattern: collection.urlPattern,
917
+ comments: {
918
+ enabled: collection.commentsEnabled,
919
+ moderation: collection.commentsModeration,
920
+ closedAfterDays: collection.commentsClosedAfterDays,
921
+ autoApproveUsers: collection.commentsAutoApproveUsers
922
+ },
923
+ fields: collection.fields.map((field) => summarizeField(field))
924
+ }];
925
+ }
926
+ function summarizeField(field) {
927
+ return {
928
+ slug: field.slug,
929
+ label: field.label,
930
+ type: field.type,
931
+ required: field.required,
932
+ unique: field.unique,
933
+ searchable: field.searchable,
934
+ translatable: field.translatable,
935
+ referenceCollection: field.type === "reference" && typeof field.options?.collection === "string" ? field.options.collection : void 0
936
+ };
937
+ }
938
+ function summarizeActivity(activity) {
939
+ return {
940
+ id: activity.id,
941
+ actionType: activity.actionType,
942
+ subjectType: activity.subjectType,
943
+ subjectId: activity.subjectId,
944
+ relatedSubjectType: activity.relatedSubjectType,
945
+ relatedSubjectId: activity.relatedSubjectId,
946
+ sourceType: activity.sourceType,
947
+ sourceName: activity.sourceName,
948
+ resultStatus: activity.resultStatus,
949
+ scope: activity.scope,
950
+ summary: activity.summary,
951
+ actorType: activity.actorType,
952
+ actorId: activity.actorId,
953
+ detail: summarizeActivityDetail(activity.detail),
954
+ createdAt: activity.createdAt
955
+ };
956
+ }
957
+ function summarizeContextEntry(entry) {
958
+ return {
959
+ id: entry.id,
960
+ scope: entry.scope,
961
+ contextType: entry.contextType,
962
+ title: entry.title,
963
+ body: entry.body,
964
+ policyKey: entry.policyKey,
965
+ supersedesId: entry.supersedesId,
966
+ version: entry.version,
967
+ validUntil: entry.validUntil,
968
+ reviewedAt: entry.reviewedAt,
969
+ tags: entry.tags,
970
+ updatedAt: entry.updatedAt
971
+ };
972
+ }
973
+ function selectActiveBriefingContextEntries(entries, ancestorScopes, now) {
974
+ const activeEntries = entries.filter((entry) => !isStaleContextEntry(entry, now));
975
+ const scopeOrder = new Map(ancestorScopes.map((scope, index) => [scope, index]));
976
+ const narrowestScopeByPolicyKey = /* @__PURE__ */ new Map();
977
+ for (const entry of activeEntries) {
978
+ if (!entry.policyKey) continue;
979
+ const scopeIndex = scopeOrder.get(entry.scope);
980
+ if (scopeIndex === void 0) continue;
981
+ const current = narrowestScopeByPolicyKey.get(entry.policyKey);
982
+ if (current === void 0 || scopeIndex > current) narrowestScopeByPolicyKey.set(entry.policyKey, scopeIndex);
983
+ }
984
+ return activeEntries.filter((entry) => {
985
+ if (!entry.policyKey) return true;
986
+ const scopeIndex = scopeOrder.get(entry.scope);
987
+ if (scopeIndex === void 0) return true;
988
+ return narrowestScopeByPolicyKey.get(entry.policyKey) === scopeIndex;
989
+ });
990
+ }
991
+ function groupContextEntries(entries) {
992
+ const grouped = /* @__PURE__ */ new Map();
993
+ for (const entry of entries) {
994
+ const items = grouped.get(entry.contextType) ?? [];
995
+ items.push(entry);
996
+ grouped.set(entry.contextType, items);
997
+ }
998
+ return SITE_CONTEXT_TYPES.flatMap((contextType) => {
999
+ const items = grouped.get(contextType);
1000
+ return items && items.length > 0 ? [{
1001
+ contextType,
1002
+ items
1003
+ }] : [];
1004
+ });
1005
+ }
1006
+ function summarizeStaleWarning(entry) {
1007
+ return {
1008
+ id: entry.id,
1009
+ scope: entry.scope,
1010
+ contextType: entry.contextType,
1011
+ title: entry.title,
1012
+ policyKey: entry.policyKey,
1013
+ validUntil: entry.validUntil,
1014
+ reviewedAt: entry.reviewedAt,
1015
+ updatedAt: entry.updatedAt
1016
+ };
1017
+ }
1018
+ function isStaleContextEntry(entry, now) {
1019
+ if (!entry.validUntil) return false;
1020
+ return entry.validUntil < now.toISOString();
1021
+ }
1022
+ function summarizeActivityDetail(detail) {
1023
+ if (!detail) return null;
1024
+ const allowedKeys = [
1025
+ "collection",
1026
+ "entryId",
1027
+ "field",
1028
+ "fieldType",
1029
+ "pluginId",
1030
+ "status",
1031
+ "scheduledAt",
1032
+ "changedFields",
1033
+ "slugChanged",
1034
+ "authorChanged"
1035
+ ];
1036
+ const summary = {};
1037
+ for (const key of allowedKeys) if (key in detail) summary[key] = detail[key];
1038
+ return Object.keys(summary).length > 0 ? summary : null;
1039
+ }
1040
+ function summarizePlugin(plugin) {
1041
+ return {
1042
+ id: plugin.id,
1043
+ name: plugin.name,
1044
+ version: plugin.version,
1045
+ status: plugin.status,
1046
+ capabilities: plugin.capabilities.toSorted(),
1047
+ hasAdminPages: plugin.hasAdminPages,
1048
+ hasDashboardWidgets: plugin.hasDashboardWidgets,
1049
+ hasHooks: plugin.hasHooks
1050
+ };
1051
+ }
1052
+ function summarizeSettings(settings) {
1053
+ const social = settings.social ?? {};
1054
+ return {
1055
+ title: settings.title,
1056
+ tagline: settings.tagline,
1057
+ url: settings.url,
1058
+ timezone: settings.timezone,
1059
+ dateFormat: settings.dateFormat,
1060
+ postsPerPage: settings.postsPerPage,
1061
+ branding: {
1062
+ logoConfigured: Boolean(settings.logo),
1063
+ faviconConfigured: Boolean(settings.favicon)
1064
+ },
1065
+ socialChannels: Object.entries(social).filter(([, value]) => typeof value === "string" && value.length > 0).map(([key]) => key).toSorted(),
1066
+ seo: {
1067
+ titleSeparator: settings.seo?.titleSeparator,
1068
+ defaultOgImageConfigured: Boolean(settings.seo?.defaultOgImage),
1069
+ robotsTxtConfigured: Boolean(settings.seo?.robotsTxt),
1070
+ googleVerificationConfigured: Boolean(settings.seo?.googleVerification),
1071
+ bingVerificationConfigured: Boolean(settings.seo?.bingVerification)
1072
+ }
1073
+ };
1074
+ }
1075
+ function summarizeReviewRequest(request) {
1076
+ return {
1077
+ id: request.id,
1078
+ status: request.status,
1079
+ scope: request.scope,
1080
+ collection: request.collection,
1081
+ entryId: request.entryId,
1082
+ actionType: request.actionType,
1083
+ riskReason: request.riskReason,
1084
+ summary: reviewPayloadSummary(request.reviewPayload),
1085
+ liveRevisionId: request.liveRevisionId,
1086
+ draftRevisionId: request.draftRevisionId,
1087
+ reviewedRev: request.reviewedRev,
1088
+ actionHash: request.actionHash,
1089
+ requestedByActorType: request.requestedByActorType,
1090
+ requestedByActorId: request.requestedByActorId,
1091
+ createdAt: request.createdAt,
1092
+ updatedAt: request.updatedAt
1093
+ };
1094
+ }
1095
+ function reviewPayloadSummary(payload) {
1096
+ const summary = payload.summary;
1097
+ return typeof summary === "string" && summary.length > 0 ? summary : null;
1098
+ }
1099
+ function resolveSince(value, now) {
1100
+ if (!value) return null;
1101
+ const relative = RELATIVE_SINCE_PATTERN.exec(value);
1102
+ if (relative) {
1103
+ const amount = Number(relative[1]);
1104
+ const unit = relative[2].toLowerCase();
1105
+ const multiplier = unit === "m" ? 60 * 1e3 : unit === "h" ? 3600 * 1e3 : unit === "d" ? 1440 * 60 * 1e3 : 10080 * 60 * 1e3;
1106
+ return new Date(now.getTime() - amount * multiplier).toISOString();
1107
+ }
1108
+ const parsed = new Date(value);
1109
+ if (Number.isNaN(parsed.getTime())) throw new SiteBriefingError(`Invalid since value "${value}". Use an ISO timestamp or relative value like 7d.`, "INVALID_SINCE");
1110
+ return parsed.toISOString();
1111
+ }
1112
+ function parseContextTypes(values) {
1113
+ return values.map((value) => {
1114
+ if (!isSiteContextType(value)) throw new SiteBriefingError(`Invalid context type "${value}".`, "INVALID_CONTEXT_TYPE");
1115
+ return value;
1116
+ });
1117
+ }
1118
+ function applyTokenBudget(briefing, tokenBudget) {
1119
+ let used = estimateTokens({
1120
+ kind: briefing.kind,
1121
+ generatedAt: briefing.generatedAt,
1122
+ scope: briefing.scope,
1123
+ since: briefing.since
1124
+ });
1125
+ const schemaTokens = estimateSection(briefing.sections.schema);
1126
+ briefing.sections.schema.tokenEstimate = schemaTokens;
1127
+ used += schemaTokens;
1128
+ const packing = [{
1129
+ section: "schema",
1130
+ priority: 1,
1131
+ status: briefing.sections.schema.status,
1132
+ truncated: false,
1133
+ reason: "schema snapshot is never truncated"
1134
+ }];
1135
+ used = packContextGroupSection(briefing.sections.contextEntries, used, tokenBudget, packing, "contextEntries", 2);
1136
+ used = packArraySection(briefing.sections.activity, "items", used, tokenBudget, packing, "activity", 3);
1137
+ used = packArraySection(briefing.sections.plugins, "active", used, tokenBudget, packing, "plugins", 4);
1138
+ used = packScalarSection(briefing.sections.settings, used, tokenBudget, packing, "settings", 5);
1139
+ used = packArraySection(briefing.sections.staleWarnings, "items", used, tokenBudget, packing, "staleWarnings", 6);
1140
+ used = packArraySection(briefing.sections.reviewRequests, "items", used, tokenBudget, packing, "reviewRequests", 7);
1141
+ briefing.packing = packing;
1142
+ briefing.tokenEstimate = estimateTokens(briefing);
1143
+ briefing.truncated = packing.some((item) => item.truncated);
1144
+ return briefing;
1145
+ }
1146
+ function packContextGroupSection(section, used, tokenBudget, packing, sectionName, priority) {
1147
+ section.tokenEstimate = estimateSection(section);
1148
+ if (section.status !== "included") {
1149
+ packing.push({
1150
+ section: sectionName,
1151
+ priority,
1152
+ status: section.status,
1153
+ truncated: false,
1154
+ reason: section.reason
1155
+ });
1156
+ return used + section.tokenEstimate;
1157
+ }
1158
+ const originalCount = section.data.groups.reduce((total, group) => total + group.items.length, 0);
1159
+ const keptGroups = [];
1160
+ let nextUsed = used + estimateTokens({
1161
+ ...section,
1162
+ data: {
1163
+ ...section.data,
1164
+ groups: []
1165
+ }
1166
+ });
1167
+ let truncated = false;
1168
+ for (const group of section.data.groups) {
1169
+ const keptItems = [];
1170
+ for (const item of group.items) {
1171
+ const itemTokens = estimateTokens(item);
1172
+ if (nextUsed + itemTokens > tokenBudget) {
1173
+ truncated = true;
1174
+ break;
1175
+ }
1176
+ keptItems.push(item);
1177
+ nextUsed += itemTokens;
1178
+ }
1179
+ if (keptItems.length > 0) keptGroups.push({
1180
+ ...group,
1181
+ items: keptItems
1182
+ });
1183
+ if (truncated) break;
1184
+ }
1185
+ if (keptGroups.reduce((total, group) => total + group.items.length, 0) !== originalCount) {
1186
+ section.data = {
1187
+ ...section.data,
1188
+ groups: keptGroups
1189
+ };
1190
+ section.truncated = true;
1191
+ }
1192
+ section.tokenEstimate = estimateSection(section);
1193
+ packing.push({
1194
+ section: sectionName,
1195
+ priority,
1196
+ status: section.status,
1197
+ truncated: Boolean(section.truncated),
1198
+ reason: section.reason
1199
+ });
1200
+ return nextUsed;
1201
+ }
1202
+ function packArraySection(section, arrayKey, used, tokenBudget, packing, sectionName, priority) {
1203
+ section.tokenEstimate = estimateSection(section);
1204
+ const value = section.data[arrayKey];
1205
+ if (!Array.isArray(value) || section.status !== "included") {
1206
+ packing.push({
1207
+ section: sectionName,
1208
+ priority,
1209
+ status: section.status,
1210
+ truncated: false,
1211
+ reason: section.reason
1212
+ });
1213
+ return used + section.tokenEstimate;
1214
+ }
1215
+ const kept = [];
1216
+ let nextUsed = used + estimateTokens({
1217
+ ...section,
1218
+ data: {
1219
+ ...section.data,
1220
+ [arrayKey]: []
1221
+ }
1222
+ });
1223
+ for (const item of value) {
1224
+ const itemTokens = estimateTokens(item);
1225
+ if (nextUsed + itemTokens > tokenBudget) {
1226
+ section.truncated = true;
1227
+ break;
1228
+ }
1229
+ kept.push(item);
1230
+ nextUsed += itemTokens;
1231
+ }
1232
+ if (kept.length !== value.length) {
1233
+ section.data = {
1234
+ ...section.data,
1235
+ [arrayKey]: kept
1236
+ };
1237
+ section.truncated = true;
1238
+ }
1239
+ section.tokenEstimate = estimateSection(section);
1240
+ packing.push({
1241
+ section: sectionName,
1242
+ priority,
1243
+ status: section.status,
1244
+ truncated: Boolean(section.truncated),
1245
+ reason: section.reason
1246
+ });
1247
+ return nextUsed;
1248
+ }
1249
+ function packScalarSection(section, used, tokenBudget, packing, sectionName, priority) {
1250
+ section.tokenEstimate = estimateSection(section);
1251
+ if (section.status === "included" && section.data !== null && used + section.tokenEstimate > tokenBudget) {
1252
+ section.data = null;
1253
+ section.truncated = true;
1254
+ section.tokenEstimate = estimateSection(section);
1255
+ }
1256
+ packing.push({
1257
+ section: sectionName,
1258
+ priority,
1259
+ status: section.status,
1260
+ truncated: Boolean(section.truncated),
1261
+ reason: section.reason
1262
+ });
1263
+ return used + section.tokenEstimate;
1264
+ }
1265
+ function includedSection(data) {
1266
+ return {
1267
+ status: "included",
1268
+ data,
1269
+ tokenEstimate: estimateTokens(data)
1270
+ };
1271
+ }
1272
+ function omittedSection(data, reason) {
1273
+ return {
1274
+ status: "omitted",
1275
+ reason,
1276
+ data,
1277
+ tokenEstimate: estimateTokens(data)
1278
+ };
1279
+ }
1280
+ function estimateSection(section) {
1281
+ return estimateTokens(section);
1282
+ }
1283
+ function estimateTokens(value) {
1284
+ return Math.ceil(JSON.stringify(value).length / TOKEN_CHARS);
1285
+ }
1286
+ function clampLimit(value) {
1287
+ return Math.min(Math.max(1, Math.floor(value)), MAX_ACTIVITY_LIMIT);
1288
+ }
1289
+ function isCollectionSlug(value) {
1290
+ return typeof value === "string" && COLLECTION_SLUG_PATTERN.test(value);
1291
+ }
1292
+
1293
+ //#endregion
1294
+ export { ContextRepository as a, handlePluginGet as c, parseSiteBriefingScope as i, handlePluginList as l, SiteBriefingError as n, handlePluginDisable as o, formatSiteBriefingText as r, handlePluginEnable as s, SiteBriefingAssembler as t, PluginStateRepository as u };