@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.
- package/README.md +594 -0
- package/dist/module.d.mts +158 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +957 -0
- package/dist/runtime/assets/css/jun.css +13 -0
- package/dist/runtime/components/JunAnnouncement.d.vue.ts +3 -0
- package/dist/runtime/components/JunAnnouncement.vue +88 -0
- package/dist/runtime/components/JunAnnouncement.vue.d.ts +3 -0
- package/dist/runtime/components/JunAppreciate.d.vue.ts +6 -0
- package/dist/runtime/components/JunAppreciate.vue +71 -0
- package/dist/runtime/components/JunAppreciate.vue.d.ts +6 -0
- package/dist/runtime/components/JunBackgroundPhoto.d.vue.ts +3 -0
- package/dist/runtime/components/JunBackgroundPhoto.vue +23 -0
- package/dist/runtime/components/JunBackgroundPhoto.vue.d.ts +3 -0
- package/dist/runtime/components/JunBlobBackdrop.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunBlobBackdrop.client.vue +120 -0
- package/dist/runtime/components/JunBlobBackdrop.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunBreadcrumbs.d.vue.ts +16 -0
- package/dist/runtime/components/JunBreadcrumbs.vue +63 -0
- package/dist/runtime/components/JunBreadcrumbs.vue.d.ts +16 -0
- package/dist/runtime/components/JunCampfireChat.d.vue.ts +14 -0
- package/dist/runtime/components/JunCampfireChat.vue +136 -0
- package/dist/runtime/components/JunCampfireChat.vue.d.ts +14 -0
- package/dist/runtime/components/JunCampfirePanel.d.vue.ts +33 -0
- package/dist/runtime/components/JunCampfirePanel.vue +202 -0
- package/dist/runtime/components/JunCampfirePanel.vue.d.ts +33 -0
- package/dist/runtime/components/JunCampfirePresence.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunCampfirePresence.client.vue +321 -0
- package/dist/runtime/components/JunCampfirePresence.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunCampfireRoster.d.vue.ts +19 -0
- package/dist/runtime/components/JunCampfireRoster.vue +259 -0
- package/dist/runtime/components/JunCampfireRoster.vue.d.ts +19 -0
- package/dist/runtime/components/JunCampfireYou.d.vue.ts +10 -0
- package/dist/runtime/components/JunCampfireYou.vue +157 -0
- package/dist/runtime/components/JunCampfireYou.vue.d.ts +10 -0
- package/dist/runtime/components/JunDocSurface.d.vue.ts +34 -0
- package/dist/runtime/components/JunDocSurface.vue +117 -0
- package/dist/runtime/components/JunDocSurface.vue.d.ts +34 -0
- package/dist/runtime/components/JunFestivalPlayer.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunFestivalPlayer.client.vue +471 -0
- package/dist/runtime/components/JunFestivalPlayer.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunFooter.d.vue.ts +3 -0
- package/dist/runtime/components/JunFooter.vue +102 -0
- package/dist/runtime/components/JunFooter.vue.d.ts +3 -0
- package/dist/runtime/components/JunGlobeEditor.client.d.vue.ts +43 -0
- package/dist/runtime/components/JunGlobeEditor.client.vue +315 -0
- package/dist/runtime/components/JunGlobeEditor.client.vue.d.ts +43 -0
- package/dist/runtime/components/JunGlobeMap.client.d.vue.ts +58 -0
- package/dist/runtime/components/JunGlobeMap.client.vue +495 -0
- package/dist/runtime/components/JunGlobeMap.client.vue.d.ts +58 -0
- package/dist/runtime/components/JunHead.d.vue.ts +3 -0
- package/dist/runtime/components/JunHead.vue +79 -0
- package/dist/runtime/components/JunHead.vue.d.ts +3 -0
- package/dist/runtime/components/JunHorizontalTimeline.d.vue.ts +0 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue +363 -0
- package/dist/runtime/components/JunHorizontalTimeline.vue.d.ts +0 -0
- package/dist/runtime/components/JunImagePopup.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunImagePopup.client.vue +422 -0
- package/dist/runtime/components/JunImagePopup.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunIntro.d.vue.ts +3 -0
- package/dist/runtime/components/JunIntro.vue +156 -0
- package/dist/runtime/components/JunIntro.vue.d.ts +3 -0
- package/dist/runtime/components/JunItemMenu.d.vue.ts +50 -0
- package/dist/runtime/components/JunItemMenu.vue +97 -0
- package/dist/runtime/components/JunItemMenu.vue.d.ts +50 -0
- package/dist/runtime/components/JunLinksRow.d.vue.ts +19 -0
- package/dist/runtime/components/JunLinksRow.vue +96 -0
- package/dist/runtime/components/JunLinksRow.vue.d.ts +19 -0
- package/dist/runtime/components/JunLogo.d.vue.ts +15 -0
- package/dist/runtime/components/JunLogo.vue +360 -0
- package/dist/runtime/components/JunLogo.vue.d.ts +15 -0
- package/dist/runtime/components/JunMedia.client.d.vue.ts +40 -0
- package/dist/runtime/components/JunMedia.client.vue +117 -0
- package/dist/runtime/components/JunMedia.client.vue.d.ts +40 -0
- package/dist/runtime/components/JunMosaicPane.client.d.vue.ts +24 -0
- package/dist/runtime/components/JunMosaicPane.client.vue +95 -0
- package/dist/runtime/components/JunMosaicPane.client.vue.d.ts +24 -0
- package/dist/runtime/components/JunNavigation.d.vue.ts +26 -0
- package/dist/runtime/components/JunNavigation.vue +1149 -0
- package/dist/runtime/components/JunNavigation.vue.d.ts +26 -0
- package/dist/runtime/components/JunNodePanel.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunNodePanel.client.vue +23 -0
- package/dist/runtime/components/JunNodePanel.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunNotFound.d.vue.ts +7 -0
- package/dist/runtime/components/JunNotFound.vue +137 -0
- package/dist/runtime/components/JunNotFound.vue.d.ts +7 -0
- package/dist/runtime/components/JunPageHero.d.vue.ts +25 -0
- package/dist/runtime/components/JunPageHero.vue +90 -0
- package/dist/runtime/components/JunPageHero.vue.d.ts +25 -0
- package/dist/runtime/components/JunPatternBackdrop.client.d.vue.ts +7 -0
- package/dist/runtime/components/JunPatternBackdrop.client.vue +95 -0
- package/dist/runtime/components/JunPatternBackdrop.client.vue.d.ts +7 -0
- package/dist/runtime/components/JunPeerCursors.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunPeerCursors.client.vue +123 -0
- package/dist/runtime/components/JunPeerCursors.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunPresenceBlobs.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunPresenceBlobs.client.vue +172 -0
- package/dist/runtime/components/JunPresenceBlobs.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunSearch.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunSearch.client.vue +809 -0
- package/dist/runtime/components/JunSearch.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunServiceCard.d.vue.ts +10 -0
- package/dist/runtime/components/JunServiceCard.vue +145 -0
- package/dist/runtime/components/JunServiceCard.vue.d.ts +10 -0
- package/dist/runtime/components/JunShaderBackdrop.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunShaderBackdrop.client.vue +82 -0
- package/dist/runtime/components/JunShaderBackdrop.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunShell.d.vue.ts +17 -0
- package/dist/runtime/components/JunShell.vue +80 -0
- package/dist/runtime/components/JunShell.vue.d.ts +17 -0
- package/dist/runtime/components/JunStudioBar.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunStudioBar.client.vue +462 -0
- package/dist/runtime/components/JunStudioBar.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunStudioLogin.client.d.vue.ts +3 -0
- package/dist/runtime/components/JunStudioLogin.client.vue +58 -0
- package/dist/runtime/components/JunStudioLogin.client.vue.d.ts +3 -0
- package/dist/runtime/components/JunThemeToggle.d.vue.ts +3 -0
- package/dist/runtime/components/JunThemeToggle.vue +32 -0
- package/dist/runtime/components/JunThemeToggle.vue.d.ts +3 -0
- package/dist/runtime/components/JunTravellersChip.d.vue.ts +9 -0
- package/dist/runtime/components/JunTravellersChip.vue +111 -0
- package/dist/runtime/components/JunTravellersChip.vue.d.ts +9 -0
- package/dist/runtime/components/JunVideoEmbed.client.d.vue.ts +23 -0
- package/dist/runtime/components/JunVideoEmbed.client.vue +124 -0
- package/dist/runtime/components/JunVideoEmbed.client.vue.d.ts +23 -0
- package/dist/runtime/components/css-modules.d.ts +7 -0
- package/dist/runtime/components/renderers/.gitkeep +0 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.vue +271 -0
- package/dist/runtime/components/renderers/JunAppsRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunCinemaRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue +465 -0
- package/dist/runtime/components/renderers/JunCinemaRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunConfigRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunConfigRenderer.vue +2045 -0
- package/dist/runtime/components/renderers/JunConfigRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunCvRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunCvRenderer.vue +256 -0
- package/dist/runtime/components/renderers/JunCvRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue +429 -0
- package/dist/runtime/components/renderers/JunEntryRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunFestivalRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue +557 -0
- package/dist/runtime/components/renderers/JunFestivalRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.vue +91 -0
- package/dist/runtime/components/renderers/JunGlobeRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunGuestbookRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue +326 -0
- package/dist/runtime/components/renderers/JunGuestbookRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunHomeRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunHomeRenderer.vue +585 -0
- package/dist/runtime/components/renderers/JunHomeRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.vue +420 -0
- package/dist/runtime/components/renderers/JunJournalRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunLibraryRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue +319 -0
- package/dist/runtime/components/renderers/JunLibraryRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunLinksRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunLinksRenderer.vue +206 -0
- package/dist/runtime/components/renderers/JunLinksRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunLiveRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunLiveRenderer.vue +684 -0
- package/dist/runtime/components/renderers/JunLiveRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunMosaicRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue +572 -0
- package/dist/runtime/components/renderers/JunMosaicRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunMovieRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunMovieRenderer.vue +539 -0
- package/dist/runtime/components/renderers/JunMovieRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunNowRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunNowRenderer.vue +382 -0
- package/dist/runtime/components/renderers/JunNowRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue +413 -0
- package/dist/runtime/components/renderers/JunProjectRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunRedirectRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunRedirectRenderer.vue +133 -0
- package/dist/runtime/components/renderers/JunRedirectRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunServicesRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunServicesRenderer.vue +267 -0
- package/dist/runtime/components/renderers/JunServicesRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunStatsRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunStatsRenderer.vue +230 -0
- package/dist/runtime/components/renderers/JunStatsRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue +380 -0
- package/dist/runtime/components/renderers/JunTrackRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunUsesRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunUsesRenderer.vue +254 -0
- package/dist/runtime/components/renderers/JunUsesRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunWallRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunWallRenderer.vue +276 -0
- package/dist/runtime/components/renderers/JunWallRenderer.vue.d.ts +10 -0
- package/dist/runtime/components/renderers/JunWindowRenderer.d.vue.ts +10 -0
- package/dist/runtime/components/renderers/JunWindowRenderer.vue +516 -0
- package/dist/runtime/components/renderers/JunWindowRenderer.vue.d.ts +10 -0
- package/dist/runtime/composables/useJunBackdrop.d.ts +9 -0
- package/dist/runtime/composables/useJunBackdrop.js +27 -0
- package/dist/runtime/composables/useJunBackground.d.ts +78 -0
- package/dist/runtime/composables/useJunBackground.js +65 -0
- package/dist/runtime/composables/useJunCampfire.d.ts +156 -0
- package/dist/runtime/composables/useJunCampfire.js +225 -0
- package/dist/runtime/composables/useJunChrome.d.ts +66 -0
- package/dist/runtime/composables/useJunChrome.js +233 -0
- package/dist/runtime/composables/useJunColorMode.d.ts +8 -0
- package/dist/runtime/composables/useJunColorMode.js +11 -0
- package/dist/runtime/composables/useJunCommands.d.ts +37 -0
- package/dist/runtime/composables/useJunCommands.js +225 -0
- package/dist/runtime/composables/useJunCreatePage.d.ts +17 -0
- package/dist/runtime/composables/useJunCreatePage.js +30 -0
- package/dist/runtime/composables/useJunCurrentDoc.d.ts +5 -0
- package/dist/runtime/composables/useJunCurrentDoc.js +14 -0
- package/dist/runtime/composables/useJunDocMenu.d.ts +71 -0
- package/dist/runtime/composables/useJunDocMenu.js +344 -0
- package/dist/runtime/composables/useJunDocPage.d.ts +99 -0
- package/dist/runtime/composables/useJunDocPage.js +155 -0
- package/dist/runtime/composables/useJunFollow.d.ts +11 -0
- package/dist/runtime/composables/useJunFollow.js +38 -0
- package/dist/runtime/composables/useJunGroupedDnD.d.ts +74 -0
- package/dist/runtime/composables/useJunGroupedDnD.js +186 -0
- package/dist/runtime/composables/useJunImagePopup.d.ts +37 -0
- package/dist/runtime/composables/useJunImagePopup.js +24 -0
- package/dist/runtime/composables/useJunIntro.d.ts +7 -0
- package/dist/runtime/composables/useJunIntro.js +8 -0
- package/dist/runtime/composables/useJunListDnD.d.ts +65 -0
- package/dist/runtime/composables/useJunListDnD.js +159 -0
- package/dist/runtime/composables/useJunMediaImport.d.ts +27 -0
- package/dist/runtime/composables/useJunMediaImport.js +90 -0
- package/dist/runtime/composables/useJunNavSettings.d.ts +57 -0
- package/dist/runtime/composables/useJunNavSettings.js +74 -0
- package/dist/runtime/composables/useJunNodePanel.d.ts +41 -0
- package/dist/runtime/composables/useJunNodePanel.js +36 -0
- package/dist/runtime/composables/useJunOpenDoc.d.ts +7 -0
- package/dist/runtime/composables/useJunOpenDoc.js +30 -0
- package/dist/runtime/composables/useJunOptions.d.ts +68 -0
- package/dist/runtime/composables/useJunOptions.js +68 -0
- package/dist/runtime/composables/useJunPalette.d.ts +16 -0
- package/dist/runtime/composables/useJunPalette.js +72 -0
- package/dist/runtime/composables/useJunPeopleAdmin.d.ts +69 -0
- package/dist/runtime/composables/useJunPeopleAdmin.js +73 -0
- package/dist/runtime/composables/useJunPlayer.d.ts +99 -0
- package/dist/runtime/composables/useJunPlayer.js +208 -0
- package/dist/runtime/composables/useJunPresence.d.ts +32 -0
- package/dist/runtime/composables/useJunPresence.js +53 -0
- package/dist/runtime/composables/useJunPressDrag.d.ts +20 -0
- package/dist/runtime/composables/useJunPressDrag.js +85 -0
- package/dist/runtime/composables/useJunRecent.d.ts +9 -0
- package/dist/runtime/composables/useJunRecent.js +44 -0
- package/dist/runtime/composables/useJunRename.d.ts +19 -0
- package/dist/runtime/composables/useJunRename.js +62 -0
- package/dist/runtime/composables/useJunRouteGeoHeal.d.ts +1 -0
- package/dist/runtime/composables/useJunRouteGeoHeal.js +45 -0
- package/dist/runtime/composables/useJunRouting.d.ts +29 -0
- package/dist/runtime/composables/useJunRouting.js +101 -0
- package/dist/runtime/composables/useJunSearch.d.ts +6 -0
- package/dist/runtime/composables/useJunSearch.js +16 -0
- package/dist/runtime/composables/useJunSelfId.d.ts +1 -0
- package/dist/runtime/composables/useJunSelfId.js +28 -0
- package/dist/runtime/composables/useJunSiteConfig.d.ts +229 -0
- package/dist/runtime/composables/useJunSiteConfig.js +95 -0
- package/dist/runtime/composables/useJunSiteConfigValues.d.ts +33 -0
- package/dist/runtime/composables/useJunSiteConfigValues.js +21 -0
- package/dist/runtime/composables/useJunStagger.d.ts +54 -0
- package/dist/runtime/composables/useJunStagger.js +23 -0
- package/dist/runtime/composables/useJunStudio.d.ts +11 -0
- package/dist/runtime/composables/useJunStudio.js +51 -0
- package/dist/runtime/composables/useJunSurface.d.ts +19 -0
- package/dist/runtime/composables/useJunSurface.js +8 -0
- package/dist/runtime/composables/useJunTheme.d.ts +21 -0
- package/dist/runtime/composables/useJunTheme.js +138 -0
- package/dist/runtime/composables/useJunThemeTransition.d.ts +5 -0
- package/dist/runtime/composables/useJunThemeTransition.js +32 -0
- package/dist/runtime/composables/useJunUpload.d.ts +12 -0
- package/dist/runtime/composables/useJunUpload.js +44 -0
- package/dist/runtime/composables/useJunViewingAccent.d.ts +6 -0
- package/dist/runtime/composables/useJunViewingAccent.js +28 -0
- package/dist/runtime/error.d.vue.ts +7 -0
- package/dist/runtime/error.vue +74 -0
- package/dist/runtime/error.vue.d.ts +7 -0
- package/dist/runtime/layouts/jun.d.vue.ts +13 -0
- package/dist/runtime/layouts/jun.vue +162 -0
- package/dist/runtime/layouts/jun.vue.d.ts +13 -0
- package/dist/runtime/pages/doc.d.vue.ts +3 -0
- package/dist/runtime/pages/doc.vue +142 -0
- package/dist/runtime/pages/doc.vue.d.ts +3 -0
- package/dist/runtime/pages/index.d.vue.ts +3 -0
- package/dist/runtime/pages/index.vue +64 -0
- package/dist/runtime/pages/index.vue.d.ts +3 -0
- package/dist/runtime/plugins/jun-drag-affordance.client.d.ts +2 -0
- package/dist/runtime/plugins/jun-drag-affordance.client.js +9 -0
- package/dist/runtime/router.options.d.ts +3 -0
- package/dist/runtime/router.options.js +72 -0
- package/dist/runtime/server/api/nav.get.d.ts +9 -0
- package/dist/runtime/server/api/nav.get.js +16 -0
- package/dist/runtime/server/api/resolve/[...slug].get.d.ts +18 -0
- package/dist/runtime/server/api/resolve/[...slug].get.js +20 -0
- package/dist/runtime/server/api/search.get.d.ts +13 -0
- package/dist/runtime/server/api/search.get.js +72 -0
- package/dist/runtime/server/api/service.get.d.ts +12 -0
- package/dist/runtime/server/api/service.get.js +39 -0
- package/dist/runtime/server/api/site-config.get.d.ts +2 -0
- package/dist/runtime/server/api/site-config.get.js +3 -0
- package/dist/runtime/server/api/stats.get.d.ts +12 -0
- package/dist/runtime/server/api/stats.get.js +56 -0
- package/dist/runtime/server/janitor/junJanitorActor.d.ts +179 -0
- package/dist/runtime/server/janitor/junJanitorActor.js +305 -0
- package/dist/runtime/server/janitor/junJanitorChores.d.ts +137 -0
- package/dist/runtime/server/janitor/junJanitorChores.js +189 -0
- package/dist/runtime/server/janitor/junJanitorDiff.d.ts +41 -0
- package/dist/runtime/server/janitor/junJanitorDiff.js +109 -0
- package/dist/runtime/server/janitor/junJanitorListen.d.ts +33 -0
- package/dist/runtime/server/janitor/junJanitorListen.js +43 -0
- package/dist/runtime/server/janitor/junJanitorMachine.d.ts +60 -0
- package/dist/runtime/server/janitor/junJanitorMachine.js +598 -0
- package/dist/runtime/server/janitor/junJanitorMotor.d.ts +211 -0
- package/dist/runtime/server/janitor/junJanitorMotor.js +241 -0
- package/dist/runtime/server/janitor/junJanitorPatrol.d.ts +68 -0
- package/dist/runtime/server/janitor/junJanitorPatrol.js +34 -0
- package/dist/runtime/server/janitor/junJanitorPerform.d.ts +70 -0
- package/dist/runtime/server/janitor/junJanitorPerform.js +72 -0
- package/dist/runtime/server/janitor/junJanitorRandom.d.ts +54 -0
- package/dist/runtime/server/janitor/junJanitorRandom.js +48 -0
- package/dist/runtime/server/janitor/junJanitorStore.d.ts +159 -0
- package/dist/runtime/server/janitor/junJanitorStore.js +269 -0
- package/dist/runtime/server/janitor/junJanitorVoice.d.ts +86 -0
- package/dist/runtime/server/janitor/junJanitorVoice.js +193 -0
- package/dist/runtime/server/janitor/junJanitorYText.d.ts +164 -0
- package/dist/runtime/server/janitor/junJanitorYText.js +258 -0
- package/dist/runtime/server/plugins/jun-bootstrap.d.ts +25 -0
- package/dist/runtime/server/plugins/jun-bootstrap.js +652 -0
- package/dist/runtime/server/plugins/jun-doc-cache.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-doc-cache.js +142 -0
- package/dist/runtime/server/plugins/jun-janitor.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-janitor.js +176 -0
- package/dist/runtime/server/plugins/jun-rpc.d.ts +2 -0
- package/dist/runtime/server/plugins/jun-rpc.js +455 -0
- package/dist/runtime/server/routes/feed.json.get.d.ts +21 -0
- package/dist/runtime/server/routes/feed.json.get.js +25 -0
- package/dist/runtime/server/routes/feed.xml.get.d.ts +2 -0
- package/dist/runtime/server/routes/feed.xml.get.js +34 -0
- package/dist/runtime/server/routes/sitemap.xml.get.d.ts +2 -0
- package/dist/runtime/server/routes/sitemap.xml.get.js +27 -0
- package/dist/runtime/server/utils/junCache.d.ts +41 -0
- package/dist/runtime/server/utils/junCache.js +32 -0
- package/dist/runtime/server/utils/junFeed.d.ts +20 -0
- package/dist/runtime/server/utils/junFeed.js +71 -0
- package/dist/runtime/server/utils/junServiceFetch.d.ts +46 -0
- package/dist/runtime/server/utils/junServiceFetch.js +320 -0
- package/dist/runtime/server/utils/junVisibility.d.ts +31 -0
- package/dist/runtime/server/utils/junVisibility.js +6 -0
- package/dist/runtime/types.d.ts +853 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/utils/junDate.d.ts +38 -0
- package/dist/runtime/utils/junDate.js +30 -0
- package/dist/runtime/utils/junDndGeometry.d.ts +62 -0
- package/dist/runtime/utils/junDndGeometry.js +56 -0
- package/dist/runtime/utils/junDocTypeIcons.d.ts +30 -0
- package/dist/runtime/utils/junDocTypeIcons.js +30 -0
- package/dist/runtime/utils/junEditorBodyText.d.ts +32 -0
- package/dist/runtime/utils/junEditorBodyText.js +10 -0
- package/dist/runtime/utils/junMapboxToken.d.ts +1 -0
- package/dist/runtime/utils/junMapboxToken.js +5 -0
- package/dist/runtime/utils/junMatch.d.ts +45 -0
- package/dist/runtime/utils/junMatch.js +37 -0
- package/dist/runtime/utils/junMetaSchemas.d.ts +23 -0
- package/dist/runtime/utils/junMetaSchemas.js +94 -0
- package/dist/runtime/utils/junMotion.d.ts +71 -0
- package/dist/runtime/utils/junMotion.js +3 -0
- package/dist/runtime/utils/junServiceRef.d.ts +21 -0
- package/dist/runtime/utils/junServiceRef.js +94 -0
- package/dist/runtime/utils/junSimplifyPath.d.ts +23 -0
- package/dist/runtime/utils/junSimplifyPath.js +57 -0
- package/dist/runtime/utils/junTransportModes.d.ts +49 -0
- package/dist/runtime/utils/junTransportModes.js +37 -0
- package/dist/runtime/utils/junVideoSource.d.ts +51 -0
- package/dist/runtime/utils/junVideoSource.js +110 -0
- package/dist/runtime/utils/junVisibility.d.ts +14 -0
- package/dist/runtime/utils/junVisibility.js +6 -0
- package/dist/types.d.mts +5 -0
- 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 {};
|