@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,598 @@
|
|
|
1
|
+
import { junRng } from "./junJanitorRandom.js";
|
|
2
|
+
import {
|
|
3
|
+
JUN_MOTOR_DEFAULT,
|
|
4
|
+
motorDuration,
|
|
5
|
+
planCut,
|
|
6
|
+
planDeletion,
|
|
7
|
+
planPointerIdle,
|
|
8
|
+
planPointerPath,
|
|
9
|
+
planReading,
|
|
10
|
+
planTyping
|
|
11
|
+
} from "./junJanitorMotor.js";
|
|
12
|
+
import {
|
|
13
|
+
JUN_CHORE_POLICY_DEFAULT,
|
|
14
|
+
describeChore,
|
|
15
|
+
planBodyChores,
|
|
16
|
+
planTreeChores
|
|
17
|
+
} from "./junJanitorChores.js";
|
|
18
|
+
import { createJunVoice } from "./junJanitorVoice.js";
|
|
19
|
+
import {
|
|
20
|
+
JUN_PATROL_POLICY_DEFAULT,
|
|
21
|
+
nextPatrolTarget
|
|
22
|
+
} from "./junJanitorPatrol.js";
|
|
23
|
+
import { junHear } from "./junJanitorListen.js";
|
|
24
|
+
import { junBlocks, displayToBody, displayToBodyPos, junCursorState, junFragmentText } from "./junJanitorYText.js";
|
|
25
|
+
import { junPerform, junRangeMatches } from "./junJanitorPerform.js";
|
|
26
|
+
import {
|
|
27
|
+
junBin,
|
|
28
|
+
junClaimLease,
|
|
29
|
+
junReleaseLease,
|
|
30
|
+
junReadBaseline,
|
|
31
|
+
junReadBin,
|
|
32
|
+
junReadTree,
|
|
33
|
+
junWriteBaseline
|
|
34
|
+
} from "./junJanitorStore.js";
|
|
35
|
+
const IDLE_MIN_MS = 2e4;
|
|
36
|
+
const IDLE_MAX_MS = 9e4;
|
|
37
|
+
const BREAK_MIN_MS = 4 * 6e4;
|
|
38
|
+
const BREAK_MAX_MS = 12 * 6e4;
|
|
39
|
+
const LEASE_CHECK_MS = 6e4;
|
|
40
|
+
const LEASE_STALE_MS = 5 * 6e4;
|
|
41
|
+
const GRUDGE_COOLDOWN_MS = 30 * 6e4;
|
|
42
|
+
const IMPATIENT_AT = 3;
|
|
43
|
+
const GIVE_UP_AT = 5;
|
|
44
|
+
export function createJunJanitorMachine(options, deps) {
|
|
45
|
+
const now = deps.now ?? (() => Date.now());
|
|
46
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
47
|
+
const rng = junRng(options.seed ?? `${options.name}:${options.rootDocId}`);
|
|
48
|
+
const voice = createJunVoice(rng.fork(), {
|
|
49
|
+
cadence: options.voice,
|
|
50
|
+
extra: options.phrases
|
|
51
|
+
});
|
|
52
|
+
const motor = { ...JUN_MOTOR_DEFAULT, ...options.motor ?? {} };
|
|
53
|
+
const patrolPolicy = { ...JUN_PATROL_POLICY_DEFAULT, ...options.patrol ?? {} };
|
|
54
|
+
const idleMin = options.patrol?.idleMinMs ?? IDLE_MIN_MS;
|
|
55
|
+
const idleMax = options.patrol?.idleMaxMs ?? IDLE_MAX_MS;
|
|
56
|
+
const idleWait = () => rng.range(idleMin, idleMax);
|
|
57
|
+
const ignored = /* @__PURE__ */ new Set([...JUN_CHORE_POLICY_DEFAULT.ignoreDocIds, ...options.ignoreDocIds]);
|
|
58
|
+
const chorePolicy = () => ({
|
|
59
|
+
...JUN_CHORE_POLICY_DEFAULT,
|
|
60
|
+
...options.chores ?? {},
|
|
61
|
+
ignoreDocIds: [...ignored]
|
|
62
|
+
});
|
|
63
|
+
const memory = /* @__PURE__ */ new Map();
|
|
64
|
+
const seenEntries = /* @__PURE__ */ new Map();
|
|
65
|
+
const choreTimes = [];
|
|
66
|
+
let running = false;
|
|
67
|
+
let phase = "off";
|
|
68
|
+
let choresThisShift = 0;
|
|
69
|
+
let lastBreakAt = 0;
|
|
70
|
+
let onDutyAnnounced = false;
|
|
71
|
+
let baselineHandle = null;
|
|
72
|
+
let baselineSnapshot = null;
|
|
73
|
+
let pointer = { x: 0.5, y: 0.5 };
|
|
74
|
+
let unwatchPeers = null;
|
|
75
|
+
let unwatchChat = null;
|
|
76
|
+
let heard = null;
|
|
77
|
+
const instanceId = `${options.name}:${crypto.randomUUID()}`;
|
|
78
|
+
let leaseCheckedAt = 0;
|
|
79
|
+
let holdsLease = true;
|
|
80
|
+
const remember = (docId) => {
|
|
81
|
+
let entry = memory.get(docId);
|
|
82
|
+
if (!entry) {
|
|
83
|
+
entry = { lastVisitedAt: 0, entryChangedAt: 0, presenceAt: 0, grudge: 0, givenUpUntil: 0 };
|
|
84
|
+
memory.set(docId, entry);
|
|
85
|
+
}
|
|
86
|
+
return entry;
|
|
87
|
+
};
|
|
88
|
+
function onDuty(at) {
|
|
89
|
+
const [from, to] = options.shiftHours;
|
|
90
|
+
if (from === 0 && to >= 24) return true;
|
|
91
|
+
const hour = new Date(at).getHours();
|
|
92
|
+
return from <= to ? hour >= from && hour < to : hour >= from || hour < to;
|
|
93
|
+
}
|
|
94
|
+
function withinBudget(at) {
|
|
95
|
+
const hourAgo = at - 36e5;
|
|
96
|
+
while (choreTimes.length && choreTimes[0] < hourAgo) choreTimes.shift();
|
|
97
|
+
return choreTimes.length < options.budget.choresPerHour;
|
|
98
|
+
}
|
|
99
|
+
async function killed() {
|
|
100
|
+
try {
|
|
101
|
+
const config = await deps.siteConfig();
|
|
102
|
+
return config.janitorEnabled === false;
|
|
103
|
+
} catch {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
async function speak(event, ctx = {}, force = false) {
|
|
108
|
+
const at = now();
|
|
109
|
+
const line = voice.line(event, ctx, { now: at, force });
|
|
110
|
+
if (!line) return;
|
|
111
|
+
try {
|
|
112
|
+
deps.actor.sayTyping(options.rootDocId);
|
|
113
|
+
await sleep(voice.typingMs(line));
|
|
114
|
+
deps.actor.say(options.rootDocId, line);
|
|
115
|
+
voice.noteSpoken(now());
|
|
116
|
+
deps.log(`says: ${line}`);
|
|
117
|
+
} catch (error) {
|
|
118
|
+
deps.log(`could not speak: ${error?.message ?? error}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
async function movePointer(to) {
|
|
122
|
+
for (const step of planPointerPath(pointer, to, rng)) {
|
|
123
|
+
if (!running) return;
|
|
124
|
+
pointer = { x: step.x, y: step.y };
|
|
125
|
+
deps.actor.setPointer(step.x, step.y);
|
|
126
|
+
await sleep(step.delayMs);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async function dwell(ms) {
|
|
130
|
+
for (const step of planPointerIdle(pointer, ms, rng)) {
|
|
131
|
+
if (!running) return;
|
|
132
|
+
pointer = { x: step.x, y: step.y };
|
|
133
|
+
deps.actor.setPointer(step.x, step.y);
|
|
134
|
+
await sleep(step.delayMs);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function screenPointFor(fraction) {
|
|
138
|
+
return {
|
|
139
|
+
x: 0.42 + rng.range(-0.06, 0.06),
|
|
140
|
+
y: 0.24 + Math.min(1, Math.max(0, fraction)) * 0.5 + rng.range(-0.04, 0.04)
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
async function travelTo(docId) {
|
|
144
|
+
phase = "travelling";
|
|
145
|
+
const page = await deps.slugFor(docId);
|
|
146
|
+
deps.actor.setPlace(docId, page);
|
|
147
|
+
deps.actor.setStatus("having a look");
|
|
148
|
+
await movePointer(screenPointFor(rng.range(0.1, 0.4)));
|
|
149
|
+
}
|
|
150
|
+
function labelOf(snapshot, docId) {
|
|
151
|
+
return snapshot.docs[docId]?.label || "somewhere";
|
|
152
|
+
}
|
|
153
|
+
function someoneOn(docId) {
|
|
154
|
+
return deps.actor.peers().find((p) => p.docId === docId)?.name;
|
|
155
|
+
}
|
|
156
|
+
async function performBodyChore(chore, fragment, doc, docLabel) {
|
|
157
|
+
if (chore.kind !== "body.remove" && chore.kind !== "body.restore" && chore.kind !== "body.replace") {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
const expected = chore.kind === "body.restore" ? "" : chore.kind === "body.remove" ? chore.text : chore.remove;
|
|
161
|
+
if (!junRangeMatches(fragment, chore.at, expected)) {
|
|
162
|
+
deps.log(`${chore.kind} on ${docLabel}: text moved, leaving it`);
|
|
163
|
+
await speak("yield", { page: docLabel, who: someoneOn(chore.docId) });
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
const grudge = remember(chore.docId).grudge;
|
|
167
|
+
const impatient = grudge >= IMPATIENT_AT;
|
|
168
|
+
const choreRng = junRng(chore.id);
|
|
169
|
+
const blocks = junBlocks(fragment);
|
|
170
|
+
const at = displayToBody(blocks, chore.at);
|
|
171
|
+
const bin = (text) => {
|
|
172
|
+
if (baselineHandle && text.trim()) {
|
|
173
|
+
junBin(baselineHandle, { docId: chore.docId, label: docLabel, text, at: now() });
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
const handle = {
|
|
177
|
+
doc,
|
|
178
|
+
fragment,
|
|
179
|
+
sleep,
|
|
180
|
+
aborted: () => !running,
|
|
181
|
+
cursor: (anchor, head) => {
|
|
182
|
+
deps.actor.setCursor(junCursorState(fragment, anchor, head), anchor, head);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
const removeLength = chore.kind === "body.restore" ? 0 : expected.length;
|
|
186
|
+
if (removeLength) {
|
|
187
|
+
const end2 = displayToBody(blocks, chore.at + removeLength);
|
|
188
|
+
deps.actor.setCursor(junCursorState(fragment, at, end2), at, end2);
|
|
189
|
+
await dwell(planReading(removeLength, choreRng, { profile: motor, speed: impatient ? 0.6 : 1 }));
|
|
190
|
+
}
|
|
191
|
+
if (options.mode === "observe") {
|
|
192
|
+
deps.log(`WOULD ${chore.kind} on ${docLabel}: ${JSON.stringify(expected.slice(0, 60))}`);
|
|
193
|
+
deps.actor.setCursor(null);
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
phase = "working";
|
|
197
|
+
deps.actor.setStatus("tidying");
|
|
198
|
+
if (chore.kind === "body.remove") {
|
|
199
|
+
const end2 = displayToBody(blocks, chore.at + chore.text.length);
|
|
200
|
+
const count = end2 - at;
|
|
201
|
+
const before = blocks.map((b) => b.text).join("\n").slice(Math.max(0, chore.at - 12), chore.at);
|
|
202
|
+
const plan = chore.style === "cut" ? planCut(count, choreRng, { profile: motor }) : planDeletion(count, choreRng, { profile: motor, before, speed: impatient ? 0.7 : 1 });
|
|
203
|
+
const outcome = await junPerform(handle, chore.style === "cut" ? at : end2, plan);
|
|
204
|
+
bin(outcome.removed);
|
|
205
|
+
if (outcome.typed) await speak("oops", {}, false);
|
|
206
|
+
deps.actor.setCursor(null);
|
|
207
|
+
return outcome.status === "done";
|
|
208
|
+
}
|
|
209
|
+
if (chore.kind === "body.restore") {
|
|
210
|
+
const outcome = await junPerform(
|
|
211
|
+
handle,
|
|
212
|
+
displayToBodyPos(blocks, chore.at),
|
|
213
|
+
planTyping(chore.text, choreRng, { profile: motor, careful: false })
|
|
214
|
+
);
|
|
215
|
+
deps.actor.setCursor(null);
|
|
216
|
+
return outcome.status === "done";
|
|
217
|
+
}
|
|
218
|
+
const end = displayToBody(blocks, chore.at + chore.remove.length);
|
|
219
|
+
const removal = chore.style === "cut" ? planCut(end - at, choreRng, { profile: motor }) : planDeletion(end - at, choreRng, { profile: motor, precise: true, speed: impatient ? 0.7 : 1 });
|
|
220
|
+
const removed = await junPerform(handle, chore.style === "cut" ? at : end, removal);
|
|
221
|
+
bin(removed.removed);
|
|
222
|
+
if (removed.status !== "done") {
|
|
223
|
+
deps.actor.setCursor(null);
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
const typedBack = await junPerform(
|
|
227
|
+
handle,
|
|
228
|
+
displayToBodyPos(junBlocks(fragment), chore.at),
|
|
229
|
+
planTyping(chore.restore, choreRng, { profile: motor, careful: true })
|
|
230
|
+
);
|
|
231
|
+
deps.actor.setCursor(null);
|
|
232
|
+
return typedBack.status === "done";
|
|
233
|
+
}
|
|
234
|
+
async function performTreeChore(chore, snapshot) {
|
|
235
|
+
if (options.mode === "observe") {
|
|
236
|
+
deps.log(`WOULD ${chore.kind} on ${labelOf(snapshot, chore.docId)}`);
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
try {
|
|
240
|
+
switch (chore.kind) {
|
|
241
|
+
case "entry.rename":
|
|
242
|
+
await deps.tree.rename(chore.docId, chore.to);
|
|
243
|
+
return true;
|
|
244
|
+
case "entry.reorder":
|
|
245
|
+
await deps.tree.reorder(chore.docId, chore.order);
|
|
246
|
+
return true;
|
|
247
|
+
case "entry.meta":
|
|
248
|
+
await deps.tree.setMeta(chore.docId, chore.key, chore.value);
|
|
249
|
+
return true;
|
|
250
|
+
case "doc.remove":
|
|
251
|
+
await deps.tree.trash(chore.docId);
|
|
252
|
+
return true;
|
|
253
|
+
case "doc.restore": {
|
|
254
|
+
const base = baselineSnapshot?.docs[chore.docId];
|
|
255
|
+
if (!base) return false;
|
|
256
|
+
await deps.tree.restore(chore.docId, {
|
|
257
|
+
label: base.label,
|
|
258
|
+
type: base.type,
|
|
259
|
+
parentId: base.parentId,
|
|
260
|
+
order: base.order,
|
|
261
|
+
meta: base.meta
|
|
262
|
+
});
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
default:
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
} catch (error) {
|
|
269
|
+
deps.log(`${chore.kind} on ${chore.docId} failed: ${error?.message ?? error}`);
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function noteChore(at) {
|
|
274
|
+
choreTimes.push(at);
|
|
275
|
+
choresThisShift++;
|
|
276
|
+
}
|
|
277
|
+
async function visit(docId, snapshot) {
|
|
278
|
+
const docLabel = labelOf(snapshot, docId);
|
|
279
|
+
const mem = remember(docId);
|
|
280
|
+
const baseText = baselineSnapshot?.docs[docId]?.text;
|
|
281
|
+
if (baseText === void 0) {
|
|
282
|
+
deps.log(`${docLabel}: no baseline prose recorded \u2014 nothing to compare`);
|
|
283
|
+
mem.lastVisitedAt = now();
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
await travelTo(docId);
|
|
287
|
+
const handle = await deps.actor.enter(docId);
|
|
288
|
+
if (!handle) {
|
|
289
|
+
mem.lastVisitedAt = now();
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
try {
|
|
293
|
+
const liveText = junFragmentText(handle.fragment);
|
|
294
|
+
const chores = planBodyChores(docId, baseText, liveText, {
|
|
295
|
+
policy: chorePolicy(),
|
|
296
|
+
impatient: mem.grudge >= IMPATIENT_AT
|
|
297
|
+
});
|
|
298
|
+
mem.lastVisitedAt = now();
|
|
299
|
+
deps.log(
|
|
300
|
+
`looked at "${docLabel}": ${liveText.length} chars vs ${baseText.length} in the baseline \u2192 ${chores.length} chore(s)`
|
|
301
|
+
);
|
|
302
|
+
if (!chores.length) return;
|
|
303
|
+
const removing = chores.reduce(
|
|
304
|
+
(sum, c) => sum + (c.kind === "body.remove" ? c.text.length : c.kind === "body.replace" ? c.remove.length : 0),
|
|
305
|
+
0
|
|
306
|
+
);
|
|
307
|
+
if (liveText.length && removing / liveText.length > options.budget.maxDocRemovalRatio) {
|
|
308
|
+
deps.log(`${docLabel}: ${Math.round(removing / liveText.length * 100)}% of the page differs \u2014 leaving it for a human`);
|
|
309
|
+
await speak("giving-up", { page: docLabel }, true);
|
|
310
|
+
mem.givenUpUntil = now() + GRUDGE_COOLDOWN_MS;
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
await dwell(planReading(Math.min(liveText.length, 1200), rng, { profile: motor }));
|
|
314
|
+
await speak("arrive", { page: docLabel, who: someoneOn(docId) });
|
|
315
|
+
let done = 0;
|
|
316
|
+
for (const chore of [...chores].sort((a, b) => b.at - a.at)) {
|
|
317
|
+
if (!running || !withinBudget(now())) break;
|
|
318
|
+
const started = now();
|
|
319
|
+
const ok = await performBodyChore(chore, handle.fragment, handle.doc, docLabel);
|
|
320
|
+
deps.log(
|
|
321
|
+
`${ok ? "did" : "gave up on"} ${chore.kind} in "${docLabel}" (${Math.round((now() - started) / 100) / 10}s)`
|
|
322
|
+
);
|
|
323
|
+
if (!ok) continue;
|
|
324
|
+
noteChore(now());
|
|
325
|
+
done++;
|
|
326
|
+
if (rng.chance(0.25)) await speak("working", { page: docLabel });
|
|
327
|
+
}
|
|
328
|
+
if (done) {
|
|
329
|
+
mem.grudge++;
|
|
330
|
+
const grudge = mem.grudge;
|
|
331
|
+
await speak(
|
|
332
|
+
grudge >= IMPATIENT_AT ? "again" : "done",
|
|
333
|
+
{ page: docLabel, count: grudge, who: someoneOn(docId) }
|
|
334
|
+
);
|
|
335
|
+
if (grudge >= GIVE_UP_AT) {
|
|
336
|
+
await speak("giving-up", { page: docLabel }, true);
|
|
337
|
+
mem.givenUpUntil = now() + GRUDGE_COOLDOWN_MS;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
} finally {
|
|
341
|
+
const settled = await deps.actor.leave();
|
|
342
|
+
if (!settled) {
|
|
343
|
+
mem.lastVisitedAt = 0;
|
|
344
|
+
deps.log(`"${docLabel}" did not accept the changes \u2014 will look again`);
|
|
345
|
+
}
|
|
346
|
+
deps.actor.setStatus(null);
|
|
347
|
+
phase = "idle";
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async function turn() {
|
|
351
|
+
const at = now();
|
|
352
|
+
if (baselineHandle && at - leaseCheckedAt > LEASE_CHECK_MS) {
|
|
353
|
+
leaseCheckedAt = at;
|
|
354
|
+
const held = junClaimLease(baselineHandle, instanceId, at, LEASE_STALE_MS);
|
|
355
|
+
if (held !== holdsLease) {
|
|
356
|
+
holdsLease = held;
|
|
357
|
+
deps.log(held ? "took over the shift" : "another janitor is on duty \u2014 standing by");
|
|
358
|
+
if (!held) {
|
|
359
|
+
deps.actor.setPlace(null, null);
|
|
360
|
+
deps.actor.setStatus(null);
|
|
361
|
+
deps.actor.clearPointer();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (!holdsLease) return LEASE_CHECK_MS;
|
|
366
|
+
if (await killed()) {
|
|
367
|
+
phase = "stood-down";
|
|
368
|
+
deps.actor.setStatus(null);
|
|
369
|
+
deps.actor.setPlace(null, null);
|
|
370
|
+
deps.actor.clearPointer();
|
|
371
|
+
return 6e4;
|
|
372
|
+
}
|
|
373
|
+
if (!onDuty(at)) {
|
|
374
|
+
if (onDutyAnnounced) {
|
|
375
|
+
await speak("shift.end", {}, true);
|
|
376
|
+
onDutyAnnounced = false;
|
|
377
|
+
deps.actor.setStatus("off duty");
|
|
378
|
+
deps.actor.clearPointer();
|
|
379
|
+
deps.actor.setPlace(null, null);
|
|
380
|
+
}
|
|
381
|
+
return 5 * 6e4;
|
|
382
|
+
}
|
|
383
|
+
if (!onDutyAnnounced) {
|
|
384
|
+
onDutyAnnounced = true;
|
|
385
|
+
const hour = new Date(at).getHours();
|
|
386
|
+
await speak(hour >= 1 && hour <= 4 ? "night" : "shift.start", {}, true);
|
|
387
|
+
}
|
|
388
|
+
if (choresThisShift >= options.budget.choresPerShift && at - lastBreakAt > BREAK_MIN_MS) {
|
|
389
|
+
phase = "break";
|
|
390
|
+
choresThisShift = 0;
|
|
391
|
+
lastBreakAt = at;
|
|
392
|
+
await speak("break.start", {}, true);
|
|
393
|
+
deps.log("taking a break");
|
|
394
|
+
deps.actor.setStatus("back shortly");
|
|
395
|
+
deps.actor.setPlace(null, null);
|
|
396
|
+
await movePointer({ x: rng.range(0.02, 0.12), y: rng.range(0.85, 0.97) });
|
|
397
|
+
deps.actor.clearPointer();
|
|
398
|
+
const breakMs = rng.range(BREAK_MIN_MS, BREAK_MAX_MS);
|
|
399
|
+
await sleep(breakMs);
|
|
400
|
+
deps.log(`back from a break (${Math.round(breakMs / 6e4)}m)`);
|
|
401
|
+
await speak("break.end", {}, true);
|
|
402
|
+
return 0;
|
|
403
|
+
}
|
|
404
|
+
if (heard) {
|
|
405
|
+
const question = heard;
|
|
406
|
+
heard = null;
|
|
407
|
+
const binned = baselineHandle ? junReadBin(baselineHandle).at(-1) : void 0;
|
|
408
|
+
await speak(
|
|
409
|
+
question.intent,
|
|
410
|
+
{ who: question.senderName, page: binned?.label },
|
|
411
|
+
true
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
const tree = deps.actor.tree;
|
|
415
|
+
if (!tree) return idleMin;
|
|
416
|
+
const live = junReadTree(tree, options.rootDocId);
|
|
417
|
+
for (const [id, doc] of Object.entries(live.docs)) {
|
|
418
|
+
const previous = seenEntries.get(id);
|
|
419
|
+
const mem = remember(id);
|
|
420
|
+
const changed = previous !== void 0 && (previous.label !== doc.label || previous.order !== doc.order || (doc.updatedAt ?? 0) > (previous.updatedAt ?? 0));
|
|
421
|
+
if (changed) mem.entryChangedAt = at;
|
|
422
|
+
seenEntries.set(id, { label: doc.label, order: doc.order, updatedAt: doc.updatedAt ?? 0 });
|
|
423
|
+
}
|
|
424
|
+
if (!baselineSnapshot) {
|
|
425
|
+
phase = "idle";
|
|
426
|
+
if (rng.chance(0.15)) await speak("aside");
|
|
427
|
+
return idleWait();
|
|
428
|
+
}
|
|
429
|
+
const treeChores = planTreeChores(baselineSnapshot, live, { policy: chorePolicy() }).filter((c) => c.kind !== "body.remove" && c.kind !== "body.restore" && c.kind !== "body.replace").filter((c) => remember(c.docId).givenUpUntil < at);
|
|
430
|
+
if (treeChores.length && withinBudget(at)) {
|
|
431
|
+
const chore = treeChores[0];
|
|
432
|
+
const description = describeChore(chore);
|
|
433
|
+
const occupant = someoneOn(chore.docId);
|
|
434
|
+
await speak("notice", { page: labelOf(live, chore.docId), what: description.what, who: occupant });
|
|
435
|
+
await travelTo(chore.docId);
|
|
436
|
+
await dwell(planReading(120, rng, { profile: motor }));
|
|
437
|
+
const ok = await performTreeChore(chore, live);
|
|
438
|
+
deps.log(`${ok ? "did" : "gave up on"} ${chore.kind} on "${labelOf(live, chore.docId)}"`);
|
|
439
|
+
if (ok) {
|
|
440
|
+
noteChore(now());
|
|
441
|
+
remember(chore.docId).grudge++;
|
|
442
|
+
await speak("done", { page: labelOf(live, chore.docId) });
|
|
443
|
+
}
|
|
444
|
+
deps.actor.setStatus(null);
|
|
445
|
+
return idleWait();
|
|
446
|
+
}
|
|
447
|
+
const candidates = Object.keys(baselineSnapshot.docs).filter((id) => !ignored.has(id)).filter((id) => live.docs[id] && !live.docs[id].trashed).filter((id) => remember(id).givenUpUntil < at).map((id) => {
|
|
448
|
+
const mem = remember(id);
|
|
449
|
+
return {
|
|
450
|
+
docId: id,
|
|
451
|
+
lastVisitedAt: mem.lastVisitedAt,
|
|
452
|
+
entryChangedAt: mem.entryChangedAt,
|
|
453
|
+
presenceAt: mem.presenceAt,
|
|
454
|
+
occupied: deps.actor.peers().some((p) => p.docId === id),
|
|
455
|
+
grudge: mem.grudge,
|
|
456
|
+
pendingChores: 0
|
|
457
|
+
};
|
|
458
|
+
});
|
|
459
|
+
const target = nextPatrolTarget(candidates, at, patrolPolicy);
|
|
460
|
+
deps.log(`patrol: ${candidates.length} candidates \u2192 ${target?.docId.slice(0, 8) ?? "nowhere"}`);
|
|
461
|
+
if (!target) {
|
|
462
|
+
phase = "idle";
|
|
463
|
+
deps.actor.setStatus(null);
|
|
464
|
+
if (rng.chance(0.12)) await speak("aside");
|
|
465
|
+
else if (rng.chance(0.05)) await speak("quiet");
|
|
466
|
+
await dwell(rng.range(3e3, 9e3));
|
|
467
|
+
return idleWait();
|
|
468
|
+
}
|
|
469
|
+
if (!withinBudget(at)) {
|
|
470
|
+
phase = "idle";
|
|
471
|
+
return idleWait();
|
|
472
|
+
}
|
|
473
|
+
await visit(target.docId, live);
|
|
474
|
+
return idleWait();
|
|
475
|
+
}
|
|
476
|
+
async function captureBaseline() {
|
|
477
|
+
const handle = options.mode === "clean" ? await deps.baseline() : null;
|
|
478
|
+
if (!handle && options.mode === "clean") return false;
|
|
479
|
+
if (handle?.docId) ignored.add(handle.docId);
|
|
480
|
+
const tree = deps.actor.tree;
|
|
481
|
+
if (!tree) return false;
|
|
482
|
+
const snapshot = junReadTree(tree, options.rootDocId);
|
|
483
|
+
deps.log(`capturing a baseline over ${Object.keys(snapshot.docs).length} documents\u2026`);
|
|
484
|
+
for (const doc of Object.values(snapshot.docs)) {
|
|
485
|
+
if (doc.trashed || ignored.has(doc.id)) continue;
|
|
486
|
+
const open = await deps.actor.enter(doc.id);
|
|
487
|
+
if (!open) continue;
|
|
488
|
+
doc.text = junFragmentText(open.fragment);
|
|
489
|
+
}
|
|
490
|
+
await deps.actor.leave();
|
|
491
|
+
if (handle) junWriteBaseline(handle, snapshot);
|
|
492
|
+
baselineSnapshot = snapshot;
|
|
493
|
+
baselineHandle = handle;
|
|
494
|
+
deps.log(
|
|
495
|
+
handle ? 'baseline captured \u2014 this is now what "clean" means' : "baseline captured IN MEMORY (observe mode) \u2014 nothing was written"
|
|
496
|
+
);
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
async function loop() {
|
|
500
|
+
while (running) {
|
|
501
|
+
try {
|
|
502
|
+
const wait = await turn();
|
|
503
|
+
if (phase !== "break" && phase !== "stood-down") phase = "idle";
|
|
504
|
+
if (wait > 0) {
|
|
505
|
+
deps.log(`nothing more for now \u2014 back in ${Math.round(wait / 1e3)}s`);
|
|
506
|
+
await sleep(wait);
|
|
507
|
+
}
|
|
508
|
+
} catch (error) {
|
|
509
|
+
deps.log(`turn failed: ${error?.message ?? error}`);
|
|
510
|
+
try {
|
|
511
|
+
await deps.actor.leave();
|
|
512
|
+
} catch {
|
|
513
|
+
}
|
|
514
|
+
await sleep(6e4);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return {
|
|
519
|
+
start() {
|
|
520
|
+
if (running) return;
|
|
521
|
+
running = true;
|
|
522
|
+
phase = "idle";
|
|
523
|
+
unwatchChat = deps.actor.onStateless((payload) => {
|
|
524
|
+
const question = junHear(payload, {
|
|
525
|
+
channelDocId: options.rootDocId,
|
|
526
|
+
name: options.name,
|
|
527
|
+
selfId: deps.actor.identityKey
|
|
528
|
+
});
|
|
529
|
+
if (!question) return;
|
|
530
|
+
heard = question;
|
|
531
|
+
deps.log(`${question.senderName} said something (${question.intent})`);
|
|
532
|
+
});
|
|
533
|
+
unwatchPeers = deps.actor.onPeers((peers) => {
|
|
534
|
+
const at = now();
|
|
535
|
+
for (const peer of peers) {
|
|
536
|
+
if (peer.docId) remember(peer.docId).presenceAt = at;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
void (async () => {
|
|
540
|
+
try {
|
|
541
|
+
if (options.mode === "clean") {
|
|
542
|
+
const handle = await deps.baseline();
|
|
543
|
+
if (handle) {
|
|
544
|
+
baselineHandle = handle;
|
|
545
|
+
if (handle.docId) ignored.add(handle.docId);
|
|
546
|
+
baselineSnapshot = junReadBaseline(handle);
|
|
547
|
+
deps.log(
|
|
548
|
+
baselineSnapshot ? `baseline loaded: ${Object.keys(baselineSnapshot.docs).length} documents` : "no baseline stored yet"
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
if (!baselineSnapshot && (options.baselineMode ?? "after-seed") === "after-seed") {
|
|
552
|
+
deps.log("no baseline on this site yet \u2014 capturing the current state as clean");
|
|
553
|
+
await captureBaseline();
|
|
554
|
+
}
|
|
555
|
+
} else {
|
|
556
|
+
await captureBaseline();
|
|
557
|
+
}
|
|
558
|
+
} catch (error) {
|
|
559
|
+
deps.log(`baseline unavailable: ${error?.message ?? error}`);
|
|
560
|
+
}
|
|
561
|
+
await loop();
|
|
562
|
+
})();
|
|
563
|
+
},
|
|
564
|
+
async stop() {
|
|
565
|
+
running = false;
|
|
566
|
+
phase = "off";
|
|
567
|
+
unwatchPeers?.();
|
|
568
|
+
unwatchPeers = null;
|
|
569
|
+
unwatchChat?.();
|
|
570
|
+
unwatchChat = null;
|
|
571
|
+
if (baselineHandle && holdsLease) {
|
|
572
|
+
try {
|
|
573
|
+
junReleaseLease(baselineHandle, instanceId);
|
|
574
|
+
} catch {
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
if (baselineHandle) {
|
|
578
|
+
baselineHandle = null;
|
|
579
|
+
}
|
|
580
|
+
},
|
|
581
|
+
captureBaseline,
|
|
582
|
+
state: () => ({ phase, openDoc: deps.actor.openDocId, choresThisHour: choreTimes.length })
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
export function junChoreDuration(chore, rng) {
|
|
586
|
+
switch (chore.kind) {
|
|
587
|
+
case "body.remove":
|
|
588
|
+
return motorDuration(
|
|
589
|
+
chore.style === "cut" ? planCut(chore.text.length, rng) : planDeletion(chore.text.length, rng)
|
|
590
|
+
);
|
|
591
|
+
case "body.restore":
|
|
592
|
+
return motorDuration(planTyping(chore.text, rng));
|
|
593
|
+
case "body.replace":
|
|
594
|
+
return motorDuration(planDeletion(chore.remove.length, rng)) + motorDuration(planTyping(chore.restore, rng));
|
|
595
|
+
default:
|
|
596
|
+
return 1e3;
|
|
597
|
+
}
|
|
598
|
+
}
|