@mountaya/studio 0.0.0-stage → 0.1.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/CHANGELOG.md +39 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +917 -2
- package/dist/agent/index.cjs +2854 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +1257 -0
- package/dist/agent/index.d.ts +1257 -0
- package/dist/agent/index.js +2818 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/bus-BwiNiXdH.d.ts +514 -0
- package/dist/bus-DzmhPwdK.d.cts +514 -0
- package/dist/chainModel-B23pEP_1.d.cts +127 -0
- package/dist/chainModel-B23pEP_1.d.ts +127 -0
- package/dist/chunk-2HFY7ETU.js +5721 -0
- package/dist/chunk-2HFY7ETU.js.map +1 -0
- package/dist/chunk-355TOXSB.js +72 -0
- package/dist/chunk-355TOXSB.js.map +1 -0
- package/dist/chunk-4ZCUZVSV.js +10275 -0
- package/dist/chunk-4ZCUZVSV.js.map +1 -0
- package/dist/chunk-6HEKY3NF.js +95 -0
- package/dist/chunk-6HEKY3NF.js.map +1 -0
- package/dist/chunk-7GFLGGBX.cjs +8 -0
- package/dist/chunk-7GFLGGBX.cjs.map +1 -0
- package/dist/chunk-7NBRCENN.cjs +19 -0
- package/dist/chunk-7NBRCENN.cjs.map +1 -0
- package/dist/chunk-AF5GCXE3.js +8 -0
- package/dist/chunk-AF5GCXE3.js.map +1 -0
- package/dist/chunk-CJDIFRGZ.cjs +2005 -0
- package/dist/chunk-CJDIFRGZ.cjs.map +1 -0
- package/dist/chunk-CNPZY7N3.js +349 -0
- package/dist/chunk-CNPZY7N3.js.map +1 -0
- package/dist/chunk-DZJHTWSF.cjs +45 -0
- package/dist/chunk-DZJHTWSF.cjs.map +1 -0
- package/dist/chunk-EABIHHWA.js +42 -0
- package/dist/chunk-EABIHHWA.js.map +1 -0
- package/dist/chunk-EKZWV6RS.cjs +415 -0
- package/dist/chunk-EKZWV6RS.cjs.map +1 -0
- package/dist/chunk-EOKRXXAC.cjs +24 -0
- package/dist/chunk-EOKRXXAC.cjs.map +1 -0
- package/dist/chunk-F73W2ZTJ.js +1126 -0
- package/dist/chunk-F73W2ZTJ.js.map +1 -0
- package/dist/chunk-H4DVOZ5O.js +1897 -0
- package/dist/chunk-H4DVOZ5O.js.map +1 -0
- package/dist/chunk-HI52PBFT.cjs +10314 -0
- package/dist/chunk-HI52PBFT.cjs.map +1 -0
- package/dist/chunk-IDBXFBLG.cjs +1225 -0
- package/dist/chunk-IDBXFBLG.cjs.map +1 -0
- package/dist/chunk-LBWTJZUJ.js +297 -0
- package/dist/chunk-LBWTJZUJ.js.map +1 -0
- package/dist/chunk-NCLA6DKD.cjs +310 -0
- package/dist/chunk-NCLA6DKD.cjs.map +1 -0
- package/dist/chunk-O4MC5DPD.js +19 -0
- package/dist/chunk-O4MC5DPD.js.map +1 -0
- package/dist/chunk-OP37FKW6.cjs +98 -0
- package/dist/chunk-OP37FKW6.cjs.map +1 -0
- package/dist/chunk-OQSYFH3Z.cjs +5945 -0
- package/dist/chunk-OQSYFH3Z.cjs.map +1 -0
- package/dist/chunk-PACIO4NS.cjs +26 -0
- package/dist/chunk-PACIO4NS.cjs.map +1 -0
- package/dist/chunk-PSZ2R3TC.cjs +75 -0
- package/dist/chunk-PSZ2R3TC.cjs.map +1 -0
- package/dist/chunk-QFO5CZG2.cjs +136 -0
- package/dist/chunk-QFO5CZG2.cjs.map +1 -0
- package/dist/chunk-QL63MUEW.cjs +140 -0
- package/dist/chunk-QL63MUEW.cjs.map +1 -0
- package/dist/chunk-RFUPPVZO.js +17 -0
- package/dist/chunk-RFUPPVZO.js.map +1 -0
- package/dist/chunk-RPG2LWMP.js +23 -0
- package/dist/chunk-RPG2LWMP.js.map +1 -0
- package/dist/chunk-TIBXK6B7.cjs +12 -0
- package/dist/chunk-TIBXK6B7.cjs.map +1 -0
- package/dist/chunk-UU65VNEV.js +381 -0
- package/dist/chunk-UU65VNEV.js.map +1 -0
- package/dist/chunk-VGX6TR2I.js +209 -0
- package/dist/chunk-VGX6TR2I.js.map +1 -0
- package/dist/chunk-WUTDDBVP.js +130 -0
- package/dist/chunk-WUTDDBVP.js.map +1 -0
- package/dist/chunk-WVQQLKCI.cjs +224 -0
- package/dist/chunk-WVQQLKCI.cjs.map +1 -0
- package/dist/chunk-WZYXG3SE.js +111 -0
- package/dist/chunk-WZYXG3SE.js.map +1 -0
- package/dist/chunk-XDI2X3KE.js +6 -0
- package/dist/chunk-XDI2X3KE.js.map +1 -0
- package/dist/chunk-XKHLRIC7.cjs +381 -0
- package/dist/chunk-XKHLRIC7.cjs.map +1 -0
- package/dist/context-DNtd2WUv.d.cts +11666 -0
- package/dist/context-DgB72Bur.d.ts +11666 -0
- package/dist/directorThreads-CqmvsV8b.d.cts +80 -0
- package/dist/directorThreads-CqmvsV8b.d.ts +80 -0
- package/dist/en-Bu4Ti9Ev.d.cts +2315 -0
- package/dist/en-Bu4Ti9Ev.d.ts +2315 -0
- package/dist/engines/index.cjs +3446 -0
- package/dist/engines/index.cjs.map +1 -0
- package/dist/engines/index.d.cts +2216 -0
- package/dist/engines/index.d.ts +2216 -0
- package/dist/engines/index.js +3416 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/handlers/index.cjs +99 -0
- package/dist/handlers/index.cjs.map +1 -0
- package/dist/handlers/index.d.cts +445 -0
- package/dist/handlers/index.d.ts +445 -0
- package/dist/handlers/index.js +42 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.cjs +4562 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7297 -0
- package/dist/index.d.ts +7297 -0
- package/dist/index.js +3223 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/index.cjs +977 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +313 -0
- package/dist/plugins/index.d.ts +313 -0
- package/dist/plugins/index.js +933 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/saveFile-j-1kkApx.d.cts +123 -0
- package/dist/saveFile-j-1kkApx.d.ts +123 -0
- package/dist/seams/index.cjs +152 -0
- package/dist/seams/index.cjs.map +1 -0
- package/dist/seams/index.d.cts +485 -0
- package/dist/seams/index.d.ts +485 -0
- package/dist/seams/index.js +79 -0
- package/dist/seams/index.js.map +1 -0
- package/dist/shareLink-B6hlt942.d.ts +144 -0
- package/dist/shareLink-C7rIMb7x.d.ts +527 -0
- package/dist/shareLink-CnTxxXjp.d.cts +144 -0
- package/dist/shareLink-DyZVYH2V.d.cts +527 -0
- package/dist/strings/fr/index.cjs +2121 -0
- package/dist/strings/fr/index.cjs.map +1 -0
- package/dist/strings/fr/index.d.cts +19 -0
- package/dist/strings/fr/index.d.ts +19 -0
- package/dist/strings/fr/index.js +2119 -0
- package/dist/strings/fr/index.js.map +1 -0
- package/dist/strings/index.cjs +2678 -0
- package/dist/strings/index.cjs.map +1 -0
- package/dist/strings/index.d.cts +731 -0
- package/dist/strings/index.d.ts +731 -0
- package/dist/strings/index.js +2644 -0
- package/dist/strings/index.js.map +1 -0
- package/dist/studioPlugin-C3C7VjMy.d.ts +847 -0
- package/dist/studioPlugin-Cf3OBNUv.d.cts +847 -0
- package/dist/tabs-B2nRO4p_.d.cts +15 -0
- package/dist/tabs-B2nRO4p_.d.ts +15 -0
- package/dist/testing/index.cjs +292 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +306 -0
- package/dist/testing/index.d.ts +306 -0
- package/dist/testing/index.js +284 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/time/index.cjs +28 -0
- package/dist/time/index.cjs.map +1 -0
- package/dist/time/index.d.cts +43 -0
- package/dist/time/index.d.ts +43 -0
- package/dist/time/index.js +26 -0
- package/dist/time/index.js.map +1 -0
- package/dist/types-BzJRV6UI.d.cts +845 -0
- package/dist/types-BzJRV6UI.d.ts +845 -0
- package/dist/zoneForm-CdYNtnnA.d.cts +320 -0
- package/dist/zoneForm-mG85yt5e.d.ts +320 -0
- package/package.json +225 -4
- package/src/agent/engines/agentThreads.ts +1601 -0
- package/src/agent/engines/directorChat.ts +500 -0
- package/src/agent/index.ts +67 -0
- package/src/agent/rules/agentEditLock.ts +115 -0
- package/src/agent/rules/agentErrorCopy.ts +44 -0
- package/src/agent/rules/copilotOrganization.ts +36 -0
- package/src/agent/rules/playbook.gen.ts +444 -0
- package/src/agent/rules/router.ts +518 -0
- package/src/agent/rules/stateDelta.ts +28 -0
- package/src/agent/rules/studioRouter.ts +123 -0
- package/src/agent/rules/surfaces.gen.ts +633 -0
- package/src/agent/rules/threadsUrl.ts +48 -0
- package/src/agent/rules/transcriptObserver.ts +90 -0
- package/src/agent/stores/agentThreads.ts +454 -0
- package/src/bus/contracts/noData.ts +18 -0
- package/src/bus/contracts/shared.ts +172 -0
- package/src/bus/contracts/studioTools.ts +224 -0
- package/src/bus/rules/bus.ts +858 -0
- package/src/bus/rules/confirmation.ts +22 -0
- package/src/bus/rules/defineRegistry.ts +26 -0
- package/src/bus/rules/errors.ts +401 -0
- package/src/bus/rules/handlerErrors.ts +103 -0
- package/src/bus/rules/handlerRegistry.ts +627 -0
- package/src/bus/rules/inputSchema.ts +232 -0
- package/src/bus/rules/invalidInput.ts +441 -0
- package/src/bus/rules/lateBoundTools.ts +100 -0
- package/src/bus/rules/studioRegistry.ts +324 -0
- package/src/bus/rules/studioToolBus.ts +73 -0
- package/src/bus/rules/types.ts +805 -0
- package/src/chrome/contracts/alert.ts +42 -0
- package/src/chrome/contracts/itinerary.ts +26 -0
- package/src/chrome/contracts/map.ts +23 -0
- package/src/chrome/contracts/overlay.ts +46 -0
- package/src/chrome/contracts/panel.ts +29 -0
- package/src/chrome/contracts/question.ts +52 -0
- package/src/chrome/contracts/selection.ts +26 -0
- package/src/chrome/contracts/sidenav.ts +23 -0
- package/src/chrome/contracts/snapshot.ts +319 -0
- package/src/chrome/contracts/state.ts +22 -0
- package/src/chrome/contracts/tabs.ts +56 -0
- package/src/chrome/handlers/alert.ts +91 -0
- package/src/chrome/handlers/introspection.ts +180 -0
- package/src/chrome/handlers/panels.ts +42 -0
- package/src/chrome/handlers/question.ts +24 -0
- package/src/chrome/handlers/sidenav.ts +116 -0
- package/src/chrome/handlers/snapshot.ts +451 -0
- package/src/chrome/handlers/stateDelta.ts +125 -0
- package/src/chrome/handlers/tabs.ts +143 -0
- package/src/chrome/handlers/timestamp.ts +19 -0
- package/src/chrome/rules/agentSelectors.ts +210 -0
- package/src/chrome/rules/mapAlert.ts +13 -0
- package/src/chrome/rules/question.ts +25 -0
- package/src/chrome/rules/tabs.ts +13 -0
- package/src/chrome/stores/activeDraftSession.ts +134 -0
- package/src/chrome/stores/chrome.ts +527 -0
- package/src/chrome/stores/uiStore.ts +573 -0
- package/src/collab/contracts/collab.ts +261 -0
- package/src/collab/handlers/collab.ts +468 -0
- package/src/collab/rules/toolNames.ts +33 -0
- package/src/collab/stores/collab.ts +899 -0
- package/src/collections/contracts/collection.ts +182 -0
- package/src/collections/handlers/collectionAttach.ts +141 -0
- package/src/collections/handlers/collections.ts +499 -0
- package/src/collections/handlers/heldCollection.ts +42 -0
- package/src/collections/handlers/restCollections.ts +386 -0
- package/src/collections/rules/collections.ts +138 -0
- package/src/collections/rules/entityCollections.ts +53 -0
- package/src/collections/stores/collections.ts +133 -0
- package/src/data/contracts/data.ts +233 -0
- package/src/data/contracts/itinerary.ts +71 -0
- package/src/data/handlers/activityResolve.ts +76 -0
- package/src/data/handlers/data.ts +200 -0
- package/src/data/handlers/graphql.ts +26 -0
- package/src/data/handlers/mutationSink.ts +1577 -0
- package/src/data/handlers/profile.ts +83 -0
- package/src/data/handlers/writeThrough.ts +417 -0
- package/src/data/rules/cache.ts +181 -0
- package/src/data/rules/dataTypes.ts +40 -0
- package/src/data/rules/keys.ts +106 -0
- package/src/data/rules/persistence.ts +1058 -0
- package/src/data/rules/requestBody.ts +43 -0
- package/src/data/rules/restErrors.ts +354 -0
- package/src/data/rules/sessionSurface.ts +156 -0
- package/src/data/rules/toolResultData.ts +73 -0
- package/src/data/rules/uuid.ts +24 -0
- package/src/edit/contracts/edit.ts +37 -0
- package/src/edit/contracts/itinerary.ts +57 -0
- package/src/edit/handlers/draftCommit.ts +257 -0
- package/src/edit/handlers/editDiscard.ts +34 -0
- package/src/edit/handlers/editLock.ts +949 -0
- package/src/edit/handlers/editor.ts +203 -0
- package/src/edit/handlers/formUnsaved.ts +24 -0
- package/src/edit/rules/draftMetadata.ts +117 -0
- package/src/edit/rules/editKeyboard.ts +222 -0
- package/src/edit/rules/editShortcuts.ts +102 -0
- package/src/edit/rules/editTooltip.ts +174 -0
- package/src/edit/rules/editorTaken.ts +49 -0
- package/src/edit/rules/history.ts +26 -0
- package/src/edit/rules/unsavedWork.ts +60 -0
- package/src/edit/stores/editorReservation.ts +70 -0
- package/src/edit/stores/formsUnsaved.ts +54 -0
- package/src/embed/contracts/embed.ts +48 -0
- package/src/embed/engines/embedFraming.ts +1329 -0
- package/src/embed/engines/embedReady.ts +353 -0
- package/src/embed/engines/framingPageSession.ts +169 -0
- package/src/embed/handlers/embed.ts +130 -0
- package/src/embed/rules/allowedDomains.ts +71 -0
- package/src/embed/rules/bridgeMessages.ts +224 -0
- package/src/embed/rules/defaults.ts +173 -0
- package/src/embed/rules/displaySeed.ts +115 -0
- package/src/embed/rules/embedAllowlist.ts +146 -0
- package/src/embed/rules/embedConstraints.ts +215 -0
- package/src/embed/rules/embedElements.ts +277 -0
- package/src/embed/rules/embedSectionFields.ts +126 -0
- package/src/embed/rules/embedSecurity.ts +116 -0
- package/src/embed/rules/fieldDependencies.ts +87 -0
- package/src/embed/rules/fieldOptions.ts +138 -0
- package/src/embed/rules/layerOptions.ts +161 -0
- package/src/embed/rules/readyProtocol.ts +66 -0
- package/src/embed/rules/safetyRules.ts +213 -0
- package/src/embed/rules/snippet.ts +531 -0
- package/src/embed/rules/tableCode.ts +269 -0
- package/src/embed/stores/embed.ts +60 -0
- package/src/embed/stores/embedContent.ts +77 -0
- package/src/engines/index.ts +81 -0
- package/src/handlers/index.ts +66 -0
- package/src/index.ts +1086 -0
- package/src/itinerary/contracts/itinerary.ts +705 -0
- package/src/itinerary/engines/itineraryPace.ts +612 -0
- package/src/itinerary/engines/profileMarker.ts +238 -0
- package/src/itinerary/handlers/importStaging.ts +352 -0
- package/src/itinerary/handlers/itinerary.ts +572 -0
- package/src/itinerary/handlers/itineraryDuplicate.ts +177 -0
- package/src/itinerary/handlers/itineraryExport.ts +117 -0
- package/src/itinerary/handlers/itineraryImport.ts +783 -0
- package/src/itinerary/handlers/itineraryPublish.ts +118 -0
- package/src/itinerary/handlers/itinerarySelection.ts +354 -0
- package/src/itinerary/handlers/itinerarySuggest.ts +1186 -0
- package/src/itinerary/handlers/itineraryUnpublish.ts +101 -0
- package/src/itinerary/handlers/publicationScope.ts +118 -0
- package/src/itinerary/handlers/restItineraries.ts +752 -0
- package/src/itinerary/handlers/restItineraryExport.ts +70 -0
- package/src/itinerary/handlers/restItineraryImport.ts +311 -0
- package/src/itinerary/handlers/restItineraryPace.ts +87 -0
- package/src/itinerary/handlers/restItineraryRecord.ts +36 -0
- package/src/itinerary/handlers/suggestParams.ts +379 -0
- package/src/itinerary/handlers/suggestStaging.ts +363 -0
- package/src/itinerary/handlers/surfaceOpen.ts +389 -0
- package/src/itinerary/rules/activity.ts +139 -0
- package/src/itinerary/rules/analysis.ts +42 -0
- package/src/itinerary/rules/ceiling.ts +49 -0
- package/src/itinerary/rules/createFlow.ts +107 -0
- package/src/itinerary/rules/densify.ts +440 -0
- package/src/itinerary/rules/draftSurface.ts +219 -0
- package/src/itinerary/rules/editorView.ts +83 -0
- package/src/itinerary/rules/export.ts +159 -0
- package/src/itinerary/rules/friendlyName.ts +77 -0
- package/src/itinerary/rules/import.ts +1052 -0
- package/src/itinerary/rules/importFiles.ts +140 -0
- package/src/itinerary/rules/importTotals.ts +77 -0
- package/src/itinerary/rules/liveSegment.ts +712 -0
- package/src/itinerary/rules/lngLat.ts +17 -0
- package/src/itinerary/rules/mapSync.ts +100 -0
- package/src/itinerary/rules/previewRender.ts +416 -0
- package/src/itinerary/rules/profileReadout.ts +216 -0
- package/src/itinerary/rules/routing.ts +707 -0
- package/src/itinerary/rules/suggest.ts +522 -0
- package/src/itinerary/rules/suggestionPreview.ts +119 -0
- package/src/itinerary/rules/view.ts +61 -0
- package/src/itinerary/stores/importSession.ts +319 -0
- package/src/itinerary/stores/itinerary.ts +331 -0
- package/src/itinerary/stores/itineraryDuplicate.ts +76 -0
- package/src/itinerary/stores/sessionIdentity.ts +43 -0
- package/src/itinerary/stores/suggestSession.ts +418 -0
- package/src/layers/contracts/itinerary.ts +46 -0
- package/src/layers/contracts/overlay.ts +132 -0
- package/src/layers/handlers/enrichment.ts +36 -0
- package/src/layers/handlers/overlay.ts +406 -0
- package/src/layers/handlers/restLayers.ts +94 -0
- package/src/layers/handlers/tiles.ts +25 -0
- package/src/layers/rules/layers.ts +212 -0
- package/src/layers/rules/overlayInstant.ts +12 -0
- package/src/layers/rules/reachabilityIcon.ts +18 -0
- package/src/layers/rules/readout.ts +102 -0
- package/src/layers/stores/layers.ts +262 -0
- package/src/map/contracts/contextmenu.ts +33 -0
- package/src/map/contracts/geolocate.ts +37 -0
- package/src/map/contracts/map.ts +146 -0
- package/src/map/contracts/streetview.ts +53 -0
- package/src/map/contracts/terrain.ts +152 -0
- package/src/map/handlers/contextMenu.ts +135 -0
- package/src/map/handlers/geolocate.ts +52 -0
- package/src/map/handlers/map.ts +391 -0
- package/src/map/handlers/streetview.ts +94 -0
- package/src/map/handlers/terrain.ts +663 -0
- package/src/map/rules/baseTerrain.ts +75 -0
- package/src/map/rules/clickTargets.ts +464 -0
- package/src/map/rules/constraints.ts +32 -0
- package/src/map/rules/contextMenuReadout.ts +67 -0
- package/src/map/rules/coordinates.ts +71 -0
- package/src/map/rules/itineraryFit.ts +8 -0
- package/src/map/rules/mapEvents.ts +64 -0
- package/src/map/rules/mapProjection.ts +476 -0
- package/src/map/rules/terrainReading.ts +62 -0
- package/src/plugins/contracts/ids.ts +66 -0
- package/src/plugins/contracts/plugin.ts +200 -0
- package/src/plugins/contracts/slots.ts +137 -0
- package/src/plugins/engines/studioPlugin.ts +1365 -0
- package/src/plugins/index.ts +111 -0
- package/src/plugins/rules/contributions.ts +152 -0
- package/src/plugins/rules/errors.ts +60 -0
- package/src/plugins/rules/ids.ts +42 -0
- package/src/plugins/rules/validation.ts +249 -0
- package/src/rules/listeners.ts +57 -0
- package/src/rules/origin.ts +13 -0
- package/src/rules/storeWrite.ts +37 -0
- package/src/rules/types.ts +136 -0
- package/src/seams/index.ts +79 -0
- package/src/seams/rules/clock.ts +28 -0
- package/src/seams/rules/formatters.ts +209 -0
- package/src/seams/rules/ids.ts +102 -0
- package/src/seams/rules/links.ts +66 -0
- package/src/seams/rules/navigation.ts +222 -0
- package/src/seams/rules/notify.ts +49 -0
- package/src/seams/rules/persistenceDrawer.ts +220 -0
- package/src/seams/rules/saveFile.ts +101 -0
- package/src/seams/rules/seams.ts +156 -0
- package/src/seams/rules/storage.ts +116 -0
- package/src/search/contracts/overlay.ts +74 -0
- package/src/search/contracts/search.ts +197 -0
- package/src/search/handlers/pois.ts +57 -0
- package/src/search/handlers/search.ts +280 -0
- package/src/search/rules/params.ts +925 -0
- package/src/search/rules/poiGroups.ts +138 -0
- package/src/search/rules/searchFetch.ts +139 -0
- package/src/search/rules/timeWindow.ts +30 -0
- package/src/search/stores/search.ts +51 -0
- package/src/segments/contracts/itinerary.ts +433 -0
- package/src/segments/contracts/segment.ts +35 -0
- package/src/segments/engines/segmentDraft.ts +926 -0
- package/src/segments/handlers/chainGuards.ts +67 -0
- package/src/segments/handlers/directions.ts +44 -0
- package/src/segments/handlers/itineraryEcho.ts +45 -0
- package/src/segments/handlers/roadAccessDialog.ts +34 -0
- package/src/segments/handlers/segment.ts +111 -0
- package/src/segments/handlers/segmentEdit.ts +1341 -0
- package/src/segments/handlers/segmentGroups.ts +347 -0
- package/src/segments/handlers/segmentStructure.ts +1144 -0
- package/src/segments/rules/chain.ts +196 -0
- package/src/segments/rules/chainModel.ts +217 -0
- package/src/segments/rules/colors.ts +11 -0
- package/src/segments/rules/commit.ts +76 -0
- package/src/segments/rules/draft.ts +90 -0
- package/src/segments/rules/draftDisposition.ts +43 -0
- package/src/segments/rules/draftSegmentEdit.ts +129 -0
- package/src/segments/rules/engine.ts +222 -0
- package/src/segments/rules/groupSave.ts +234 -0
- package/src/segments/rules/hazardPrompt.ts +60 -0
- package/src/segments/rules/itineraryEcho.ts +40 -0
- package/src/segments/rules/liveSegmentProjection.ts +55 -0
- package/src/segments/rules/merge.ts +51 -0
- package/src/segments/rules/metrics.ts +456 -0
- package/src/segments/rules/naming.ts +168 -0
- package/src/segments/rules/segmentArming.ts +144 -0
- package/src/segments/rules/splitPick.ts +84 -0
- package/src/segments/rules/viaSimplify.ts +230 -0
- package/src/segments/stores/directions.ts +77 -0
- package/src/segments/stores/roadAccessDialog.ts +58 -0
- package/src/segments/stores/segmentEdit.ts +922 -0
- package/src/segments/stores/segmentGroupEdit.ts +84 -0
- package/src/segments/stores/segmentSplit.ts +77 -0
- package/src/share/contracts/share.ts +39 -0
- package/src/share/contracts/shareLink.ts +63 -0
- package/src/share/engines/shareLink.ts +1053 -0
- package/src/share/handlers/share.ts +47 -0
- package/src/share/handlers/shareLink.ts +231 -0
- package/src/share/handlers/shareScope.ts +54 -0
- package/src/share/rules/link.ts +89 -0
- package/src/share/rules/shareLink.ts +218 -0
- package/src/share/rules/targets.ts +92 -0
- package/src/share/rules/viewConfig.ts +95 -0
- package/src/share/stores/share.ts +58 -0
- package/src/strings/fr/index.ts +18 -0
- package/src/strings/fr/rules/fr.ts +2368 -0
- package/src/strings/index.ts +98 -0
- package/src/strings/rules/confirmCopy.ts +156 -0
- package/src/strings/rules/draftToolNames.ts +94 -0
- package/src/strings/rules/en.ts +2519 -0
- package/src/strings/rules/failureAlert.ts +115 -0
- package/src/strings/rules/formError.ts +400 -0
- package/src/strings/rules/maneuvers.ts +107 -0
- package/src/strings/rules/outputOptions.ts +126 -0
- package/src/strings/rules/publicationState.ts +100 -0
- package/src/strings/rules/routeHazardCopy.ts +62 -0
- package/src/strings/rules/searchLabels.ts +50 -0
- package/src/strings/rules/segmentChainVerbs.ts +62 -0
- package/src/strings/rules/studioCopy.ts +130 -0
- package/src/strings/rules/unitOptions.ts +119 -0
- package/src/testing/checkedBus.ts +226 -0
- package/src/testing/index.ts +34 -0
- package/src/testing/plugins.ts +106 -0
- package/src/testing/studio.ts +267 -0
- package/src/testing/urlSeam.ts +153 -0
- package/src/time/index.ts +12 -0
- package/src/time/rules/sun.ts +78 -0
- package/src/video/contracts/cameraSchemas.ts +266 -0
- package/src/video/contracts/profileSchemas.ts +37 -0
- package/src/video/contracts/video.ts +601 -0
- package/src/video/handlers/video.ts +1638 -0
- package/src/video/handlers/videoDirector.ts +114 -0
- package/src/video/rules/previewRefresh.ts +76 -0
- package/src/video/rules/profileSource.ts +51 -0
- package/src/video/rules/routeSpans.ts +79 -0
- package/src/video/rules/shotDefaults.ts +28 -0
- package/src/video/rules/stepOrder.ts +17 -0
- package/src/video/rules/videoSnapshot.ts +136 -0
- package/src/video/stores/directorThreads.ts +167 -0
- package/src/video/stores/videoExport.ts +290 -0
- package/src/viewer/contracts/preferences.ts +40 -0
- package/src/viewer/handlers/preferences.ts +91 -0
- package/src/viewer/rules/capabilities.ts +42 -0
- package/src/viewer/rules/config.ts +266 -0
- package/src/viewer/rules/context.ts +375 -0
- package/src/viewer/rules/ownership.ts +134 -0
- package/src/viewer/rules/platformViewer.ts +198 -0
- package/src/viewer/rules/scope.ts +197 -0
- package/src/viewer/rules/url.ts +145 -0
- package/src/viewer/rules/viewer.ts +307 -0
- package/src/viewer/rules/viewerSeam.ts +49 -0
- package/src/viewer/rules/viewerUnits.ts +34 -0
- package/src/waypoints/contracts/itinerary.ts +417 -0
- package/src/waypoints/handlers/poiWaypointStyle.ts +32 -0
- package/src/waypoints/handlers/waypointDetailsDialog.ts +38 -0
- package/src/waypoints/handlers/waypointEdit.ts +1073 -0
- package/src/waypoints/rules/amenities.ts +30 -0
- package/src/waypoints/rules/defaults.ts +31 -0
- package/src/waypoints/rules/details.ts +213 -0
- package/src/waypoints/rules/detailsDraft.ts +312 -0
- package/src/waypoints/rules/detailsPreview.ts +76 -0
- package/src/waypoints/rules/detailsSave.ts +356 -0
- package/src/waypoints/rules/draftDirty.ts +45 -0
- package/src/waypoints/rules/icons.ts +32 -0
- package/src/waypoints/rules/liveWaypoint.ts +63 -0
- package/src/waypoints/rules/naming.ts +185 -0
- package/src/waypoints/rules/sections.ts +77 -0
- package/src/waypoints/rules/waypointDraft.ts +62 -0
- package/src/waypoints/stores/waypointDetails.ts +62 -0
- package/src/waypoints/stores/waypointEdit.ts +566 -0
- package/src/zones/contracts/collection.ts +37 -0
- package/src/zones/contracts/zone.ts +528 -0
- package/src/zones/engines/zoneForm.ts +1773 -0
- package/src/zones/handlers/restZones.ts +287 -0
- package/src/zones/handlers/zonePublish.ts +206 -0
- package/src/zones/handlers/zoneUnpublish.ts +56 -0
- package/src/zones/handlers/zones.ts +2254 -0
- package/src/zones/rules/geometry.ts +946 -0
- package/src/zones/rules/zoneDefaults.ts +34 -0
- package/src/zones/rules/zoneDraft.ts +54 -0
- package/src/zones/rules/zoneForm.ts +563 -0
- package/src/zones/rules/zoneMetadata.ts +29 -0
- package/src/zones/rules/zoneSource.ts +87 -0
- package/src/zones/rules/zoneSourceRefusal.ts +104 -0
- package/src/zones/stores/zoneEdit.ts +998 -0
|
@@ -0,0 +1,572 @@
|
|
|
1
|
+
import type { ItineraryWithDetails } from "@mountaya/client";
|
|
2
|
+
|
|
3
|
+
import type { StudioToolOutputs } from "../../bus/contracts/studioTools.js";
|
|
4
|
+
import type { ToolFailure, ToolResult } from "../../bus/rules/types.js";
|
|
5
|
+
import { resolveMutationSink } from "../../data/handlers/mutationSink.js";
|
|
6
|
+
import { evictResources, invalidateLanded } from "../../data/rules/cache.js";
|
|
7
|
+
import { settleLanded } from "../../edit/handlers/draftCommit.js";
|
|
8
|
+
import {
|
|
9
|
+
guardEditorTaken,
|
|
10
|
+
leaveDeletedItinerary,
|
|
11
|
+
teardownActiveEditSession,
|
|
12
|
+
} from "../../edit/handlers/editLock.js";
|
|
13
|
+
import type { StudioToolContext, StudioToolDefinition } from "../../viewer/rules/context.js";
|
|
14
|
+
import { withItineraryAnalysis } from "../rules/analysis.js";
|
|
15
|
+
import { showingDraft } from "../rules/draftSurface.js";
|
|
16
|
+
import { editorHolds } from "./itinerarySelection.js";
|
|
17
|
+
import { leaveForSurface, openItinerarySurface } from "./surfaceOpen.js";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* deletedItineraries names, per UI store, the itineraries `studio.itinerary.delete` removed and
|
|
21
|
+
* the ones a collaborator deleted.
|
|
22
|
+
*
|
|
23
|
+
* The cache seam drops an entry by marking it stale, and a cache that does so goes on answering
|
|
24
|
+
* the deleted record until a read replaces it. An activation that read it back would mirror an
|
|
25
|
+
* itinerary the server has deleted into the editor. So the delete writes the id here once the
|
|
26
|
+
* server has confirmed it, and the activation reads it before it reads the cache. An open reads
|
|
27
|
+
* it too, once its record has loaded: a read the server answered before the delete may arrive
|
|
28
|
+
* after it. Keyed weakly by the store, so a studio that is gone keeps nothing alive.
|
|
29
|
+
*/
|
|
30
|
+
const deletedItineraries = new WeakMap<object, Set<string>>();
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* recordItineraryDeleted writes an itinerary the server has deleted into the record an
|
|
34
|
+
* activation reads, so the id resolves to nothing whatever the cache still answers for it.
|
|
35
|
+
*
|
|
36
|
+
* `studio.itinerary.delete` calls it once its own request is confirmed, and the collaboration
|
|
37
|
+
* handler calls it for a delete a collaborator made.
|
|
38
|
+
*/
|
|
39
|
+
export const recordItineraryDeleted = (
|
|
40
|
+
ctx: Pick<StudioToolContext, "ui">,
|
|
41
|
+
itineraryId: string,
|
|
42
|
+
): void => {
|
|
43
|
+
const deleted = deletedItineraries.get(ctx.ui) ?? new Set<string>();
|
|
44
|
+
deleted.add(itineraryId);
|
|
45
|
+
deletedItineraries.set(ctx.ui, deleted);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* activateItinerary is the activation itself: what `studio.itinerary.activate` runs, and what
|
|
50
|
+
* `studio.itinerary.openForEdit` runs once its itinerary has loaded.
|
|
51
|
+
*
|
|
52
|
+
* One function, so the two cannot differ on which session a switch ends or which selection it
|
|
53
|
+
* keeps. It is called, never dispatched, by the open: the activation is part of that verb, and
|
|
54
|
+
* a context granted the open is not asked for the display capability that gates the bare
|
|
55
|
+
* activation.
|
|
56
|
+
*
|
|
57
|
+
* `loaded` is the record a caller already holds for `itineraryId`, and it stands in for the
|
|
58
|
+
* cache read. The open passes what it fetched: the cache seam promises no read of a write in
|
|
59
|
+
* the same turn, so an activation that read back what the open had just seeded would clear the
|
|
60
|
+
* slot over a host's cache that applies its writes later.
|
|
61
|
+
*/
|
|
62
|
+
const activateItinerary = (
|
|
63
|
+
ctx: StudioToolContext,
|
|
64
|
+
itineraryId: string | null,
|
|
65
|
+
loaded?: ItineraryWithDetails,
|
|
66
|
+
): ToolResult<StudioToolOutputs["studio.itinerary.activate"]> => {
|
|
67
|
+
// An itinerary this studio deleted is not loaded, whatever the cache still answers for it and
|
|
68
|
+
// whatever record the caller holds: it resolves to nothing, as any id the cache does not hold,
|
|
69
|
+
// and the sentence says why.
|
|
70
|
+
const deletedId =
|
|
71
|
+
itineraryId !== null && deletedItineraries.get(ctx.ui)?.has(itineraryId) ? itineraryId : null;
|
|
72
|
+
|
|
73
|
+
// A document loads exactly ONE surface of a given itinerary: the studio loads the
|
|
74
|
+
// draft, the embed preview loads the publication. Read the draft first (where both
|
|
75
|
+
// entries exist, as in the studio, whose video wizard also holds a publication, the
|
|
76
|
+
// editor's own version is the one to activate), then the publication, which is the
|
|
77
|
+
// only entry an embed preview ever populates. Neither read invents anything: at
|
|
78
|
+
// most one is filled for the surface asking, so this resolves "the itinerary this
|
|
79
|
+
// document loaded" rather than choosing between two live candidates.
|
|
80
|
+
//
|
|
81
|
+
// Normalized on the way OUT of the cache rather than trusted, because the cache holds
|
|
82
|
+
// whatever the writer put there: a surface's own read caches the WIRE record, where a
|
|
83
|
+
// segment's analysis arrays are null for both "not computed" and "not entitled", while a
|
|
84
|
+
// tool's write-through caches the normalized one. Two shapes for one resource is not
|
|
85
|
+
// something a reader of `activeItinerary` should have to know about, and the normalizer is
|
|
86
|
+
// idempotent, so applying it here makes the store's shape the same whoever filled the entry.
|
|
87
|
+
const cached =
|
|
88
|
+
itineraryId && deletedId === null
|
|
89
|
+
? (loaded ??
|
|
90
|
+
ctx.api?.cache.get({ id: itineraryId, kind: "itinerary" }) ??
|
|
91
|
+
ctx.api?.cache.get({
|
|
92
|
+
id: itineraryId,
|
|
93
|
+
kind: "itinerary",
|
|
94
|
+
surface: "published",
|
|
95
|
+
}) ??
|
|
96
|
+
null)
|
|
97
|
+
: null;
|
|
98
|
+
const itinerary = cached === null ? null : withItineraryAnalysis(cached);
|
|
99
|
+
|
|
100
|
+
// Tear down any in-flight authoring slot when the active itinerary is
|
|
101
|
+
// about to change (a switch to a different id, or a clear). Each slot is
|
|
102
|
+
// itinerary-scoped, so a leave or a switch ends it the same way Escape
|
|
103
|
+
// does, through the shared `teardownActiveEditSession`, the one
|
|
104
|
+
// navigate-away teardown both families route through: the segment edit's
|
|
105
|
+
// map engine is disposed and the base-map lock released, and the waypoint
|
|
106
|
+
// session's enrichment snapshot is restored (so a `poi-pick` that
|
|
107
|
+
// auto-enabled the POIs overlay turns it back off) before its map seam is
|
|
108
|
+
// released and the store slot cleared. A re-activate of the SAME id (the
|
|
109
|
+
// cache resolution fires the effect a second time after a hit) skips the
|
|
110
|
+
// teardown so an in-flight authoring action survives. An activate with no
|
|
111
|
+
// authoring in flight tears nothing down.
|
|
112
|
+
const state = ctx.ui.getState();
|
|
113
|
+
const currentId = state.activeItinerary?.id ?? null;
|
|
114
|
+
const resolvedId = itinerary?.id ?? null;
|
|
115
|
+
if (currentId !== resolvedId) {
|
|
116
|
+
teardownActiveEditSession(ctx);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Keep a selection that still resolves against the itinerary being activated; drop
|
|
120
|
+
// it otherwise. Clearing unconditionally would wipe a selection the user just made:
|
|
121
|
+
// the effect that dispatches activate re-fires whenever the itinerary query hands
|
|
122
|
+
// back a fresh object (a refetch, the cache resolving on a second pass), so a picked
|
|
123
|
+
// segment would snap back to "all segments" a few frames after the pick. Switching to
|
|
124
|
+
// a different itinerary still clears it, and so does a selection whose entity is gone
|
|
125
|
+
// (its segment was deleted out from under it), which would otherwise dangle.
|
|
126
|
+
//
|
|
127
|
+
// A selection in a staged draft that shows resolves against the draft, whichever itinerary
|
|
128
|
+
// stands behind its surface and whether one does: the draft is what the reader works on, and
|
|
129
|
+
// an activation behind it leaves the draft where it is.
|
|
130
|
+
const selection = state.selection;
|
|
131
|
+
const selectionSurvives =
|
|
132
|
+
selection !== null &&
|
|
133
|
+
editorHolds(showingDraft(state), itinerary, selection.kind, selection.id) === true;
|
|
134
|
+
|
|
135
|
+
ctx.ui.getState().setActiveItinerary(itinerary);
|
|
136
|
+
if (!selectionSurvives) {
|
|
137
|
+
ctx.ui.getState().select(null);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// The answer follows what was found, never what was asked: an id the cache does not hold
|
|
141
|
+
// clears the slot, and a run told the itinerary was activated would go on as if it were open.
|
|
142
|
+
// `activated` is the member a caller reads, and the sentence says why for a reader.
|
|
143
|
+
if (itinerary !== null) {
|
|
144
|
+
return {
|
|
145
|
+
data: { activated: true },
|
|
146
|
+
ok: true,
|
|
147
|
+
summary: `Activated itinerary ${itinerary.id}.`,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (deletedId !== null) {
|
|
152
|
+
return {
|
|
153
|
+
data: { activated: false },
|
|
154
|
+
ok: true,
|
|
155
|
+
summary: `Cleared the active itinerary: itinerary ${deletedId} was deleted.`,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
data: { activated: false },
|
|
161
|
+
ok: true,
|
|
162
|
+
summary: itineraryId
|
|
163
|
+
? `Cleared the active itinerary: itinerary ${itineraryId} is not loaded.`
|
|
164
|
+
: "Cleared the active itinerary.",
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* LatestOpen is what was asked last of one editor: the itinerary, the mark that tells this
|
|
170
|
+
* asking from every other, and whether it was an activation that overtook an open.
|
|
171
|
+
*/
|
|
172
|
+
interface LatestOpen {
|
|
173
|
+
byActivation: boolean;
|
|
174
|
+
itineraryId: string;
|
|
175
|
+
mark: symbol;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* latestOpens names, per UI store, what was asked last: a `studio.itinerary.openForEdit`, or a
|
|
180
|
+
* `studio.itinerary.activate` of another itinerary that overtook one.
|
|
181
|
+
*
|
|
182
|
+
* An open is a fetch, and two can be out at once. The mark is what lets the one that answers
|
|
183
|
+
* late see that another was asked after it, or that the reader activated another itinerary
|
|
184
|
+
* while it loaded. Keyed weakly by the store, so a studio that is gone keeps nothing alive.
|
|
185
|
+
*/
|
|
186
|
+
const latestOpens = new WeakMap<object, LatestOpen>();
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* activate is the editor's activation seam, the one place that mirrors the server-state itinerary
|
|
190
|
+
* into the UI store's active slot.
|
|
191
|
+
*
|
|
192
|
+
* It keeps a segment or waypoint selection that still names an entity of the activated itinerary
|
|
193
|
+
* or of a staged draft, and clears any other. An id the cache does not hold clears the slot: the
|
|
194
|
+
* answer's `activated` is false, and the summary says the itinerary is not loaded. The URL-driven
|
|
195
|
+
* mount path dispatches it as the itinerary query resolves, and openForEdit runs the same
|
|
196
|
+
* activation ({@link activateItinerary}) after fetching, so a search-result click and a route
|
|
197
|
+
* load follow one seam, and even the lifecycle mirror routes through the bus rather than through
|
|
198
|
+
* a direct getState write.
|
|
199
|
+
*
|
|
200
|
+
* The handler reads the loaded value through the cache seam (`ctx.api.cache`), so the input
|
|
201
|
+
* stays a small primitive and the host's cache is the single source of truth for the itinerary's
|
|
202
|
+
* shape. The lookup therefore has to know which SURFACE the calling document loaded (an embed
|
|
203
|
+
* preview holds the publication where the editor holds the draft), which
|
|
204
|
+
* {@link activateItinerary} spells out.
|
|
205
|
+
*/
|
|
206
|
+
export const activate: StudioToolDefinition<"studio.itinerary.activate"> = {
|
|
207
|
+
handler: (ctx, input) => {
|
|
208
|
+
const pending = latestOpens.get(ctx.ui);
|
|
209
|
+
const activeBefore = ctx.ui.getState().activeItinerary?.id ?? null;
|
|
210
|
+
const result = activateItinerary(ctx, input.itineraryId);
|
|
211
|
+
|
|
212
|
+
// The reader going to another itinerary overtakes an open that is still loading, as a newer
|
|
213
|
+
// open does. An activation of the itinerary that is open (a refetch fires the route's
|
|
214
|
+
// effect again) or of the one being opened (a url that moved before the open answered) is
|
|
215
|
+
// no such departure. Neither is one that put no itinerary in the editor, an id the cache
|
|
216
|
+
// does not hold or one this studio deleted: it cleared the slot, and a clear is a leave,
|
|
217
|
+
// which the open's own gates read. So the mark is written once the slot holds the itinerary.
|
|
218
|
+
if (
|
|
219
|
+
pending !== undefined &&
|
|
220
|
+
input.itineraryId !== null &&
|
|
221
|
+
input.itineraryId !== activeBefore &&
|
|
222
|
+
input.itineraryId !== pending.itineraryId &&
|
|
223
|
+
ctx.ui.getState().activeItinerary?.id === input.itineraryId
|
|
224
|
+
) {
|
|
225
|
+
latestOpens.set(ctx.ui, {
|
|
226
|
+
byActivation: true,
|
|
227
|
+
itineraryId: input.itineraryId,
|
|
228
|
+
mark: Symbol("activation"),
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return result;
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* openForEdit loads an itinerary by id, then runs the activation studio.itinerary.activate runs
|
|
238
|
+
* to mirror it into the UI store, and frames it on the map. It is the activation path the
|
|
239
|
+
* search-result tab dispatches when a user picks an itinerary row, so the same path serves a
|
|
240
|
+
* human click and an agent-issued open. It needs the api seam to fetch the full itinerary, and
|
|
241
|
+
* the bus seam to chain into studio.map.fitBoundsToSegment; absent either, it returns a
|
|
242
|
+
* structured failure. It is view-level: the editing itself is gated elsewhere.
|
|
243
|
+
*
|
|
244
|
+
* Only the open asked last lands. An open that another was asked after writes nothing and
|
|
245
|
+
* frames nothing, whichever fetch answers first, and says so: it answers `ok` with
|
|
246
|
+
* `data.opened` false, since nothing failed. So does an open the reader overtook by activating
|
|
247
|
+
* another itinerary through `studio.itinerary.activate` while it loaded: the editor stays on
|
|
248
|
+
* that itinerary, and an activation that put no itinerary in the editor overtakes nothing. A
|
|
249
|
+
* reader who went to another itinerary and came back to the one being opened overtook nothing
|
|
250
|
+
* either: the open lands and answers `data.opened` true. An open of an itinerary
|
|
251
|
+
* `studio.itinerary.delete` removed in this studio, whose record a read the server answered
|
|
252
|
+
* before the delete may still carry, writes nothing and answers `data.opened` false too, and
|
|
253
|
+
* the summary says it was deleted.
|
|
254
|
+
*
|
|
255
|
+
* Any other itinerary than the one open is refused with `edit-in-progress` while the editor is
|
|
256
|
+
* taken ({@link guardEditorTaken}): an armed edit of a segment, a waypoint or a zone, a split
|
|
257
|
+
* pick, or a create whose request is out, whether an itinerary is open or not. The gate is asked
|
|
258
|
+
* again once the itinerary has loaded, so an edit armed while it was loading is not torn down by
|
|
259
|
+
* it.
|
|
260
|
+
*/
|
|
261
|
+
export const openForEdit: StudioToolDefinition<"studio.itinerary.openForEdit"> = {
|
|
262
|
+
handler: async (ctx, input) => {
|
|
263
|
+
if (!ctx.api) {
|
|
264
|
+
return { code: "no-api", error: "open itinerary: no persistence seam", ok: false };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (!ctx.bus) {
|
|
268
|
+
return { code: "internal", error: "open itinerary: no tool bus available", ok: false };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// One edit at a time: the activation below tears down whatever is armed whenever the id
|
|
272
|
+
// changes, with no itinerary open before it as well (a zone created from the list, an edit
|
|
273
|
+
// of an import draft with nothing behind it). So any other itinerary is refused with the
|
|
274
|
+
// shared failure while the editor is taken, and the human map-click path surfaces the same
|
|
275
|
+
// banner the begin and select gates do. Opening the itinerary that is open again is allowed:
|
|
276
|
+
// its activation keeps the open session.
|
|
277
|
+
const refusedByEdit = (): ToolFailure | null =>
|
|
278
|
+
ctx.ui.getState().activeItinerary?.id === input.itineraryId
|
|
279
|
+
? null
|
|
280
|
+
: guardEditorTaken(ctx.ui.getState());
|
|
281
|
+
|
|
282
|
+
const refused = refusedByEdit();
|
|
283
|
+
if (refused) {
|
|
284
|
+
return refused;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const open = Symbol("open");
|
|
288
|
+
latestOpens.set(ctx.ui, { byActivation: false, itineraryId: input.itineraryId, mark: open });
|
|
289
|
+
|
|
290
|
+
const full = await ctx.api.persistence.fetchItineraryRecord(input.itineraryId);
|
|
291
|
+
|
|
292
|
+
// Another open was asked while this one loaded, or the reader activated another itinerary.
|
|
293
|
+
// They are on their way to that itinerary, so this one writes nothing: not the cache's
|
|
294
|
+
// active entry, not the slot, not the camera. An activation of the itinerary this open
|
|
295
|
+
// loads is the reader coming back to it after they went elsewhere: nothing overtook the
|
|
296
|
+
// open then, and it lands.
|
|
297
|
+
const latest = latestOpens.get(ctx.ui);
|
|
298
|
+
const cameBack = latest?.byActivation === true && latest.itineraryId === input.itineraryId;
|
|
299
|
+
if (latest?.mark !== open && !cameBack) {
|
|
300
|
+
return {
|
|
301
|
+
data: { opened: false },
|
|
302
|
+
ok: true,
|
|
303
|
+
summary: latest?.byActivation
|
|
304
|
+
? `Left the editor on the itinerary activated since: itinerary ${input.itineraryId} was not opened.`
|
|
305
|
+
: `Left the editor to a newer open: itinerary ${input.itineraryId} was not opened.`,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// The itinerary was deleted by this studio, before the open or while its record loaded, and
|
|
310
|
+
// the read answers what the server held before the delete. There is nothing to open, so
|
|
311
|
+
// this one writes nothing either: the entry the delete dropped stays dropped.
|
|
312
|
+
if (deletedItineraries.get(ctx.ui)?.has(input.itineraryId)) {
|
|
313
|
+
return {
|
|
314
|
+
data: { opened: false },
|
|
315
|
+
ok: true,
|
|
316
|
+
summary: `Left the editor as it is: itinerary ${input.itineraryId} was deleted and was not opened.`,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// Asked again, now that the load is done: an edit armed on the open itinerary while this
|
|
321
|
+
// one loaded would be torn down by the activation below.
|
|
322
|
+
const refusedSince = refusedByEdit();
|
|
323
|
+
if (refusedSince) {
|
|
324
|
+
return refusedSince;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Seed the itinerary detail cache so the activation the route effect dispatches after
|
|
328
|
+
// navigation reads the loaded value through the cache the activate handler reads, instead
|
|
329
|
+
// of racing the fetching query and clobbering the active slot until the cache resolves.
|
|
330
|
+
ctx.api.cache.set({ id: input.itineraryId, kind: "itinerary" }, full);
|
|
331
|
+
|
|
332
|
+
// The activation `studio.itinerary.activate` runs, the one seam that mirrors an itinerary
|
|
333
|
+
// into the store: it ends a session armed on the itinerary being left and clears a
|
|
334
|
+
// selection that names nothing in the one being opened, which a bare write of the slot
|
|
335
|
+
// would skip. It is handed the record in hand, so it does not depend on the seed above
|
|
336
|
+
// being readable yet.
|
|
337
|
+
activateItinerary(ctx, input.itineraryId, full);
|
|
338
|
+
|
|
339
|
+
await ctx.bus.dispatch(ctx, "studio.map.fitBoundsToSegment", { segmentId: null });
|
|
340
|
+
|
|
341
|
+
return {
|
|
342
|
+
data: { opened: true },
|
|
343
|
+
ok: true,
|
|
344
|
+
summary: `Opened itinerary ${input.itineraryId} for edit.`,
|
|
345
|
+
};
|
|
346
|
+
},
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* setEmphasis dims the itinerary geometries on the map to focus one (or none). `dimAll` dims
|
|
351
|
+
* every itinerary (the cursor is over the list but no row); `itinerary`/`segment` keep the
|
|
352
|
+
* matching id at full opacity and dim the rest; `segments` does the same for a whole set of
|
|
353
|
+
* segment ids at once, which is how a row standing for several chain entries (a collapsed group)
|
|
354
|
+
* focuses all of them; `none` restores full opacity.
|
|
355
|
+
*
|
|
356
|
+
* It is imperative on the map client, since a hover is transient, high-frequency state and not
|
|
357
|
+
* store state, and a no-op when no map is mounted (the agent still receives a structured
|
|
358
|
+
* outcome). View-level. ctx is the first positional parameter.
|
|
359
|
+
*/
|
|
360
|
+
export const setEmphasis: StudioToolDefinition<"studio.itinerary.emphasis.set"> = {
|
|
361
|
+
handler: (ctx, input) => {
|
|
362
|
+
ctx.map?.setItineraryEmphasis(input);
|
|
363
|
+
|
|
364
|
+
return { ok: true, summary: `Set itinerary emphasis to ${input.mode}.` };
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* setExclusions suppresses the listed segments and waypoints from the itinerary tile render, so
|
|
370
|
+
* a feature drawn as an editable element elsewhere is not also painted by the tiles. Empty lists
|
|
371
|
+
* draw the full itinerary. The parsed input IS the map's ItineraryExclusions shape, so the
|
|
372
|
+
* handler forwards it unchanged.
|
|
373
|
+
*
|
|
374
|
+
* It is imperative on the map client (render state, not store state) and a no-op when no map is
|
|
375
|
+
* mounted (the agent still receives a structured outcome). ctx is the first positional
|
|
376
|
+
* parameter.
|
|
377
|
+
*/
|
|
378
|
+
export const setExclusions: StudioToolDefinition<"studio.itinerary.exclusions.set"> = {
|
|
379
|
+
handler: (ctx, input) => {
|
|
380
|
+
ctx.map?.setItineraryExclusions(input);
|
|
381
|
+
|
|
382
|
+
return { ok: true, summary: "Set itinerary tile exclusions." };
|
|
383
|
+
},
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* renameItinerary persists a new display name for one itinerary, then evicts every itinerary
|
|
388
|
+
* listing so the sidenav reads the renamed entry again. When the renamed itinerary is the one open
|
|
389
|
+
* in the editor it also patches the active slot's name in the store, so the open editor updates
|
|
390
|
+
* at once without waiting for the refetch. It persists, so it needs the api seam: absent (a
|
|
391
|
+
* render-free context), it returns a failure rather than silently dropping the write.
|
|
392
|
+
*/
|
|
393
|
+
export const renameItinerary: StudioToolDefinition<"studio.itinerary.rename"> = {
|
|
394
|
+
handler: (ctx, input) =>
|
|
395
|
+
resolveMutationSink(ctx).renameItinerary(ctx, {
|
|
396
|
+
itineraryId: input.itineraryId,
|
|
397
|
+
name: input.name,
|
|
398
|
+
}),
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* updateItinerary persists a privacy change for one itinerary. The update is a patch, where
|
|
403
|
+
* an omitted field keeps its value, so the request carries `is_private` alone: the itinerary
|
|
404
|
+
* need not be loaded, and the name another writer gave it since this session read it is left
|
|
405
|
+
* as it is.
|
|
406
|
+
*
|
|
407
|
+
* On success it writes the refreshed itinerary the server returns into the active slot (when it
|
|
408
|
+
* is the open one) and the detail cache, then evicts every itinerary listing so the sidenav
|
|
409
|
+
* reads the entry again. It mirrors the rename's write-back, but writes the WHOLE refreshed
|
|
410
|
+
* itinerary (not just the name) so the privacy flag the panel reflects updates in place. It
|
|
411
|
+
* persists, so it needs the api seam.
|
|
412
|
+
*/
|
|
413
|
+
export const updateItinerary: StudioToolDefinition<"studio.itinerary.update"> = {
|
|
414
|
+
handler: async (ctx, input) => {
|
|
415
|
+
if (!ctx.api) {
|
|
416
|
+
return { code: "no-api", error: "update itinerary: no persistence seam", ok: false };
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
const updated = await ctx.api.persistence.updateItinerary(input.itineraryId, {
|
|
420
|
+
is_private: input.isPrivate,
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
// Write the refreshed itinerary the server returned into the open editor (when it is this
|
|
424
|
+
// itinerary) and the detail cache, so the privacy flag the panel reads updates in place
|
|
425
|
+
// without waiting for a refetch.
|
|
426
|
+
if (ctx.ui.getState().activeItinerary?.id === input.itineraryId) {
|
|
427
|
+
ctx.ui.getState().setActiveItinerary(updated);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// The update has landed: a cache that fails here fails nothing of it.
|
|
431
|
+
const api = ctx.api;
|
|
432
|
+
settleLanded(() => api.cache.set({ id: input.itineraryId, kind: "itinerary" }, updated));
|
|
433
|
+
|
|
434
|
+
await invalidateLanded(ctx.api.cache, { kind: "itineraries" });
|
|
435
|
+
|
|
436
|
+
return {
|
|
437
|
+
ok: true,
|
|
438
|
+
summary: `Set itinerary ${input.itineraryId} to ${input.isPrivate ? "private" : "public"}.`,
|
|
439
|
+
};
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* deleteWithoutApi is the refusal `studio.itinerary.delete` answers a context with no persistence
|
|
445
|
+
* seam, ahead of its confirmation and in its handler.
|
|
446
|
+
*/
|
|
447
|
+
const deleteWithoutApi: ToolFailure = {
|
|
448
|
+
code: "no-api",
|
|
449
|
+
error: "delete itinerary: no persistence seam",
|
|
450
|
+
ok: false,
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* deleteItinerary removes one itinerary for good. It is destructive, so it sets
|
|
455
|
+
* requiresConfirmation and attaches an acknowledge prompt: the confirm surface demands the user
|
|
456
|
+
* tick "I understand…" before enabling Confirm, which raises the bar above the plain
|
|
457
|
+
* segment/waypoint removals. After the delete it evicts every itinerary listing so the sidenav
|
|
458
|
+
* drops the entry, and busts the itinerary tile source so the map drops the deleted route at
|
|
459
|
+
* once. It persists, so it needs the api seam: absent, it refuses with `no-api` before the
|
|
460
|
+
* confirmation.
|
|
461
|
+
*
|
|
462
|
+
* When the deleted itinerary is the one open, the handler closes what the studio holds of it
|
|
463
|
+
* before it sends the request, never after it: its slot, the URL key of its detail, and an edit
|
|
464
|
+
* or a selection on one of its segments or waypoints. A surface the reader opened over it, a
|
|
465
|
+
* zone with its reshape or a create, an import or a suggestion with its draft, is theirs and
|
|
466
|
+
* stays, and lands on the list when it closes. The request and the eviction are round trips,
|
|
467
|
+
* and whatever the reader opens during them is theirs: a leave that waited would close that
|
|
468
|
+
* instead. A refused delete therefore answers its failure with the itinerary closed and still
|
|
469
|
+
* in the list.
|
|
470
|
+
*
|
|
471
|
+
* Once the server has confirmed the delete, the itinerary is gone for this studio: its detail
|
|
472
|
+
* entries are removed from a cache that evicts and marked stale in one that does not, with the
|
|
473
|
+
* listing; `studio.itinerary.activate` of its id clears the slot and says it was deleted; and an
|
|
474
|
+
* editor the reader opened on it again while the request was out is closed the same way.
|
|
475
|
+
*/
|
|
476
|
+
export const deleteItinerary: StudioToolDefinition<"studio.itinerary.delete"> = {
|
|
477
|
+
confirmation: {
|
|
478
|
+
acknowledgeLabel: "confirm.deleteItineraryAcknowledge",
|
|
479
|
+
confirmLabel: "confirm.delete",
|
|
480
|
+
descriptionLabel: "confirm.deleteItinerary.body",
|
|
481
|
+
titleLabel: "confirm.deleteItinerary.title",
|
|
482
|
+
},
|
|
483
|
+
handler: async (ctx, input) => {
|
|
484
|
+
if (!ctx.api) {
|
|
485
|
+
return deleteWithoutApi;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Deleting the open itinerary closes its detail, which has nothing left to show, and
|
|
489
|
+
// deleting another one leaves the current view as it is. A surface opened over the
|
|
490
|
+
// itinerary is not asked about here, so it is not closed here either.
|
|
491
|
+
// Read and acted on here, before the first await: nothing is read now and acted on later,
|
|
492
|
+
// so nothing the reader opens while the request is out is closed by it.
|
|
493
|
+
if (ctx.ui.getState().activeItinerary?.id === input.itineraryId) {
|
|
494
|
+
leaveDeletedItinerary(ctx, input.itineraryId);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
await ctx.api.persistence.deleteItinerary(input.itineraryId);
|
|
498
|
+
|
|
499
|
+
// The server has confirmed the delete: from here an activation of this id finds nothing,
|
|
500
|
+
// whatever the cache still answers for it.
|
|
501
|
+
recordItineraryDeleted(ctx, input.itineraryId);
|
|
502
|
+
|
|
503
|
+
// The reader opened it again while the request was out, when it still existed. Asked here,
|
|
504
|
+
// of this id alone: another itinerary opened meanwhile is theirs and stays. The leave reaches
|
|
505
|
+
// the host's url seam, and the delete has landed, so a seam that fails here fails nothing.
|
|
506
|
+
if (ctx.ui.getState().activeItinerary?.id === input.itineraryId) {
|
|
507
|
+
settleLanded(() => leaveDeletedItinerary(ctx, input.itineraryId));
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// Bust the combined itinerary tile source so the deleted route disappears at the current
|
|
511
|
+
// camera without a pan or a zoom: the row is gone server-side, so the refetched tiles no
|
|
512
|
+
// longer carry it. The delete has landed, so a map that fails here fails nothing, and the
|
|
513
|
+
// evictions below still run.
|
|
514
|
+
settleLanded(() => ctx.map?.refreshItineraryTiles());
|
|
515
|
+
|
|
516
|
+
// The itinerary's own entries are removed where the cache evicts, so no later read answers
|
|
517
|
+
// a record the server has deleted. A cache that states no `evict` keeps them marked stale
|
|
518
|
+
// below, and the record of deleted ids above answers for it.
|
|
519
|
+
evictResources(
|
|
520
|
+
ctx.api.cache,
|
|
521
|
+
{ id: input.itineraryId, kind: "itinerary" },
|
|
522
|
+
{ id: input.itineraryId, kind: "itinerary", surface: "published" },
|
|
523
|
+
);
|
|
524
|
+
|
|
525
|
+
// Every itinerary listing, every collection listing and every collection's contents, since
|
|
526
|
+
// the collections that held it count one fewer, and with them both detail entries of the
|
|
527
|
+
// itinerary, the draft's and the publication's: neither names anything the server still
|
|
528
|
+
// holds. The delete has landed, so a cache that fails here fails nothing.
|
|
529
|
+
await invalidateLanded(
|
|
530
|
+
ctx.api.cache,
|
|
531
|
+
{ kind: "itineraries" },
|
|
532
|
+
{ kind: "collections" },
|
|
533
|
+
{ kind: "collectionItineraries" },
|
|
534
|
+
{ id: input.itineraryId, kind: "itinerary" },
|
|
535
|
+
{ id: input.itineraryId, kind: "itinerary", surface: "published" },
|
|
536
|
+
);
|
|
537
|
+
|
|
538
|
+
return { ok: true, summary: `Deleted itinerary ${input.itineraryId}.` };
|
|
539
|
+
},
|
|
540
|
+
// A context with no persistence seam has nowhere to send the delete, which is known before the
|
|
541
|
+
// reader is asked to confirm it.
|
|
542
|
+
precondition: (ctx) => (ctx.api ? null : deleteWithoutApi),
|
|
543
|
+
requiresConfirmation: true,
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* createOpen opens the studio's create-itinerary sidenav surface, the entry point
|
|
548
|
+
* for authoring a new itinerary from scratch. It sets the openContent slot to
|
|
549
|
+
* `"create"` (the setter clears any other content) and mirrors the surface into
|
|
550
|
+
* the URL seam's `creating` key so a reload reopens it; with no URL seam the store
|
|
551
|
+
* flag alone drives the layout.
|
|
552
|
+
*
|
|
553
|
+
* The open itinerary's slot and its `itinerary_id` stand behind the surface, as the import and
|
|
554
|
+
* suggest opens leave them. What the slot was showing is left through {@link leaveForSurface}:
|
|
555
|
+
* an import or a suggestion that shows ends with its session, and a staged draft or an armed edit
|
|
556
|
+
* (a zone's create or reshape, or an edit of the itinerary behind) is asked about first. A
|
|
557
|
+
* decline answers `confirmation-denied` and opens nothing, and a draft whose commit is out
|
|
558
|
+
* answers `conflict`.
|
|
559
|
+
*/
|
|
560
|
+
export const createOpen: StudioToolDefinition<"studio.itinerary.createOpen"> = {
|
|
561
|
+
handler: async (ctx, input) => {
|
|
562
|
+
const kept = await leaveForSurface(ctx, "studio.itinerary.createOpen", "create", input);
|
|
563
|
+
if (kept) {
|
|
564
|
+
return kept;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
openItinerarySurface(ctx, "create");
|
|
568
|
+
ctx.url?.write({ creating: true });
|
|
569
|
+
|
|
570
|
+
return { ok: true, summary: "Opened the create-itinerary surface." };
|
|
571
|
+
},
|
|
572
|
+
};
|