@abraca/junis 2.80.0

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 (383) hide show
  1. package/README.md +594 -0
  2. package/dist/module.d.mts +158 -0
  3. package/dist/module.json +12 -0
  4. package/dist/module.mjs +957 -0
  5. package/dist/runtime/assets/css/jun.css +13 -0
  6. package/dist/runtime/components/JunAnnouncement.d.vue.ts +3 -0
  7. package/dist/runtime/components/JunAnnouncement.vue +88 -0
  8. package/dist/runtime/components/JunAnnouncement.vue.d.ts +3 -0
  9. package/dist/runtime/components/JunAppreciate.d.vue.ts +6 -0
  10. package/dist/runtime/components/JunAppreciate.vue +71 -0
  11. package/dist/runtime/components/JunAppreciate.vue.d.ts +6 -0
  12. package/dist/runtime/components/JunBackgroundPhoto.d.vue.ts +3 -0
  13. package/dist/runtime/components/JunBackgroundPhoto.vue +23 -0
  14. package/dist/runtime/components/JunBackgroundPhoto.vue.d.ts +3 -0
  15. package/dist/runtime/components/JunBlobBackdrop.client.d.vue.ts +3 -0
  16. package/dist/runtime/components/JunBlobBackdrop.client.vue +120 -0
  17. package/dist/runtime/components/JunBlobBackdrop.client.vue.d.ts +3 -0
  18. package/dist/runtime/components/JunBreadcrumbs.d.vue.ts +16 -0
  19. package/dist/runtime/components/JunBreadcrumbs.vue +63 -0
  20. package/dist/runtime/components/JunBreadcrumbs.vue.d.ts +16 -0
  21. package/dist/runtime/components/JunCampfireChat.d.vue.ts +14 -0
  22. package/dist/runtime/components/JunCampfireChat.vue +136 -0
  23. package/dist/runtime/components/JunCampfireChat.vue.d.ts +14 -0
  24. package/dist/runtime/components/JunCampfirePanel.d.vue.ts +33 -0
  25. package/dist/runtime/components/JunCampfirePanel.vue +202 -0
  26. package/dist/runtime/components/JunCampfirePanel.vue.d.ts +33 -0
  27. package/dist/runtime/components/JunCampfirePresence.client.d.vue.ts +3 -0
  28. package/dist/runtime/components/JunCampfirePresence.client.vue +321 -0
  29. package/dist/runtime/components/JunCampfirePresence.client.vue.d.ts +3 -0
  30. package/dist/runtime/components/JunCampfireRoster.d.vue.ts +19 -0
  31. package/dist/runtime/components/JunCampfireRoster.vue +259 -0
  32. package/dist/runtime/components/JunCampfireRoster.vue.d.ts +19 -0
  33. package/dist/runtime/components/JunCampfireYou.d.vue.ts +10 -0
  34. package/dist/runtime/components/JunCampfireYou.vue +157 -0
  35. package/dist/runtime/components/JunCampfireYou.vue.d.ts +10 -0
  36. package/dist/runtime/components/JunDocSurface.d.vue.ts +34 -0
  37. package/dist/runtime/components/JunDocSurface.vue +117 -0
  38. package/dist/runtime/components/JunDocSurface.vue.d.ts +34 -0
  39. package/dist/runtime/components/JunFestivalPlayer.client.d.vue.ts +3 -0
  40. package/dist/runtime/components/JunFestivalPlayer.client.vue +471 -0
  41. package/dist/runtime/components/JunFestivalPlayer.client.vue.d.ts +3 -0
  42. package/dist/runtime/components/JunFooter.d.vue.ts +3 -0
  43. package/dist/runtime/components/JunFooter.vue +102 -0
  44. package/dist/runtime/components/JunFooter.vue.d.ts +3 -0
  45. package/dist/runtime/components/JunGlobeEditor.client.d.vue.ts +43 -0
  46. package/dist/runtime/components/JunGlobeEditor.client.vue +315 -0
  47. package/dist/runtime/components/JunGlobeEditor.client.vue.d.ts +43 -0
  48. package/dist/runtime/components/JunGlobeMap.client.d.vue.ts +58 -0
  49. package/dist/runtime/components/JunGlobeMap.client.vue +495 -0
  50. package/dist/runtime/components/JunGlobeMap.client.vue.d.ts +58 -0
  51. package/dist/runtime/components/JunHead.d.vue.ts +3 -0
  52. package/dist/runtime/components/JunHead.vue +79 -0
  53. package/dist/runtime/components/JunHead.vue.d.ts +3 -0
  54. package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +0 -0
  55. package/dist/runtime/components/JunHorizontalTimeline.vue +363 -0
  56. package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +0 -0
  57. package/dist/runtime/components/JunImagePopup.client.d.vue.ts +3 -0
  58. package/dist/runtime/components/JunImagePopup.client.vue +422 -0
  59. package/dist/runtime/components/JunImagePopup.client.vue.d.ts +3 -0
  60. package/dist/runtime/components/JunIntro.d.vue.ts +3 -0
  61. package/dist/runtime/components/JunIntro.vue +156 -0
  62. package/dist/runtime/components/JunIntro.vue.d.ts +3 -0
  63. package/dist/runtime/components/JunItemMenu.d.vue.ts +50 -0
  64. package/dist/runtime/components/JunItemMenu.vue +97 -0
  65. package/dist/runtime/components/JunItemMenu.vue.d.ts +50 -0
  66. package/dist/runtime/components/JunLinksRow.d.vue.ts +19 -0
  67. package/dist/runtime/components/JunLinksRow.vue +96 -0
  68. package/dist/runtime/components/JunLinksRow.vue.d.ts +19 -0
  69. package/dist/runtime/components/JunLogo.d.vue.ts +15 -0
  70. package/dist/runtime/components/JunLogo.vue +360 -0
  71. package/dist/runtime/components/JunLogo.vue.d.ts +15 -0
  72. package/dist/runtime/components/JunMedia.client.d.vue.ts +40 -0
  73. package/dist/runtime/components/JunMedia.client.vue +117 -0
  74. package/dist/runtime/components/JunMedia.client.vue.d.ts +40 -0
  75. package/dist/runtime/components/JunMosaicPane.client.d.vue.ts +24 -0
  76. package/dist/runtime/components/JunMosaicPane.client.vue +95 -0
  77. package/dist/runtime/components/JunMosaicPane.client.vue.d.ts +24 -0
  78. package/dist/runtime/components/JunNavigation.d.vue.ts +26 -0
  79. package/dist/runtime/components/JunNavigation.vue +1149 -0
  80. package/dist/runtime/components/JunNavigation.vue.d.ts +26 -0
  81. package/dist/runtime/components/JunNodePanel.client.d.vue.ts +3 -0
  82. package/dist/runtime/components/JunNodePanel.client.vue +23 -0
  83. package/dist/runtime/components/JunNodePanel.client.vue.d.ts +3 -0
  84. package/dist/runtime/components/JunNotFound.d.vue.ts +7 -0
  85. package/dist/runtime/components/JunNotFound.vue +137 -0
  86. package/dist/runtime/components/JunNotFound.vue.d.ts +7 -0
  87. package/dist/runtime/components/JunPageHero.d.vue.ts +25 -0
  88. package/dist/runtime/components/JunPageHero.vue +90 -0
  89. package/dist/runtime/components/JunPageHero.vue.d.ts +25 -0
  90. package/dist/runtime/components/JunPatternBackdrop.client.d.vue.ts +7 -0
  91. package/dist/runtime/components/JunPatternBackdrop.client.vue +95 -0
  92. package/dist/runtime/components/JunPatternBackdrop.client.vue.d.ts +7 -0
  93. package/dist/runtime/components/JunPeerCursors.client.d.vue.ts +3 -0
  94. package/dist/runtime/components/JunPeerCursors.client.vue +123 -0
  95. package/dist/runtime/components/JunPeerCursors.client.vue.d.ts +3 -0
  96. package/dist/runtime/components/JunPresenceBlobs.client.d.vue.ts +3 -0
  97. package/dist/runtime/components/JunPresenceBlobs.client.vue +172 -0
  98. package/dist/runtime/components/JunPresenceBlobs.client.vue.d.ts +3 -0
  99. package/dist/runtime/components/JunSearch.client.d.vue.ts +3 -0
  100. package/dist/runtime/components/JunSearch.client.vue +809 -0
  101. package/dist/runtime/components/JunSearch.client.vue.d.ts +3 -0
  102. package/dist/runtime/components/JunServiceCard.d.vue.ts +10 -0
  103. package/dist/runtime/components/JunServiceCard.vue +145 -0
  104. package/dist/runtime/components/JunServiceCard.vue.d.ts +10 -0
  105. package/dist/runtime/components/JunShaderBackdrop.client.d.vue.ts +3 -0
  106. package/dist/runtime/components/JunShaderBackdrop.client.vue +82 -0
  107. package/dist/runtime/components/JunShaderBackdrop.client.vue.d.ts +3 -0
  108. package/dist/runtime/components/JunShell.d.vue.ts +17 -0
  109. package/dist/runtime/components/JunShell.vue +80 -0
  110. package/dist/runtime/components/JunShell.vue.d.ts +17 -0
  111. package/dist/runtime/components/JunStudioBar.client.d.vue.ts +3 -0
  112. package/dist/runtime/components/JunStudioBar.client.vue +462 -0
  113. package/dist/runtime/components/JunStudioBar.client.vue.d.ts +3 -0
  114. package/dist/runtime/components/JunStudioLogin.client.d.vue.ts +3 -0
  115. package/dist/runtime/components/JunStudioLogin.client.vue +58 -0
  116. package/dist/runtime/components/JunStudioLogin.client.vue.d.ts +3 -0
  117. package/dist/runtime/components/JunThemeToggle.d.vue.ts +3 -0
  118. package/dist/runtime/components/JunThemeToggle.vue +32 -0
  119. package/dist/runtime/components/JunThemeToggle.vue.d.ts +3 -0
  120. package/dist/runtime/components/JunTravellersChip.d.vue.ts +9 -0
  121. package/dist/runtime/components/JunTravellersChip.vue +111 -0
  122. package/dist/runtime/components/JunTravellersChip.vue.d.ts +9 -0
  123. package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +23 -0
  124. package/dist/runtime/components/JunVideoEmbed.client.vue +124 -0
  125. package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +23 -0
  126. package/dist/runtime/components/css-modules.d.ts +7 -0
  127. package/dist/runtime/components/renderers/.gitkeep +0 -0
  128. package/dist/runtime/components/renderers/JunAppsRenderer.d.vue.ts +10 -0
  129. package/dist/runtime/components/renderers/JunAppsRenderer.vue +271 -0
  130. package/dist/runtime/components/renderers/JunAppsRenderer.vue.d.ts +10 -0
  131. package/dist/runtime/components/renderers/JunCinemaRenderer.d.vue.ts +10 -0
  132. package/dist/runtime/components/renderers/JunCinemaRenderer.vue +465 -0
  133. package/dist/runtime/components/renderers/JunCinemaRenderer.vue.d.ts +10 -0
  134. package/dist/runtime/components/renderers/JunConfigRenderer.d.vue.ts +10 -0
  135. package/dist/runtime/components/renderers/JunConfigRenderer.vue +2045 -0
  136. package/dist/runtime/components/renderers/JunConfigRenderer.vue.d.ts +10 -0
  137. package/dist/runtime/components/renderers/JunCvRenderer.d.vue.ts +10 -0
  138. package/dist/runtime/components/renderers/JunCvRenderer.vue +256 -0
  139. package/dist/runtime/components/renderers/JunCvRenderer.vue.d.ts +10 -0
  140. package/dist/runtime/components/renderers/JunEntryRenderer.d.vue.ts +10 -0
  141. package/dist/runtime/components/renderers/JunEntryRenderer.vue +429 -0
  142. package/dist/runtime/components/renderers/JunEntryRenderer.vue.d.ts +10 -0
  143. package/dist/runtime/components/renderers/JunFestivalRenderer.d.vue.ts +10 -0
  144. package/dist/runtime/components/renderers/JunFestivalRenderer.vue +557 -0
  145. package/dist/runtime/components/renderers/JunFestivalRenderer.vue.d.ts +10 -0
  146. package/dist/runtime/components/renderers/JunGlobeRenderer.d.vue.ts +10 -0
  147. package/dist/runtime/components/renderers/JunGlobeRenderer.vue +91 -0
  148. package/dist/runtime/components/renderers/JunGlobeRenderer.vue.d.ts +10 -0
  149. package/dist/runtime/components/renderers/JunGuestbookRenderer.d.vue.ts +10 -0
  150. package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +326 -0
  151. package/dist/runtime/components/renderers/JunGuestbookRenderer.vue.d.ts +10 -0
  152. package/dist/runtime/components/renderers/JunHomeRenderer.d.vue.ts +10 -0
  153. package/dist/runtime/components/renderers/JunHomeRenderer.vue +585 -0
  154. package/dist/runtime/components/renderers/JunHomeRenderer.vue.d.ts +10 -0
  155. package/dist/runtime/components/renderers/JunJournalRenderer.d.vue.ts +10 -0
  156. package/dist/runtime/components/renderers/JunJournalRenderer.vue +420 -0
  157. package/dist/runtime/components/renderers/JunJournalRenderer.vue.d.ts +10 -0
  158. package/dist/runtime/components/renderers/JunLibraryRenderer.d.vue.ts +10 -0
  159. package/dist/runtime/components/renderers/JunLibraryRenderer.vue +319 -0
  160. package/dist/runtime/components/renderers/JunLibraryRenderer.vue.d.ts +10 -0
  161. package/dist/runtime/components/renderers/JunLinksRenderer.d.vue.ts +10 -0
  162. package/dist/runtime/components/renderers/JunLinksRenderer.vue +206 -0
  163. package/dist/runtime/components/renderers/JunLinksRenderer.vue.d.ts +10 -0
  164. package/dist/runtime/components/renderers/JunLiveRenderer.d.vue.ts +10 -0
  165. package/dist/runtime/components/renderers/JunLiveRenderer.vue +684 -0
  166. package/dist/runtime/components/renderers/JunLiveRenderer.vue.d.ts +10 -0
  167. package/dist/runtime/components/renderers/JunMosaicRenderer.d.vue.ts +10 -0
  168. package/dist/runtime/components/renderers/JunMosaicRenderer.vue +572 -0
  169. package/dist/runtime/components/renderers/JunMosaicRenderer.vue.d.ts +10 -0
  170. package/dist/runtime/components/renderers/JunMovieRenderer.d.vue.ts +10 -0
  171. package/dist/runtime/components/renderers/JunMovieRenderer.vue +539 -0
  172. package/dist/runtime/components/renderers/JunMovieRenderer.vue.d.ts +10 -0
  173. package/dist/runtime/components/renderers/JunNowRenderer.d.vue.ts +10 -0
  174. package/dist/runtime/components/renderers/JunNowRenderer.vue +382 -0
  175. package/dist/runtime/components/renderers/JunNowRenderer.vue.d.ts +10 -0
  176. package/dist/runtime/components/renderers/JunProjectRenderer.d.vue.ts +10 -0
  177. package/dist/runtime/components/renderers/JunProjectRenderer.vue +413 -0
  178. package/dist/runtime/components/renderers/JunProjectRenderer.vue.d.ts +10 -0
  179. package/dist/runtime/components/renderers/JunRedirectRenderer.d.vue.ts +10 -0
  180. package/dist/runtime/components/renderers/JunRedirectRenderer.vue +133 -0
  181. package/dist/runtime/components/renderers/JunRedirectRenderer.vue.d.ts +10 -0
  182. package/dist/runtime/components/renderers/JunServicesRenderer.d.vue.ts +10 -0
  183. package/dist/runtime/components/renderers/JunServicesRenderer.vue +267 -0
  184. package/dist/runtime/components/renderers/JunServicesRenderer.vue.d.ts +10 -0
  185. package/dist/runtime/components/renderers/JunStatsRenderer.d.vue.ts +10 -0
  186. package/dist/runtime/components/renderers/JunStatsRenderer.vue +230 -0
  187. package/dist/runtime/components/renderers/JunStatsRenderer.vue.d.ts +10 -0
  188. package/dist/runtime/components/renderers/JunTrackRenderer.d.vue.ts +10 -0
  189. package/dist/runtime/components/renderers/JunTrackRenderer.vue +380 -0
  190. package/dist/runtime/components/renderers/JunTrackRenderer.vue.d.ts +10 -0
  191. package/dist/runtime/components/renderers/JunUsesRenderer.d.vue.ts +10 -0
  192. package/dist/runtime/components/renderers/JunUsesRenderer.vue +254 -0
  193. package/dist/runtime/components/renderers/JunUsesRenderer.vue.d.ts +10 -0
  194. package/dist/runtime/components/renderers/JunWallRenderer.d.vue.ts +10 -0
  195. package/dist/runtime/components/renderers/JunWallRenderer.vue +276 -0
  196. package/dist/runtime/components/renderers/JunWallRenderer.vue.d.ts +10 -0
  197. package/dist/runtime/components/renderers/JunWindowRenderer.d.vue.ts +10 -0
  198. package/dist/runtime/components/renderers/JunWindowRenderer.vue +516 -0
  199. package/dist/runtime/components/renderers/JunWindowRenderer.vue.d.ts +10 -0
  200. package/dist/runtime/composables/useJunBackdrop.d.ts +9 -0
  201. package/dist/runtime/composables/useJunBackdrop.js +27 -0
  202. package/dist/runtime/composables/useJunBackground.d.ts +78 -0
  203. package/dist/runtime/composables/useJunBackground.js +65 -0
  204. package/dist/runtime/composables/useJunCampfire.d.ts +156 -0
  205. package/dist/runtime/composables/useJunCampfire.js +225 -0
  206. package/dist/runtime/composables/useJunChrome.d.ts +66 -0
  207. package/dist/runtime/composables/useJunChrome.js +233 -0
  208. package/dist/runtime/composables/useJunColorMode.d.ts +8 -0
  209. package/dist/runtime/composables/useJunColorMode.js +11 -0
  210. package/dist/runtime/composables/useJunCommands.d.ts +37 -0
  211. package/dist/runtime/composables/useJunCommands.js +225 -0
  212. package/dist/runtime/composables/useJunCreatePage.d.ts +17 -0
  213. package/dist/runtime/composables/useJunCreatePage.js +30 -0
  214. package/dist/runtime/composables/useJunCurrentDoc.d.ts +5 -0
  215. package/dist/runtime/composables/useJunCurrentDoc.js +14 -0
  216. package/dist/runtime/composables/useJunDocMenu.d.ts +71 -0
  217. package/dist/runtime/composables/useJunDocMenu.js +344 -0
  218. package/dist/runtime/composables/useJunDocPage.d.ts +99 -0
  219. package/dist/runtime/composables/useJunDocPage.js +155 -0
  220. package/dist/runtime/composables/useJunFollow.d.ts +11 -0
  221. package/dist/runtime/composables/useJunFollow.js +38 -0
  222. package/dist/runtime/composables/useJunGroupedDnD.d.ts +74 -0
  223. package/dist/runtime/composables/useJunGroupedDnD.js +186 -0
  224. package/dist/runtime/composables/useJunImagePopup.d.ts +37 -0
  225. package/dist/runtime/composables/useJunImagePopup.js +24 -0
  226. package/dist/runtime/composables/useJunIntro.d.ts +7 -0
  227. package/dist/runtime/composables/useJunIntro.js +8 -0
  228. package/dist/runtime/composables/useJunListDnD.d.ts +65 -0
  229. package/dist/runtime/composables/useJunListDnD.js +159 -0
  230. package/dist/runtime/composables/useJunMediaImport.d.ts +27 -0
  231. package/dist/runtime/composables/useJunMediaImport.js +90 -0
  232. package/dist/runtime/composables/useJunNavSettings.d.ts +57 -0
  233. package/dist/runtime/composables/useJunNavSettings.js +74 -0
  234. package/dist/runtime/composables/useJunNodePanel.d.ts +41 -0
  235. package/dist/runtime/composables/useJunNodePanel.js +36 -0
  236. package/dist/runtime/composables/useJunOpenDoc.d.ts +7 -0
  237. package/dist/runtime/composables/useJunOpenDoc.js +30 -0
  238. package/dist/runtime/composables/useJunOptions.d.ts +68 -0
  239. package/dist/runtime/composables/useJunOptions.js +68 -0
  240. package/dist/runtime/composables/useJunPalette.d.ts +16 -0
  241. package/dist/runtime/composables/useJunPalette.js +72 -0
  242. package/dist/runtime/composables/useJunPeopleAdmin.d.ts +69 -0
  243. package/dist/runtime/composables/useJunPeopleAdmin.js +73 -0
  244. package/dist/runtime/composables/useJunPlayer.d.ts +99 -0
  245. package/dist/runtime/composables/useJunPlayer.js +208 -0
  246. package/dist/runtime/composables/useJunPresence.d.ts +32 -0
  247. package/dist/runtime/composables/useJunPresence.js +53 -0
  248. package/dist/runtime/composables/useJunPressDrag.d.ts +20 -0
  249. package/dist/runtime/composables/useJunPressDrag.js +85 -0
  250. package/dist/runtime/composables/useJunRecent.d.ts +9 -0
  251. package/dist/runtime/composables/useJunRecent.js +44 -0
  252. package/dist/runtime/composables/useJunRename.d.ts +19 -0
  253. package/dist/runtime/composables/useJunRename.js +62 -0
  254. package/dist/runtime/composables/useJunRouteGeoHeal.d.ts +1 -0
  255. package/dist/runtime/composables/useJunRouteGeoHeal.js +45 -0
  256. package/dist/runtime/composables/useJunRouting.d.ts +29 -0
  257. package/dist/runtime/composables/useJunRouting.js +101 -0
  258. package/dist/runtime/composables/useJunSearch.d.ts +6 -0
  259. package/dist/runtime/composables/useJunSearch.js +16 -0
  260. package/dist/runtime/composables/useJunSelfId.d.ts +1 -0
  261. package/dist/runtime/composables/useJunSelfId.js +28 -0
  262. package/dist/runtime/composables/useJunSiteConfig.d.ts +229 -0
  263. package/dist/runtime/composables/useJunSiteConfig.js +95 -0
  264. package/dist/runtime/composables/useJunSiteConfigValues.d.ts +33 -0
  265. package/dist/runtime/composables/useJunSiteConfigValues.js +21 -0
  266. package/dist/runtime/composables/useJunStagger.d.ts +54 -0
  267. package/dist/runtime/composables/useJunStagger.js +23 -0
  268. package/dist/runtime/composables/useJunStudio.d.ts +11 -0
  269. package/dist/runtime/composables/useJunStudio.js +51 -0
  270. package/dist/runtime/composables/useJunSurface.d.ts +19 -0
  271. package/dist/runtime/composables/useJunSurface.js +8 -0
  272. package/dist/runtime/composables/useJunTheme.d.ts +21 -0
  273. package/dist/runtime/composables/useJunTheme.js +138 -0
  274. package/dist/runtime/composables/useJunThemeTransition.d.ts +5 -0
  275. package/dist/runtime/composables/useJunThemeTransition.js +32 -0
  276. package/dist/runtime/composables/useJunUpload.d.ts +12 -0
  277. package/dist/runtime/composables/useJunUpload.js +44 -0
  278. package/dist/runtime/composables/useJunViewingAccent.d.ts +6 -0
  279. package/dist/runtime/composables/useJunViewingAccent.js +28 -0
  280. package/dist/runtime/error.d.vue.ts +7 -0
  281. package/dist/runtime/error.vue +74 -0
  282. package/dist/runtime/error.vue.d.ts +7 -0
  283. package/dist/runtime/layouts/jun.d.vue.ts +13 -0
  284. package/dist/runtime/layouts/jun.vue +162 -0
  285. package/dist/runtime/layouts/jun.vue.d.ts +13 -0
  286. package/dist/runtime/pages/doc.d.vue.ts +3 -0
  287. package/dist/runtime/pages/doc.vue +142 -0
  288. package/dist/runtime/pages/doc.vue.d.ts +3 -0
  289. package/dist/runtime/pages/index.d.vue.ts +3 -0
  290. package/dist/runtime/pages/index.vue +64 -0
  291. package/dist/runtime/pages/index.vue.d.ts +3 -0
  292. package/dist/runtime/plugins/jun-drag-affordance.client.d.ts +2 -0
  293. package/dist/runtime/plugins/jun-drag-affordance.client.js +9 -0
  294. package/dist/runtime/router.options.d.ts +3 -0
  295. package/dist/runtime/router.options.js +72 -0
  296. package/dist/runtime/server/api/nav.get.d.ts +9 -0
  297. package/dist/runtime/server/api/nav.get.js +16 -0
  298. package/dist/runtime/server/api/resolve/[...slug].get.d.ts +18 -0
  299. package/dist/runtime/server/api/resolve/[...slug].get.js +20 -0
  300. package/dist/runtime/server/api/search.get.d.ts +13 -0
  301. package/dist/runtime/server/api/search.get.js +72 -0
  302. package/dist/runtime/server/api/service.get.d.ts +12 -0
  303. package/dist/runtime/server/api/service.get.js +39 -0
  304. package/dist/runtime/server/api/site-config.get.d.ts +2 -0
  305. package/dist/runtime/server/api/site-config.get.js +3 -0
  306. package/dist/runtime/server/api/stats.get.d.ts +12 -0
  307. package/dist/runtime/server/api/stats.get.js +56 -0
  308. package/dist/runtime/server/janitor/junJanitorActor.d.ts +179 -0
  309. package/dist/runtime/server/janitor/junJanitorActor.js +305 -0
  310. package/dist/runtime/server/janitor/junJanitorChores.d.ts +137 -0
  311. package/dist/runtime/server/janitor/junJanitorChores.js +189 -0
  312. package/dist/runtime/server/janitor/junJanitorDiff.d.ts +41 -0
  313. package/dist/runtime/server/janitor/junJanitorDiff.js +109 -0
  314. package/dist/runtime/server/janitor/junJanitorListen.d.ts +33 -0
  315. package/dist/runtime/server/janitor/junJanitorListen.js +43 -0
  316. package/dist/runtime/server/janitor/junJanitorMachine.d.ts +60 -0
  317. package/dist/runtime/server/janitor/junJanitorMachine.js +598 -0
  318. package/dist/runtime/server/janitor/junJanitorMotor.d.ts +211 -0
  319. package/dist/runtime/server/janitor/junJanitorMotor.js +241 -0
  320. package/dist/runtime/server/janitor/junJanitorPatrol.d.ts +68 -0
  321. package/dist/runtime/server/janitor/junJanitorPatrol.js +34 -0
  322. package/dist/runtime/server/janitor/junJanitorPerform.d.ts +70 -0
  323. package/dist/runtime/server/janitor/junJanitorPerform.js +72 -0
  324. package/dist/runtime/server/janitor/junJanitorRandom.d.ts +54 -0
  325. package/dist/runtime/server/janitor/junJanitorRandom.js +48 -0
  326. package/dist/runtime/server/janitor/junJanitorStore.d.ts +159 -0
  327. package/dist/runtime/server/janitor/junJanitorStore.js +269 -0
  328. package/dist/runtime/server/janitor/junJanitorVoice.d.ts +86 -0
  329. package/dist/runtime/server/janitor/junJanitorVoice.js +193 -0
  330. package/dist/runtime/server/janitor/junJanitorYText.d.ts +164 -0
  331. package/dist/runtime/server/janitor/junJanitorYText.js +258 -0
  332. package/dist/runtime/server/plugins/jun-bootstrap.d.ts +25 -0
  333. package/dist/runtime/server/plugins/jun-bootstrap.js +652 -0
  334. package/dist/runtime/server/plugins/jun-doc-cache.d.ts +2 -0
  335. package/dist/runtime/server/plugins/jun-doc-cache.js +142 -0
  336. package/dist/runtime/server/plugins/jun-janitor.d.ts +2 -0
  337. package/dist/runtime/server/plugins/jun-janitor.js +176 -0
  338. package/dist/runtime/server/plugins/jun-rpc.d.ts +2 -0
  339. package/dist/runtime/server/plugins/jun-rpc.js +455 -0
  340. package/dist/runtime/server/routes/feed.json.get.d.ts +21 -0
  341. package/dist/runtime/server/routes/feed.json.get.js +25 -0
  342. package/dist/runtime/server/routes/feed.xml.get.d.ts +2 -0
  343. package/dist/runtime/server/routes/feed.xml.get.js +34 -0
  344. package/dist/runtime/server/routes/sitemap.xml.get.d.ts +2 -0
  345. package/dist/runtime/server/routes/sitemap.xml.get.js +27 -0
  346. package/dist/runtime/server/utils/junCache.d.ts +41 -0
  347. package/dist/runtime/server/utils/junCache.js +32 -0
  348. package/dist/runtime/server/utils/junFeed.d.ts +20 -0
  349. package/dist/runtime/server/utils/junFeed.js +71 -0
  350. package/dist/runtime/server/utils/junServiceFetch.d.ts +46 -0
  351. package/dist/runtime/server/utils/junServiceFetch.js +320 -0
  352. package/dist/runtime/server/utils/junVisibility.d.ts +31 -0
  353. package/dist/runtime/server/utils/junVisibility.js +6 -0
  354. package/dist/runtime/types.d.ts +853 -0
  355. package/dist/runtime/types.js +1 -0
  356. package/dist/runtime/utils/junDate.d.ts +38 -0
  357. package/dist/runtime/utils/junDate.js +30 -0
  358. package/dist/runtime/utils/junDndGeometry.d.ts +62 -0
  359. package/dist/runtime/utils/junDndGeometry.js +56 -0
  360. package/dist/runtime/utils/junDocTypeIcons.d.ts +30 -0
  361. package/dist/runtime/utils/junDocTypeIcons.js +30 -0
  362. package/dist/runtime/utils/junEditorBodyText.d.ts +32 -0
  363. package/dist/runtime/utils/junEditorBodyText.js +10 -0
  364. package/dist/runtime/utils/junMapboxToken.d.ts +1 -0
  365. package/dist/runtime/utils/junMapboxToken.js +5 -0
  366. package/dist/runtime/utils/junMatch.d.ts +45 -0
  367. package/dist/runtime/utils/junMatch.js +37 -0
  368. package/dist/runtime/utils/junMetaSchemas.d.ts +23 -0
  369. package/dist/runtime/utils/junMetaSchemas.js +94 -0
  370. package/dist/runtime/utils/junMotion.d.ts +71 -0
  371. package/dist/runtime/utils/junMotion.js +3 -0
  372. package/dist/runtime/utils/junServiceRef.d.ts +21 -0
  373. package/dist/runtime/utils/junServiceRef.js +94 -0
  374. package/dist/runtime/utils/junSimplifyPath.d.ts +23 -0
  375. package/dist/runtime/utils/junSimplifyPath.js +57 -0
  376. package/dist/runtime/utils/junTransportModes.d.ts +49 -0
  377. package/dist/runtime/utils/junTransportModes.js +37 -0
  378. package/dist/runtime/utils/junVideoSource.d.ts +51 -0
  379. package/dist/runtime/utils/junVideoSource.js +110 -0
  380. package/dist/runtime/utils/junVisibility.d.ts +14 -0
  381. package/dist/runtime/utils/junVisibility.js +6 -0
  382. package/dist/types.d.mts +5 -0
  383. package/package.json +111 -0
@@ -0,0 +1,179 @@
1
+ /**
2
+ * The janitor's body — its account, its sockets, its presence, its voice on the
3
+ * wire.
4
+ *
5
+ * Modelled directly on `@abraca/orchestrator`'s `ActorConnection`, which is the
6
+ * platform's proven way to put a simulated person on a server: a real Ed25519
7
+ * account, real awareness, a real caret. Three deliberate differences, each
8
+ * forced by running inside Nitro rather than in a scene script:
9
+ *
10
+ * 1. **A fixed root.** The orchestrator discovers its space with
11
+ * `pickEntrySpace(listChildren())`; a website knows exactly which document
12
+ * it is, and picking "the first space on the server" would put the janitor
13
+ * in somebody else's site.
14
+ *
15
+ * 2. **Standalone child providers, never `loadChild`.** `ActorConnection`
16
+ * caches `rootProvider.loadChild(docId)`, which is correct in a browser and
17
+ * silently broken in Node against this server build — it never syncs and its
18
+ * writes vanish. Same shape as `jun-doc-cache` and `@abraca/mcp` instead.
19
+ *
20
+ * 3. **One document at a time.** The orchestrator caches every child it has
21
+ * ever opened, because a scene is short. This runs for weeks, and a
22
+ * standalone provider IS a socket — so the janitor holds exactly one, and
23
+ * closes it when it walks away. The constraint is also the character.
24
+ *
25
+ * ## The yjs boundary
26
+ *
27
+ * Every `Y.Doc` here is constructed with THIS package's yjs and handed to the
28
+ * provider through the same cast the module's other runners use. The provider
29
+ * only moves binary updates, so it does not care — but anything we then mutate
30
+ * is owned by our copy, which is the rule that keeps
31
+ * "Unexpected content type in insert operation" impossible. See CLAUDE.md,
32
+ * "Never let a Y type cross a package boundary".
33
+ */
34
+ import * as Y from 'yjs';
35
+ import { AbracadabraProvider } from '@abraca/dabra';
36
+ export interface JunActorIdentity {
37
+ mode: 'own' | 'service';
38
+ /** Seed for the deterministic keypair. Ignored when a key file is given. */
39
+ seed?: string;
40
+ keyFile?: string;
41
+ }
42
+ export interface JunActorOptions {
43
+ name: string;
44
+ color: string;
45
+ rootDocId: string;
46
+ identity: JunActorIdentity;
47
+ /** Backend origin. HTTP(S); `ws(s)://` is normalised. */
48
+ url: string;
49
+ /**
50
+ * The runner's own authenticated service client, used when
51
+ * `identity.mode === 'service'` — and as the fallback when the janitor's own
52
+ * account cannot be created.
53
+ */
54
+ serviceClient?: unknown;
55
+ log?: (message: string) => void;
56
+ }
57
+ export interface JunActorDocHandle {
58
+ docId: string;
59
+ doc: Y.Doc;
60
+ fragment: Y.XmlFragment;
61
+ provider: AbracadabraProvider;
62
+ }
63
+ export declare class JunJanitorActor {
64
+ readonly options: JunActorOptions;
65
+ private client;
66
+ private publicKey;
67
+ private rootDoc;
68
+ private rootProvider;
69
+ /** The ONE document currently open. The janitor cannot be in two places. */
70
+ private open;
71
+ private borrowedClient;
72
+ constructor(options: JunActorOptions);
73
+ private log;
74
+ get isConnected(): boolean;
75
+ get identityKey(): string | null;
76
+ /**
77
+ * The authenticated REST client, for the pieces that write outside a document
78
+ * — tree entries, the baseline doc's registration. Exposed so those writes
79
+ * are attributed to the JANITOR rather than to the runner: a page whose
80
+ * history says the service account renamed it tells the wrong story.
81
+ */
82
+ get httpClient(): unknown;
83
+ /** The root doc-tree, live. Read-only as far as the janitor is concerned. */
84
+ get tree(): Y.Map<unknown> | null;
85
+ get openDocId(): string | null;
86
+ connect(): Promise<void>;
87
+ /**
88
+ * Where the janitor is. `docId` + `page` are the wire contract every presence
89
+ * surface in this module reads (`useJunPresence`, the navbar dots, the
90
+ * travellers roster) — without them it is connected and invisible.
91
+ */
92
+ setPlace(docId: string | null, page: string | null): void;
93
+ /** Free-text status, the same field `@abraca/mcp`'s `set_presence` writes. */
94
+ setStatus(status: string | null): void;
95
+ /**
96
+ * The site-wide pointer, in the `peer:site:pointer` slot `useAAEphemeral`
97
+ * defines and `JunPeerCursors` renders. Coordinates are viewport-NORMALISED,
98
+ * which is what lets a server with no layout put a cursor somewhere plausible
99
+ * on every visitor's screen at once.
100
+ *
101
+ * It does NOT paint a presence blob. Those come from `<APresenceBlobs>`,
102
+ * which reads the platform's element-anchored `peer:aa:focus` broadcast — and
103
+ * an element path is something only a peer with a DOM can produce. A janitor
104
+ * with no layout has no honest answer to "which element is it over", and
105
+ * inventing one would put its blob on a paragraph it is not reading. Its
106
+ * presence is carried by the campfire and by `JunPeerCursors` instead.
107
+ */
108
+ setPointer(x: number, y: number, visible?: boolean): void;
109
+ clearPointer(): void;
110
+ /** Every other peer's root awareness state, for "who is where". */
111
+ peers(): {
112
+ clientId: number;
113
+ name: string;
114
+ docId: string | null;
115
+ }[];
116
+ /**
117
+ * Walk into a document: close whatever was open, open this one.
118
+ *
119
+ * Sequential by construction — one socket, held only while the janitor is
120
+ * standing there. That is both the connection budget (`jun-doc-cache` bounds
121
+ * its pool at 6 for the same reason) and the fiction.
122
+ */
123
+ enter(docId: string): Promise<JunActorDocHandle | null>;
124
+ /**
125
+ * Put the keys away: clear the caret, WAIT FOR THE WRITES TO LAND, close.
126
+ *
127
+ * The wait is not politeness, it is correctness. `synced` means the document
128
+ * arrived; it does not mean anything we then typed has been persisted — the
129
+ * provider tracks that separately as `unsyncedChanges`, and a viewer-role
130
+ * write is dropped on the wire with no error at all. Without this the janitor
131
+ * happily reported "did body.remove" for edits the server never accepted, and
132
+ * the page still had the mess on it. Observed on a live site; the failure is
133
+ * completely silent, which is what makes it worth a guard rather than a
134
+ * comment.
135
+ *
136
+ * Returns whether the document left the building clean.
137
+ */
138
+ leave(): Promise<boolean>;
139
+ /** Wait until the provider has nothing left to send, or give up. */
140
+ private waitForWrites;
141
+ /**
142
+ * The caret, as TipTap's `CollaborationCaret` reads it.
143
+ *
144
+ * `cursorPos` goes out alongside for this module's own presence consumers —
145
+ * `useEditor` broadcasts both, so anything watching one of them sees the
146
+ * janitor exactly as it sees a visitor.
147
+ */
148
+ setCursor(cursor: {
149
+ anchor: unknown;
150
+ head: unknown;
151
+ } | null, from?: number, to?: number): void;
152
+ /**
153
+ * Say something at the campfire.
154
+ *
155
+ * A stateless `messages:send`, exactly as the orchestrator's `sendChat` and
156
+ * `useChat`'s `sendMessage` do — NOT RPC v1. The channel is the hub document,
157
+ * because the campfire is one fire for the whole site.
158
+ */
159
+ say(channelDocId: string, content: string): void;
160
+ /** The "… is typing" indicator. Sent before a line, so the line has weight. */
161
+ sayTyping(channelDocId: string): void;
162
+ /**
163
+ * Subscribe to awareness changes — every arrival, departure and move.
164
+ *
165
+ * Polling this once per turn is not enough, and the failure is subtle: a
166
+ * visitor who opens a page, types, and closes the tab inside one turn is
167
+ * never seen at all, so the one signal that says "someone was just editing
168
+ * THIS page" never fires and the mess is left to the staleness sweep minutes
169
+ * later. Presence is an event, not a sample.
170
+ */
171
+ onPeers(handler: (peers: {
172
+ clientId: number;
173
+ name: string;
174
+ docId: string | null;
175
+ }[]) => void): () => void;
176
+ /** Incoming stateless frames — how the janitor hears the campfire. */
177
+ onStateless(handler: (payload: string) => void): () => void;
178
+ destroy(): Promise<void>;
179
+ }
@@ -0,0 +1,305 @@
1
+ import * as Y from "yjs";
2
+ import { AbracadabraClient, AbracadabraProvider, deterministicKeypair, loadOrCreateKeyFile, loginOrRegisterWithKey, waitForSync } from "@abraca/dabra";
3
+ const SYNC_TIMEOUT_MS = 8e3;
4
+ const FLUSH_MS = 400;
5
+ const WRITE_SETTLE_TIMEOUT_MS = 8e3;
6
+ export class JunJanitorActor {
7
+ options;
8
+ client = null;
9
+ publicKey = null;
10
+ rootDoc = null;
11
+ rootProvider = null;
12
+ /** The ONE document currently open. The janitor cannot be in two places. */
13
+ open = null;
14
+ borrowedClient = false;
15
+ constructor(options) {
16
+ this.options = options;
17
+ }
18
+ log(message) {
19
+ this.options.log?.(`[jun:janitor] ${message}`);
20
+ }
21
+ get isConnected() {
22
+ return !!this.rootProvider;
23
+ }
24
+ get identityKey() {
25
+ return this.publicKey;
26
+ }
27
+ /**
28
+ * The authenticated REST client, for the pieces that write outside a document
29
+ * — tree entries, the baseline doc's registration. Exposed so those writes
30
+ * are attributed to the JANITOR rather than to the runner: a page whose
31
+ * history says the service account renamed it tells the wrong story.
32
+ */
33
+ get httpClient() {
34
+ return this.client;
35
+ }
36
+ /** The root doc-tree, live. Read-only as far as the janitor is concerned. */
37
+ get tree() {
38
+ return this.rootDoc?.getMap("doc-tree") ?? null;
39
+ }
40
+ get openDocId() {
41
+ return this.open?.docId ?? null;
42
+ }
43
+ // ── Connecting ─────────────────────────────────────────────────────────────
44
+ async connect() {
45
+ if (this.rootProvider) return;
46
+ const httpUrl = this.options.url.replace(/^wss:\/\//, "https://").replace(/^ws:\/\//, "http://");
47
+ if (this.options.identity.mode === "service" && this.options.serviceClient) {
48
+ this.client = this.options.serviceClient;
49
+ this.borrowedClient = true;
50
+ this.log("using the runner's service identity \u2014 chat lines will carry ITS display name");
51
+ } else {
52
+ const client = new AbracadabraClient({ url: httpUrl });
53
+ const keypair = this.options.identity.keyFile ? await loadOrCreateKeyFile(this.options.identity.keyFile) : deterministicKeypair(this.options.identity.seed ?? this.options.name);
54
+ this.publicKey = keypair.publicKeyB64;
55
+ await loginOrRegisterWithKey(client, keypair, {
56
+ displayName: this.options.name,
57
+ deviceName: "jun janitor",
58
+ onRegister: () => this.log(`registering a new account for "${this.options.name}"`)
59
+ });
60
+ this.client = client;
61
+ this.log(`authenticated as "${this.options.name}" (${keypair.publicKeyB64})`);
62
+ this.log(
63
+ `if writes do not land, grant this key service scope:
64
+ [[users.system_users]] public_key = "${keypair.publicKeyB64}"
65
+ \u2014 or, for a dev database: INSERT OR REPLACE INTO permissions (doc_id, user_id, role) VALUES ('${this.options.rootDocId}', '${keypair.publicKeyB64}', 'service');`
66
+ );
67
+ }
68
+ const doc = new Y.Doc({ guid: this.options.rootDocId });
69
+ const provider = new AbracadabraProvider({
70
+ name: this.options.rootDocId,
71
+ document: doc,
72
+ client: this.client,
73
+ disableOfflineStore: true,
74
+ subdocLoading: "lazy"
75
+ });
76
+ await waitForSync(provider, SYNC_TIMEOUT_MS);
77
+ this.rootDoc = doc;
78
+ this.rootProvider = provider;
79
+ provider.awareness?.setLocalStateField("user", {
80
+ name: this.options.name,
81
+ color: this.options.color,
82
+ publicKey: this.publicKey,
83
+ isAgent: false
84
+ });
85
+ this.log(`connected to ${this.options.rootDocId}`);
86
+ }
87
+ // ── Presence ───────────────────────────────────────────────────────────────
88
+ /**
89
+ * Where the janitor is. `docId` + `page` are the wire contract every presence
90
+ * surface in this module reads (`useJunPresence`, the navbar dots, the
91
+ * travellers roster) — without them it is connected and invisible.
92
+ */
93
+ setPlace(docId, page) {
94
+ const awareness = this.rootProvider?.awareness;
95
+ if (!awareness) return;
96
+ awareness.setLocalStateField("docId", docId);
97
+ awareness.setLocalStateField("page", page);
98
+ }
99
+ /** Free-text status, the same field `@abraca/mcp`'s `set_presence` writes. */
100
+ setStatus(status) {
101
+ this.rootProvider?.awareness?.setLocalStateField("status", status);
102
+ }
103
+ /**
104
+ * The site-wide pointer, in the `peer:site:pointer` slot `useAAEphemeral`
105
+ * defines and `JunPeerCursors` renders. Coordinates are viewport-NORMALISED,
106
+ * which is what lets a server with no layout put a cursor somewhere plausible
107
+ * on every visitor's screen at once.
108
+ *
109
+ * It does NOT paint a presence blob. Those come from `<APresenceBlobs>`,
110
+ * which reads the platform's element-anchored `peer:aa:focus` broadcast — and
111
+ * an element path is something only a peer with a DOM can produce. A janitor
112
+ * with no layout has no honest answer to "which element is it over", and
113
+ * inventing one would put its blob on a paragraph it is not reading. Its
114
+ * presence is carried by the campfire and by `JunPeerCursors` instead.
115
+ */
116
+ setPointer(x, y, visible = true) {
117
+ this.rootProvider?.awareness?.setLocalStateField("peer:site:pointer", { x, y, vis: visible });
118
+ }
119
+ clearPointer() {
120
+ this.rootProvider?.awareness?.setLocalStateField("peer:site:pointer", null);
121
+ }
122
+ /** Every other peer's root awareness state, for "who is where". */
123
+ peers() {
124
+ const awareness = this.rootProvider?.awareness;
125
+ if (!awareness) return [];
126
+ const out = [];
127
+ for (const [clientId, state] of awareness.getStates()) {
128
+ if (clientId === awareness.clientID) continue;
129
+ const user = state.user;
130
+ out.push({
131
+ clientId,
132
+ name: user?.name ?? "traveller",
133
+ docId: typeof state.docId === "string" ? state.docId : null
134
+ });
135
+ }
136
+ return out;
137
+ }
138
+ // ── The open document ──────────────────────────────────────────────────────
139
+ /**
140
+ * Walk into a document: close whatever was open, open this one.
141
+ *
142
+ * Sequential by construction — one socket, held only while the janitor is
143
+ * standing there. That is both the connection budget (`jun-doc-cache` bounds
144
+ * its pool at 6 for the same reason) and the fiction.
145
+ */
146
+ async enter(docId) {
147
+ if (this.open?.docId === docId) return this.open;
148
+ await this.leave();
149
+ if (!this.client) return null;
150
+ const doc = new Y.Doc({ guid: docId });
151
+ const provider = new AbracadabraProvider({
152
+ name: docId,
153
+ document: doc,
154
+ client: this.client,
155
+ disableOfflineStore: true,
156
+ subdocLoading: "lazy"
157
+ });
158
+ try {
159
+ await waitForSync(provider, SYNC_TIMEOUT_MS);
160
+ } catch {
161
+ this.log(`could not open ${docId} \u2014 skipping it`);
162
+ try {
163
+ provider.destroy();
164
+ } catch {
165
+ }
166
+ return null;
167
+ }
168
+ provider.awareness?.setLocalStateField("user", {
169
+ name: this.options.name,
170
+ color: this.options.color,
171
+ publicKey: this.publicKey,
172
+ isAgent: false
173
+ });
174
+ this.open = { docId, doc, fragment: doc.getXmlFragment("default"), provider };
175
+ return this.open;
176
+ }
177
+ /**
178
+ * Put the keys away: clear the caret, WAIT FOR THE WRITES TO LAND, close.
179
+ *
180
+ * The wait is not politeness, it is correctness. `synced` means the document
181
+ * arrived; it does not mean anything we then typed has been persisted — the
182
+ * provider tracks that separately as `unsyncedChanges`, and a viewer-role
183
+ * write is dropped on the wire with no error at all. Without this the janitor
184
+ * happily reported "did body.remove" for edits the server never accepted, and
185
+ * the page still had the mess on it. Observed on a live site; the failure is
186
+ * completely silent, which is what makes it worth a guard rather than a
187
+ * comment.
188
+ *
189
+ * Returns whether the document left the building clean.
190
+ */
191
+ async leave() {
192
+ const open = this.open;
193
+ if (!open) return true;
194
+ this.open = null;
195
+ try {
196
+ open.provider.awareness?.setLocalStateField("cursor", null);
197
+ open.provider.awareness?.setLocalStateField("cursorPos", null);
198
+ } catch {
199
+ }
200
+ const settled = await this.waitForWrites(open.provider);
201
+ if (!settled) {
202
+ this.log(
203
+ `writes to ${open.docId} never landed \u2014 the janitor's identity is probably not allowed to write there (viewer writes are dropped silently)`
204
+ );
205
+ }
206
+ try {
207
+ open.provider.destroy();
208
+ } catch {
209
+ }
210
+ return settled;
211
+ }
212
+ /** Wait until the provider has nothing left to send, or give up. */
213
+ async waitForWrites(provider) {
214
+ const deadline = Date.now() + WRITE_SETTLE_TIMEOUT_MS;
215
+ await new Promise((resolve) => setTimeout(resolve, FLUSH_MS));
216
+ while (Date.now() < deadline) {
217
+ if (!provider.hasUnsyncedChanges) return true;
218
+ await new Promise((resolve) => setTimeout(resolve, 200));
219
+ }
220
+ return !provider.hasUnsyncedChanges;
221
+ }
222
+ /**
223
+ * The caret, as TipTap's `CollaborationCaret` reads it.
224
+ *
225
+ * `cursorPos` goes out alongside for this module's own presence consumers —
226
+ * `useEditor` broadcasts both, so anything watching one of them sees the
227
+ * janitor exactly as it sees a visitor.
228
+ */
229
+ setCursor(cursor, from, to) {
230
+ const awareness = this.open?.provider.awareness;
231
+ if (!awareness) return;
232
+ awareness.setLocalStateField("cursor", cursor);
233
+ awareness.setLocalStateField(
234
+ "cursorPos",
235
+ cursor && from !== void 0 ? { from, to: to ?? from } : null
236
+ );
237
+ }
238
+ // ── Voice ──────────────────────────────────────────────────────────────────
239
+ /**
240
+ * Say something at the campfire.
241
+ *
242
+ * A stateless `messages:send`, exactly as the orchestrator's `sendChat` and
243
+ * `useChat`'s `sendMessage` do — NOT RPC v1. The channel is the hub document,
244
+ * because the campfire is one fire for the whole site.
245
+ */
246
+ say(channelDocId, content) {
247
+ this.rootProvider?.sendStateless(JSON.stringify({
248
+ type: "messages:send",
249
+ channel_doc_id: channelDocId,
250
+ content,
251
+ mentions: []
252
+ }));
253
+ }
254
+ /** The "… is typing" indicator. Sent before a line, so the line has weight. */
255
+ sayTyping(channelDocId) {
256
+ this.rootProvider?.sendStateless(JSON.stringify({
257
+ type: "messages:typing",
258
+ channel_doc_id: channelDocId
259
+ }));
260
+ }
261
+ /**
262
+ * Subscribe to awareness changes — every arrival, departure and move.
263
+ *
264
+ * Polling this once per turn is not enough, and the failure is subtle: a
265
+ * visitor who opens a page, types, and closes the tab inside one turn is
266
+ * never seen at all, so the one signal that says "someone was just editing
267
+ * THIS page" never fires and the mess is left to the staleness sweep minutes
268
+ * later. Presence is an event, not a sample.
269
+ */
270
+ onPeers(handler) {
271
+ const awareness = this.rootProvider?.awareness;
272
+ if (!awareness) return () => {
273
+ };
274
+ const wrapped = () => handler(this.peers());
275
+ awareness.on("change", wrapped);
276
+ return () => awareness.off("change", wrapped);
277
+ }
278
+ /** Incoming stateless frames — how the janitor hears the campfire. */
279
+ onStateless(handler) {
280
+ const provider = this.rootProvider;
281
+ if (!provider) return () => {
282
+ };
283
+ const wrapped = (data) => handler(data.payload);
284
+ provider.on("stateless", wrapped);
285
+ return () => provider.off("stateless", wrapped);
286
+ }
287
+ // ── Shutdown ───────────────────────────────────────────────────────────────
288
+ async destroy() {
289
+ await this.leave();
290
+ const provider = this.rootProvider;
291
+ this.rootProvider = null;
292
+ this.rootDoc = null;
293
+ if (provider) {
294
+ try {
295
+ provider.awareness?.setLocalStateField("peer:site:pointer", null);
296
+ provider.awareness?.setLocalStateField("docId", null);
297
+ provider.awareness?.setLocalStateField("status", null);
298
+ await new Promise((resolve) => setTimeout(resolve, 150));
299
+ provider.destroy();
300
+ } catch {
301
+ }
302
+ }
303
+ if (!this.borrowedClient) this.client = null;
304
+ }
305
+ }
@@ -0,0 +1,137 @@
1
+ /**
2
+ * One document, flattened to plain data.
3
+ *
4
+ * `text` is the body as plain prose. It is OPTIONAL because the janitor only
5
+ * has one set of keys (§5 of JANITOR-PLAN.md): it knows every document's tree
6
+ * entry at all times and knows a document's prose only after standing in it.
7
+ * `undefined` means "not looked at", which is not the same as "empty" — and
8
+ * treating the two as the same would have the janitor delete every page it had
9
+ * not visited yet.
10
+ */
11
+ export interface JunJanitorDocState {
12
+ id: string;
13
+ label: string;
14
+ type: string;
15
+ parentId: string | null;
16
+ order: number;
17
+ meta: Record<string, unknown>;
18
+ text?: string;
19
+ trashed?: boolean;
20
+ /**
21
+ * The tree entry's own timestamp. Not compared as a chore — it is a SIGNAL:
22
+ * the only cheap way to notice that a document's prose may have changed
23
+ * without opening a socket on it. See the patrol.
24
+ */
25
+ updatedAt?: number;
26
+ }
27
+ export interface JunJanitorSnapshot {
28
+ capturedAt: number;
29
+ rootDocId: string;
30
+ docs: Record<string, JunJanitorDocState>;
31
+ }
32
+ /** How much this offends the janitor. Drives commentary and pace, not correctness. */
33
+ export type JunChoreSeverity = 'minor' | 'notable' | 'egregious';
34
+ /**
35
+ * How a removal is performed. Not cosmetic — this is the difference between
36
+ * "someone is deleting this" and "something deleted this".
37
+ *
38
+ * - `backspace` — character by character, right to left. Small messes.
39
+ * - `cut` — select the range, one keystroke. Big messes, or an impatient mood.
40
+ */
41
+ export type JunRemovalStyle = 'backspace' | 'cut';
42
+ interface ChoreBase {
43
+ /**
44
+ * Stable across patrols for the same divergence, so the queue can dedupe and
45
+ * the grudge tracker can notice the same mess coming back.
46
+ */
47
+ id: string;
48
+ docId: string;
49
+ severity: JunChoreSeverity;
50
+ }
51
+ export type JunChore = (ChoreBase & {
52
+ kind: 'body.remove';
53
+ /** Offset in the live body text. */
54
+ at: number;
55
+ text: string;
56
+ style: JunRemovalStyle;
57
+ }) | (ChoreBase & {
58
+ kind: 'body.restore';
59
+ at: number;
60
+ text: string;
61
+ }) | (ChoreBase & {
62
+ kind: 'body.replace';
63
+ at: number;
64
+ remove: string;
65
+ restore: string;
66
+ style: JunRemovalStyle;
67
+ }) | (ChoreBase & {
68
+ kind: 'entry.rename';
69
+ from: string;
70
+ to: string;
71
+ }) | (ChoreBase & {
72
+ kind: 'entry.reorder';
73
+ order: number;
74
+ }) | (ChoreBase & {
75
+ kind: 'entry.meta';
76
+ key: string;
77
+ value: unknown;
78
+ }) | (ChoreBase & {
79
+ kind: 'doc.remove';
80
+ label: string;
81
+ }) | (ChoreBase & {
82
+ kind: 'doc.restore';
83
+ label: string;
84
+ parentId: string | null;
85
+ text?: string;
86
+ });
87
+ /**
88
+ * The chores that happen INSIDE a document, and therefore carry an offset.
89
+ *
90
+ * Narrowed as its own type because the difference is structural, not cosmetic:
91
+ * body chores must be performed back-to-front (every offset is in live-document
92
+ * coordinates, so doing an earlier one first invalidates all the later ones),
93
+ * and that sort is only meaningful over chores that have an `at`.
94
+ */
95
+ export type JunBodyChore = Extract<JunChore, {
96
+ at: number;
97
+ }>;
98
+ export interface JunChorePolicy {
99
+ /** Removals up to this many characters are performed one key at a time. */
100
+ backspaceLimit: number;
101
+ /** Above this, a body edit is not a tidy-up — it collapses to one flat cut. */
102
+ wholesaleLimit: number;
103
+ /** Meta keys the janitor considers part of the page. Everything else is none of its business. */
104
+ metaKeys: readonly string[];
105
+ /** Never touch these documents, whatever the baseline says. */
106
+ ignoreDocIds: readonly string[];
107
+ /** Never remove a document that has at least this many children. */
108
+ protectChildCount: number;
109
+ }
110
+ export declare const JUN_CHORE_POLICY_DEFAULT: JunChorePolicy;
111
+ /**
112
+ * Compare one document's prose against its baseline.
113
+ *
114
+ * `impatient` comes from the state machine — the janitor that has cleaned the
115
+ * same page three times today stops doing it politely, one character at a
116
+ * time. Same divergence, different performance.
117
+ */
118
+ export declare function planBodyChores(docId: string, baselineText: string, liveText: string, options?: {
119
+ policy?: JunChorePolicy;
120
+ impatient?: boolean;
121
+ }): JunBodyChore[];
122
+ /**
123
+ * Compare the whole tree — labels, order, the watched meta keys, and pages
124
+ * that have appeared or gone missing.
125
+ *
126
+ * Tree state is free (the runner's root document is always synced), so this
127
+ * runs on every tick, unlike the body comparison which costs a visit.
128
+ */
129
+ export declare function planTreeChores(baseline: JunJanitorSnapshot, live: JunJanitorSnapshot, options?: {
130
+ policy?: JunChorePolicy;
131
+ }): JunChore[];
132
+ /** What a chore is, in the janitor's own terms. Feeds the phrase templates. */
133
+ export declare function describeChore(chore: JunChore): {
134
+ what: string;
135
+ verb: string;
136
+ };
137
+ export {};