@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,72 @@
1
+ import {
2
+ junBlocks,
3
+ junBodyLength,
4
+ junDeleteRange,
5
+ junEnsureStructure,
6
+ junFindText,
7
+ junLastParagraph,
8
+ junPruneEmptyBlocks,
9
+ junSplitParagraph
10
+ } from "./junJanitorYText.js";
11
+ export async function junPerform(handle, at, steps) {
12
+ const { doc, fragment } = handle;
13
+ const start = typeof at === "number" ? at : at.body;
14
+ let bias = typeof at === "number" ? "left" : at.bias;
15
+ let caret = Math.max(0, Math.min(start, junBodyLength(fragment)));
16
+ let removed = "";
17
+ let typed = "";
18
+ for (const step of steps) {
19
+ if (handle.aborted?.()) return { status: "aborted", reason: "cancelled", removed, typed };
20
+ await handle.sleep(step.delayMs);
21
+ if (handle.aborted?.()) return { status: "aborted", reason: "cancelled", removed, typed };
22
+ switch (step.kind) {
23
+ case "pause":
24
+ break;
25
+ case "backspace": {
26
+ if (caret <= 0) break;
27
+ let gone = "";
28
+ doc.transact(() => {
29
+ gone = junDeleteRange(fragment, caret - 1, 1);
30
+ });
31
+ if (!gone) return { status: "aborted", reason: "gone", removed, typed };
32
+ removed = gone + removed;
33
+ caret--;
34
+ break;
35
+ }
36
+ case "cut": {
37
+ let gone = "";
38
+ doc.transact(() => {
39
+ gone = junDeleteRange(fragment, caret, step.length);
40
+ junPruneEmptyBlocks(fragment);
41
+ });
42
+ removed += gone;
43
+ break;
44
+ }
45
+ case "type": {
46
+ doc.transact(() => {
47
+ if (step.char === "\n") {
48
+ junSplitParagraph(fragment, caret);
49
+ return;
50
+ }
51
+ junEnsureStructure(fragment);
52
+ const pos = junFindText(fragment, caret, bias);
53
+ if (pos) pos.text.insert(pos.offset, step.char);
54
+ else junLastParagraph(fragment).insert(0, step.char);
55
+ });
56
+ bias = "left";
57
+ typed += step.char;
58
+ caret++;
59
+ break;
60
+ }
61
+ }
62
+ handle.cursor?.(caret, caret);
63
+ }
64
+ doc.transact(() => junPruneEmptyBlocks(fragment));
65
+ return { status: "done", removed, typed };
66
+ }
67
+ export function junRangeMatches(fragment, displayAt, expected) {
68
+ if (!expected) return true;
69
+ const blocks = junBlocks(fragment);
70
+ const text = blocks.map((b) => b.text).join("\n");
71
+ return text.slice(displayAt, displayAt + expected.length) === expected;
72
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Seeded randomness for the janitor.
3
+ *
4
+ * Every decision the janitor makes — how long it pauses, whether it fumbles a
5
+ * word, which phrase it picks — runs through one of these. They are seeded and
6
+ * pure so a run is REPRODUCIBLE: "that deletion looked robotic" becomes a seed
7
+ * you can replay in a test rather than a thing you wait to see again.
8
+ *
9
+ * `Math.random()` must never appear anywhere else in the janitor.
10
+ */
11
+ export interface JunRng {
12
+ /** Uniform in [0, 1). */
13
+ next: () => number;
14
+ /** Uniform float in [min, max). */
15
+ range: (min: number, max: number) => number;
16
+ /** Uniform integer in [min, max] — both ends inclusive. */
17
+ int: (min: number, max: number) => number;
18
+ /** True with probability `p`. */
19
+ chance: (p: number) => boolean;
20
+ /** One item, uniformly. Returns undefined for an empty list. */
21
+ pick: <T>(items: readonly T[]) => T | undefined;
22
+ /** One item, by weight. Non-positive weights never come up. */
23
+ weighted: <T>(items: readonly {
24
+ value: T;
25
+ weight: number;
26
+ }[]) => T | undefined;
27
+ /** Standard normal, mean 0 σ 1 (Box–Muller). */
28
+ gaussian: () => number;
29
+ /**
30
+ * Log-normal around `median`. `sigma` is the spread of the UNDERLYING normal,
31
+ * so 0 is a constant and ~0.5 is a long-tailed human-looking spread.
32
+ *
33
+ * This is the distribution human inter-keystroke intervals actually follow:
34
+ * mostly clustered, with a tail of long ones. A uniform jitter — which is
35
+ * what a naive typewriter uses — has no tail, and reads as a machine no
36
+ * matter how wide you make it.
37
+ */
38
+ logNormal: (median: number, sigma: number) => number;
39
+ /** A fresh independent stream, derived from this one. For per-chore seeds. */
40
+ fork: () => JunRng;
41
+ }
42
+ /**
43
+ * mulberry32 — small, fast, good enough for theatre, and above all
44
+ * deterministic across Node versions (`Math.random` is not seedable at all).
45
+ */
46
+ export declare function junRng(seed: number | string): JunRng;
47
+ /**
48
+ * A pointless-looking helper that exists because the alternative is worse:
49
+ * clamping at every call site, and forgetting at one of them. A negative or
50
+ * NaN delay in a `setTimeout` fires immediately, which turns a considered
51
+ * pause into a burst — the exact failure the whole motor model is built to
52
+ * avoid, and one that is invisible until someone watches it happen.
53
+ */
54
+ export declare function clampMs(value: number, min: number, max: number): number;
@@ -0,0 +1,48 @@
1
+ function hashSeed(seed) {
2
+ if (typeof seed === "number") return seed >>> 0;
3
+ let h = 2166136261;
4
+ for (let i = 0; i < seed.length; i++) {
5
+ h ^= seed.charCodeAt(i);
6
+ h = Math.imul(h, 16777619);
7
+ }
8
+ return h >>> 0;
9
+ }
10
+ export function junRng(seed) {
11
+ let state = hashSeed(seed) || 1;
12
+ const next = () => {
13
+ state = state + 1831565813 >>> 0;
14
+ let t = state;
15
+ t = Math.imul(t ^ t >>> 15, t | 1);
16
+ t ^= t + Math.imul(t ^ t >>> 7, t | 61);
17
+ return ((t ^ t >>> 14) >>> 0) / 4294967296;
18
+ };
19
+ const rng = {
20
+ next,
21
+ range: (min, max) => min + next() * (max - min),
22
+ int: (min, max) => Math.floor(min + next() * (max - min + 1)),
23
+ chance: (p) => next() < p,
24
+ pick: (items) => items.length ? items[Math.floor(next() * items.length)] : void 0,
25
+ weighted: (items) => {
26
+ const total = items.reduce((sum, i) => sum + Math.max(0, i.weight), 0);
27
+ if (total <= 0) return void 0;
28
+ let roll = next() * total;
29
+ for (const item of items) {
30
+ roll -= Math.max(0, item.weight);
31
+ if (roll <= 0) return item.value;
32
+ }
33
+ return items[items.length - 1]?.value;
34
+ },
35
+ gaussian: () => {
36
+ const u = 1 - next();
37
+ const v = next();
38
+ return Math.sqrt(-2 * Math.log(u)) * Math.cos(2 * Math.PI * v);
39
+ },
40
+ logNormal: (median, sigma) => median * Math.exp(rng.gaussian() * sigma),
41
+ fork: () => junRng(Math.floor(next() * 4294967295))
42
+ };
43
+ return rng;
44
+ }
45
+ export function clampMs(value, min, max) {
46
+ if (!Number.isFinite(value)) return min;
47
+ return Math.max(min, Math.min(max, Math.round(value)));
48
+ }
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Durable state — the baseline, the lost-and-found, and the tree writes.
3
+ *
4
+ * ## Where the baseline lives, and why not anywhere easier
5
+ *
6
+ * It lives in its OWN document's `Y.Doc`, under a hidden tree entry.
7
+ *
8
+ * Not on a tree entry's `meta`: the root `doc-tree` is synced by every visitor
9
+ * on every page load, which is exactly why `jun-rpc` caps `appreciatedBy` at
10
+ * 500 ids. A snapshot of the site's prose on the root map would put the whole
11
+ * site in every visitor's first paint, twice.
12
+ *
13
+ * Not on disk: Nitro's storage is per-instance and per-deploy, and a baseline
14
+ * that evaporates on redeploy means the janitor treats the entire site as mess
15
+ * the first time it wakes up in a new container.
16
+ *
17
+ * A subdoc is lazy — no visitor ever loads it — durable, and replicated with
18
+ * everything else. It costs one socket, once, at capture time.
19
+ *
20
+ * ## Tree writes
21
+ *
22
+ * Renames, reorders, meta and trashing go through the SAME shape `jun-rpc`
23
+ * uses: a short-lived standalone root provider, then WAIT for the server's echo
24
+ * on the shared root document before calling it done. That wait is what makes a
25
+ * resolved write mean *persisted and broadcast* rather than *sent*. A runner
26
+ * whose identity lacks write scope fails loudly here instead of tidying an
27
+ * imaginary site.
28
+ */
29
+ import * as Y from 'yjs';
30
+ import { AbracadabraProvider } from '@abraca/dabra';
31
+ import type { JunJanitorSnapshot } from './junJanitorChores.js';
32
+ /** Y values arrive as Y types or plain objects depending on who wrote them. */
33
+ export declare function plain<T = Record<string, unknown>>(value: unknown): T | undefined;
34
+ export interface JunTreeEntry {
35
+ label?: string;
36
+ parentId?: string | null;
37
+ type?: string;
38
+ trashed?: boolean;
39
+ order?: number;
40
+ createdAt?: number;
41
+ updatedAt?: number;
42
+ meta?: Record<string, unknown>;
43
+ }
44
+ /**
45
+ * Flatten the live tree into the plain shape the chore planner speaks.
46
+ *
47
+ * Bodies are deliberately absent: `text` is `undefined` for every document
48
+ * until the janitor has actually stood in it. That distinction — "not looked
49
+ * at" versus "empty" — is what stops it deleting every page it has not visited.
50
+ */
51
+ export declare function junReadTree(tree: Y.Map<unknown>, rootDocId: string): JunJanitorSnapshot;
52
+ export interface JunTreeWriterOptions {
53
+ rootDocId: string;
54
+ /** The runner's shared, always-synced root document — where echoes land. */
55
+ sharedRoot: Y.Doc;
56
+ client: unknown;
57
+ log?: (message: string) => void;
58
+ }
59
+ /**
60
+ * Serialised tree writes with positive confirmation.
61
+ *
62
+ * Serialised because a read-modify-write on a tree entry must not interleave
63
+ * with another one; confirmed because a write that was merely *sent* is not a
64
+ * write. Both rules are lifted from `jun-rpc`, which learned them in
65
+ * production.
66
+ */
67
+ export declare function createJunTreeWriter(options: JunTreeWriterOptions): {
68
+ /**
69
+ * Put a label back.
70
+ *
71
+ * Slugs are derived from labels, so a rename MOVES the page. The vacated
72
+ * slug is appended to `meta.slugAliases` in the SAME `set` as the label —
73
+ * one write, so peers never observe a half-renamed entry and the old URL
74
+ * keeps resolving. This mirrors `useJunRename().renameDoc()`, which is the
75
+ * only sanctioned way to rename in this module.
76
+ */
77
+ rename(docId: string, label: string): Promise<void>;
78
+ reorder(docId: string, order: number): Promise<void>;
79
+ setMeta(docId: string, key: string, value: unknown): Promise<void>;
80
+ /**
81
+ * Trash a page the canonical way: copy the entry into `doc-trash`, then
82
+ * remove it from `doc-tree`.
83
+ *
84
+ * A `trashed: true` flag alone only affects the slug map — every renderer
85
+ * reading `childrenOf()` would still show the page, so the janitor would
86
+ * appear to have failed. See CLAUDE.md, "Trash documents the canonical way".
87
+ */
88
+ trash(docId: string): Promise<void>;
89
+ /** Put a trashed page back where it was. */
90
+ restore(docId: string, entry: JunTreeEntry): Promise<void>;
91
+ };
92
+ export type JunTreeWriter = ReturnType<typeof createJunTreeWriter>;
93
+ /**
94
+ * The module's slug rule, duplicated here on purpose.
95
+ *
96
+ * `useDocSlugs` lives in the app bundle and Nitro is a separate one — the same
97
+ * split that already forces `isJunOwnerOnlyDoc` to exist twice. Keep them in
98
+ * step: a slug computed differently here would append a WRONG alias, and the
99
+ * old URL would 404 after the janitor put a name back.
100
+ */
101
+ export declare function junSlugify(label: string): string;
102
+ export interface JunBaselineHandle {
103
+ /** The notebook's own document id — so the janitor can leave it alone. */
104
+ docId: string;
105
+ doc: Y.Doc;
106
+ provider: AbracadabraProvider;
107
+ map: Y.Map<unknown>;
108
+ }
109
+ /**
110
+ * Open the baseline document. One socket, closed by the caller.
111
+ *
112
+ * The snapshot is stored as ONE JSON string rather than as a nested Y structure.
113
+ * It is written whole and read whole; giving it CRDT granularity would buy
114
+ * nothing and would make a partially-merged baseline — a state that means
115
+ * "revert the site to something that never existed" — representable.
116
+ */
117
+ export declare function junOpenBaseline(docId: string, client: unknown): Promise<JunBaselineHandle>;
118
+ export declare function junReadBaseline(handle: JunBaselineHandle): JunJanitorSnapshot | null;
119
+ export declare function junWriteBaseline(handle: JunBaselineHandle, snapshot: JunJanitorSnapshot): void;
120
+ /**
121
+ * The lost-and-found.
122
+ *
123
+ * Everything the janitor removes lands here first, so nothing it does is
124
+ * actually destructive — which is what makes it safe to let a gag delete prose,
125
+ * and is also the better joke ("it's in the bin if you want it back").
126
+ */
127
+ export declare function junBin(handle: JunBaselineHandle, item: {
128
+ docId: string;
129
+ label: string;
130
+ text: string;
131
+ at: number;
132
+ }): void;
133
+ export declare function junReadBin(handle: JunBaselineHandle): {
134
+ docId: string;
135
+ label: string;
136
+ text: string;
137
+ at: number;
138
+ }[];
139
+ /**
140
+ * Claim, or renew, the one-janitor lease. Returns whether this instance holds it.
141
+ *
142
+ * Stored in the notebook so every instance sees the same claim. A lease nobody
143
+ * has renewed within `staleMs` is taken over — a container that died mid-shift
144
+ * must not lock the job forever, and the cost of two janitors overlapping for
145
+ * one check interval is one duplicated tidy-up, not corruption.
146
+ */
147
+ export declare function junClaimLease(handle: JunBaselineHandle, instanceId: string, now: number, staleMs: number): boolean;
148
+ /**
149
+ * Hand the job back on a clean shutdown.
150
+ *
151
+ * Without this a redeploy leaves the site janitor-less for a whole stale
152
+ * window: the new container comes up with a new instance id, sees a lease that
153
+ * was renewed seconds ago by the process that has since exited, and politely
154
+ * stands by for five minutes. Releasing on the way out makes the handover
155
+ * immediate, and the stale window goes back to being what it is for — a
156
+ * container that died without warning.
157
+ */
158
+ export declare function junReleaseLease(handle: JunBaselineHandle, instanceId: string): void;
159
+ export declare function junCloseBaseline(handle: JunBaselineHandle): Promise<void>;
@@ -0,0 +1,269 @@
1
+ import * as Y from "yjs";
2
+ import { AbracadabraProvider, waitForSync } from "@abraca/dabra";
3
+ import { isJunOwnerOnlyDoc } from "../utils/junVisibility.js";
4
+ const SYNC_TIMEOUT_MS = 8e3;
5
+ const ECHO_TIMEOUT_MS = 6e3;
6
+ const FLUSH_MS = 400;
7
+ const BIN_CAP = 200;
8
+ export function plain(value) {
9
+ if (!value) return void 0;
10
+ const v = value;
11
+ return typeof v.toJSON === "function" ? v.toJSON() : value;
12
+ }
13
+ export function junReadTree(tree, rootDocId) {
14
+ const docs = {};
15
+ tree.forEach((value, id) => {
16
+ const entry = plain(value);
17
+ if (!entry) return;
18
+ if (id === rootDocId) return;
19
+ if (isJunOwnerOnlyDoc(entry)) return;
20
+ docs[id] = {
21
+ id,
22
+ label: entry.label ?? "",
23
+ type: entry.type ?? "doc",
24
+ parentId: entry.parentId ?? null,
25
+ order: typeof entry.order === "number" ? entry.order : 0,
26
+ meta: entry.meta ?? {},
27
+ trashed: entry.trashed === true,
28
+ updatedAt: typeof entry.updatedAt === "number" ? entry.updatedAt : 0
29
+ };
30
+ });
31
+ return { capturedAt: Date.now(), rootDocId, docs };
32
+ }
33
+ export function createJunTreeWriter(options) {
34
+ let chain = Promise.resolve();
35
+ const shared = () => options.sharedRoot.getMap("doc-tree");
36
+ function withTree(mutate, confirmed) {
37
+ const run = async () => {
38
+ const doc = new Y.Doc({ guid: options.rootDocId });
39
+ const provider = new AbracadabraProvider({
40
+ name: options.rootDocId,
41
+ document: doc,
42
+ client: options.client,
43
+ disableOfflineStore: true,
44
+ subdocLoading: "lazy"
45
+ });
46
+ try {
47
+ await waitForSync(provider, SYNC_TIMEOUT_MS);
48
+ let result;
49
+ doc.transact(() => {
50
+ result = mutate(doc.getMap("doc-tree"));
51
+ });
52
+ await new Promise((resolve, reject) => {
53
+ if (confirmed()) return resolve();
54
+ const map = shared();
55
+ const timer = setTimeout(() => {
56
+ map.unobserve(check);
57
+ reject(new Error("write did not propagate \u2014 does the janitor have write access?"));
58
+ }, ECHO_TIMEOUT_MS);
59
+ const check = () => {
60
+ if (!confirmed()) return;
61
+ clearTimeout(timer);
62
+ map.unobserve(check);
63
+ resolve();
64
+ };
65
+ map.observe(check);
66
+ });
67
+ return result;
68
+ } finally {
69
+ await new Promise((resolve) => setTimeout(resolve, FLUSH_MS));
70
+ try {
71
+ provider.destroy();
72
+ } catch {
73
+ }
74
+ }
75
+ };
76
+ const next = chain.then(run, run);
77
+ chain = next.catch(() => {
78
+ });
79
+ return next;
80
+ }
81
+ return {
82
+ /**
83
+ * Put a label back.
84
+ *
85
+ * Slugs are derived from labels, so a rename MOVES the page. The vacated
86
+ * slug is appended to `meta.slugAliases` in the SAME `set` as the label —
87
+ * one write, so peers never observe a half-renamed entry and the old URL
88
+ * keeps resolving. This mirrors `useJunRename().renameDoc()`, which is the
89
+ * only sanctioned way to rename in this module.
90
+ */
91
+ rename(docId, label) {
92
+ return withTree(
93
+ (tree) => {
94
+ const entry = plain(tree.get(docId));
95
+ if (!entry || entry.label === label) return;
96
+ const aliases = Array.isArray(entry.meta?.slugAliases) ? entry.meta.slugAliases.filter((s) => typeof s === "string") : [];
97
+ const vacated = junSlugify(entry.label ?? "");
98
+ tree.set(docId, {
99
+ ...entry,
100
+ label,
101
+ updatedAt: Date.now(),
102
+ meta: {
103
+ ...entry.meta ?? {},
104
+ slugAliases: vacated && !aliases.includes(vacated) ? [...aliases, vacated] : aliases
105
+ }
106
+ });
107
+ },
108
+ () => plain(shared().get(docId))?.label === label
109
+ ).then(() => {
110
+ });
111
+ },
112
+ reorder(docId, order) {
113
+ return withTree(
114
+ (tree) => {
115
+ const entry = plain(tree.get(docId));
116
+ if (!entry) return;
117
+ tree.set(docId, { ...entry, order });
118
+ },
119
+ () => plain(shared().get(docId))?.order === order
120
+ ).then(() => {
121
+ });
122
+ },
123
+ setMeta(docId, key, value) {
124
+ return withTree(
125
+ (tree) => {
126
+ const entry = plain(tree.get(docId));
127
+ if (!entry) return;
128
+ const meta = Object.fromEntries(
129
+ Object.entries(entry.meta ?? {}).filter(([k]) => k !== key)
130
+ );
131
+ if (value !== void 0) meta[key] = value;
132
+ tree.set(docId, { ...entry, updatedAt: Date.now(), meta });
133
+ },
134
+ () => {
135
+ const meta = plain(shared().get(docId))?.meta ?? {};
136
+ return value === void 0 ? meta[key] === void 0 : JSON.stringify(meta[key]) === JSON.stringify(value);
137
+ }
138
+ ).then(() => {
139
+ });
140
+ },
141
+ /**
142
+ * Trash a page the canonical way: copy the entry into `doc-trash`, then
143
+ * remove it from `doc-tree`.
144
+ *
145
+ * A `trashed: true` flag alone only affects the slug map — every renderer
146
+ * reading `childrenOf()` would still show the page, so the janitor would
147
+ * appear to have failed. See CLAUDE.md, "Trash documents the canonical way".
148
+ */
149
+ trash(docId) {
150
+ return withTree(
151
+ (tree) => {
152
+ const entry = plain(tree.get(docId));
153
+ if (!entry) return;
154
+ const trash = tree.doc.getMap("doc-trash");
155
+ trash.set(docId, { ...entry, trashed: true, updatedAt: Date.now() });
156
+ tree.delete(docId);
157
+ },
158
+ () => !shared().get(docId)
159
+ ).then(() => {
160
+ });
161
+ },
162
+ /** Put a trashed page back where it was. */
163
+ restore(docId, entry) {
164
+ return withTree(
165
+ (tree) => {
166
+ if (tree.get(docId)) return;
167
+ const trash = tree.doc.getMap("doc-trash");
168
+ const stored = plain(trash.get(docId));
169
+ tree.set(docId, {
170
+ ...stored ?? entry,
171
+ ...entry,
172
+ trashed: false,
173
+ updatedAt: Date.now()
174
+ });
175
+ trash.delete(docId);
176
+ },
177
+ () => !!shared().get(docId)
178
+ ).then(() => {
179
+ });
180
+ }
181
+ };
182
+ }
183
+ export function junSlugify(label) {
184
+ return label.toLowerCase().trim().replace(/[^\da-z]+/g, "-").replace(/^-+|-+$/g, "");
185
+ }
186
+ export async function junOpenBaseline(docId, client) {
187
+ const doc = new Y.Doc({ guid: docId });
188
+ const provider = new AbracadabraProvider({
189
+ name: docId,
190
+ document: doc,
191
+ client,
192
+ disableOfflineStore: true,
193
+ subdocLoading: "lazy"
194
+ });
195
+ await waitForSync(provider, SYNC_TIMEOUT_MS);
196
+ return { docId, doc, provider, map: doc.getMap("janitor") };
197
+ }
198
+ export function junReadBaseline(handle) {
199
+ const raw = handle.map.get("baseline");
200
+ if (typeof raw !== "string" || !raw) return null;
201
+ try {
202
+ const parsed = JSON.parse(raw);
203
+ if (!parsed?.docs) return null;
204
+ return {
205
+ ...parsed,
206
+ docs: Object.fromEntries(
207
+ Object.entries(parsed.docs).filter(([, doc]) => !isJunOwnerOnlyDoc(doc))
208
+ )
209
+ };
210
+ } catch {
211
+ return null;
212
+ }
213
+ }
214
+ export function junWriteBaseline(handle, snapshot) {
215
+ handle.doc.transact(() => {
216
+ handle.map.set("baseline", JSON.stringify(snapshot));
217
+ handle.map.set("capturedAt", snapshot.capturedAt);
218
+ });
219
+ }
220
+ export function junBin(handle, item) {
221
+ if (!item.text.trim()) return;
222
+ const raw = handle.map.get("bin");
223
+ let list = [];
224
+ if (typeof raw === "string") {
225
+ try {
226
+ list = JSON.parse(raw);
227
+ } catch {
228
+ list = [];
229
+ }
230
+ }
231
+ list.push(item);
232
+ handle.doc.transact(() => {
233
+ handle.map.set("bin", JSON.stringify(list.slice(-BIN_CAP)));
234
+ });
235
+ }
236
+ export function junReadBin(handle) {
237
+ const raw = handle.map.get("bin");
238
+ if (typeof raw !== "string") return [];
239
+ try {
240
+ return JSON.parse(raw);
241
+ } catch {
242
+ return [];
243
+ }
244
+ }
245
+ export function junClaimLease(handle, instanceId, now, staleMs) {
246
+ const raw = handle.map.get("lease");
247
+ const lease = plain(raw);
248
+ const holder = typeof lease?.holder === "string" ? lease.holder : null;
249
+ const at = typeof lease?.at === "number" ? lease.at : 0;
250
+ const mine = holder === instanceId;
251
+ const stale = now - at > staleMs;
252
+ if (holder && !mine && !stale) return false;
253
+ handle.doc.transact(() => {
254
+ handle.map.set("lease", { holder: instanceId, at: now });
255
+ });
256
+ return true;
257
+ }
258
+ export function junReleaseLease(handle, instanceId) {
259
+ const lease = plain(handle.map.get("lease"));
260
+ if (lease?.holder !== instanceId) return;
261
+ handle.doc.transact(() => handle.map.delete("lease"));
262
+ }
263
+ export async function junCloseBaseline(handle) {
264
+ await new Promise((resolve) => setTimeout(resolve, FLUSH_MS));
265
+ try {
266
+ handle.provider.destroy();
267
+ } catch {
268
+ }
269
+ }
@@ -0,0 +1,86 @@
1
+ /**
2
+ * The voice.
3
+ *
4
+ * Tone drift is the failure nobody catches in review, so the whole vocabulary
5
+ * lives in one file where it can be read end to end and judged as writing.
6
+ *
7
+ * Three rules hold it together:
8
+ *
9
+ * 1. **It mostly says nothing.** The default commentary rate is low on
10
+ * purpose. A janitor that narrates every action is a chat bot with a
11
+ * costume; one that works in silence and occasionally mutters is a person.
12
+ * Silence is the feature — the phrases are the garnish.
13
+ * 2. **It never addresses the joke, offers help, or asks a question it would
14
+ * wait for an answer to.** It is not an assistant and it does not know it
15
+ * is in a demo.
16
+ * 3. **Lowercase, short, no terminal punctuation, no emoji, no sparkles.**
17
+ * House style, and also just how someone types with one hand.
18
+ *
19
+ * Everything is deterministic given the rng and the clock values passed in —
20
+ * no `Date.now()` in here, so cadence is testable without waiting an hour.
21
+ */
22
+ import type { JunRng } from './junJanitorRandom.js';
23
+ /**
24
+ * The moments it might speak at.
25
+ *
26
+ * - `shift.start` / `shift.end` — coming on and going off duty.
27
+ * - `break.start` / `break.end` — the kettle.
28
+ * - `notice` — spotted something from across the site, before walking over.
29
+ * - `arrive` — standing on the page, looking at it.
30
+ * - `working` — mid-removal. Rare.
31
+ * - `done` — finished a chore.
32
+ * - `again` — a page that keeps getting messed up.
33
+ * - `giving-up` — that page can stay as it is, then.
34
+ * - `oops` — took too much and had to put it back.
35
+ * - `yield` — someone is editing the very thing it came to clean.
36
+ * - `quiet` — nothing to do.
37
+ * - `aside` — unprompted and unrelated. The most human thing it does.
38
+ * - `night` — the small hours.
39
+ * - `answer.*` — somebody at the campfire said its name. See §Round 8.
40
+ */
41
+ export type JunVoiceEvent = 'shift.start' | 'shift.end' | 'break.start' | 'break.end' | 'notice' | 'arrive' | 'working' | 'done' | 'again' | 'giving-up' | 'oops' | 'yield' | 'quiet' | 'aside' | 'night' | 'answer' | 'answer.greeting' | 'answer.why' | 'answer.bin' | 'answer.sorry';
42
+ export interface JunVoiceContext {
43
+ /** A page label. Never a slug, never a URL — it talks about places, not routes. */
44
+ page?: string;
45
+ /** What was found, from `describeChore` — "a word", "a wall of text". */
46
+ what?: string;
47
+ /** A traveller's name, from awareness. */
48
+ who?: string;
49
+ /** How many times this page has needed doing. */
50
+ count?: number;
51
+ /** The page a binned item came from, for "it's in the bin" answers. */
52
+ from?: string;
53
+ }
54
+ export interface JunVoiceCadence {
55
+ /** Probability of saying anything at all for an ordinary event. */
56
+ commentaryRate: number;
57
+ /** Never two lines closer together than this. */
58
+ minGapMs: number;
59
+ /** Hard ceiling, however much mess arrives. */
60
+ maxPerHour: number;
61
+ /** How many recent phrases are off-limits, so it doesn't loop. */
62
+ noRepeatWindow: number;
63
+ /** Typing-indicator speed, characters per second. */
64
+ typingCps: number;
65
+ }
66
+ export declare const JUN_VOICE_CADENCE_DEFAULT: JunVoiceCadence;
67
+ export interface JunVoice {
68
+ /**
69
+ * A line for this event, or `null` for silence — which is the common answer.
70
+ * `force` bypasses the commentary roll (not the rate limits): shift changes
71
+ * and giving up are always said, or they are not events at all.
72
+ */
73
+ line: (event: JunVoiceEvent, ctx?: JunVoiceContext, opts?: {
74
+ now?: number;
75
+ force?: boolean;
76
+ }) => string | null;
77
+ /** Record that something was said, for the gap and hourly ceiling. */
78
+ noteSpoken: (now: number) => void;
79
+ /** How long to show a typing indicator before a line of this length. */
80
+ typingMs: (text: string) => number;
81
+ }
82
+ export declare function createJunVoice(rng: JunRng, options?: {
83
+ cadence?: Partial<JunVoiceCadence>;
84
+ /** Extra phrases per event, merged in. How a site gives it a local accent. */
85
+ extra?: Partial<Record<JunVoiceEvent, readonly string[]>>;
86
+ }): JunVoice;