@mountaya/studio 0.0.0-stage → 0.2.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 +69 -0
- package/LICENCE.fr.txt +280 -0
- package/LICENSE.txt +262 -0
- package/README.md +917 -2
- package/dist/agent/index.cjs +2600 -0
- package/dist/agent/index.cjs.map +1 -0
- package/dist/agent/index.d.cts +1237 -0
- package/dist/agent/index.d.ts +1237 -0
- package/dist/agent/index.js +2581 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/chunk-3Oi_Zrtm.js +9 -0
- package/dist/chunk-3Oi_Zrtm.js.map +1 -0
- package/dist/chunk-B18OPIu_.js +6 -0
- package/dist/chunk-B18OPIu_.js.map +1 -0
- package/dist/chunk-B5Uz3Qct.cjs +15 -0
- package/dist/chunk-B5Uz3Qct.cjs.map +1 -0
- package/dist/chunk-BBEJwkd3.d.cts +839 -0
- package/dist/chunk-BIEc_SkR.cjs +29 -0
- package/dist/chunk-BIEc_SkR.cjs.map +1 -0
- package/dist/chunk-BKMFOe-N.js +171 -0
- package/dist/chunk-BKMFOe-N.js.map +1 -0
- package/dist/chunk-BP4uy7E1.d.ts +11583 -0
- package/dist/chunk-BSHTsFiB.js +1403 -0
- package/dist/chunk-BSHTsFiB.js.map +1 -0
- package/dist/chunk-BTUUABGI.js +17 -0
- package/dist/chunk-BTUUABGI.js.map +1 -0
- package/dist/chunk-BaPiaz5X.cjs +115 -0
- package/dist/chunk-BaPiaz5X.cjs.map +1 -0
- package/dist/chunk-BeCVpkYr.cjs +542 -0
- package/dist/chunk-BeCVpkYr.cjs.map +1 -0
- package/dist/chunk-BgngsvK8.cjs +6202 -0
- package/dist/chunk-BgngsvK8.cjs.map +1 -0
- package/dist/chunk-BhInd7CJ.d.cts +253 -0
- package/dist/chunk-Bn6ZbxkS.cjs +27 -0
- package/dist/chunk-By9ZnkVI.js +60 -0
- package/dist/chunk-By9ZnkVI.js.map +1 -0
- package/dist/chunk-BzqPhxsz.cjs +367 -0
- package/dist/chunk-BzqPhxsz.cjs.map +1 -0
- package/dist/chunk-C2mMX81q.d.ts +443 -0
- package/dist/chunk-C2rr9Q0V.cjs +1402 -0
- package/dist/chunk-C2rr9Q0V.cjs.map +1 -0
- package/dist/chunk-CDJCbwIQ.d.cts +78 -0
- package/dist/chunk-CLGvBOVH.d.cts +1654 -0
- package/dist/chunk-COdw1dc6.d.ts +525 -0
- package/dist/chunk-CQCJnT2i.d.ts +511 -0
- package/dist/chunk-CSyHY67q.cjs +353 -0
- package/dist/chunk-CSyHY67q.cjs.map +1 -0
- package/dist/chunk-CiK1Iqrv.js +950 -0
- package/dist/chunk-CiK1Iqrv.js.map +1 -0
- package/dist/chunk-CmJBgSwZ.cjs +24 -0
- package/dist/chunk-CmJBgSwZ.cjs.map +1 -0
- package/dist/chunk-CnrsRK2u.cjs +83 -0
- package/dist/chunk-CnrsRK2u.cjs.map +1 -0
- package/dist/chunk-Co782_9r.js +326 -0
- package/dist/chunk-Co782_9r.js.map +1 -0
- package/dist/chunk-Csr3KDpZ.cjs +32 -0
- package/dist/chunk-Csr3KDpZ.cjs.map +1 -0
- package/dist/chunk-CwkmccXv.js +89 -0
- package/dist/chunk-CwkmccXv.js.map +1 -0
- package/dist/chunk-D0Q4iL9B.cjs +255 -0
- package/dist/chunk-D0Q4iL9B.cjs.map +1 -0
- package/dist/chunk-DFwiSzUS.cjs +72 -0
- package/dist/chunk-DFwiSzUS.cjs.map +1 -0
- package/dist/chunk-DIFayl2P.d.cts +443 -0
- package/dist/chunk-DIGF58ux.d.cts +525 -0
- package/dist/chunk-DKuuuld5.js +101 -0
- package/dist/chunk-DKuuuld5.js.map +1 -0
- package/dist/chunk-DMePkFEo.js +5054 -0
- package/dist/chunk-DMePkFEo.js.map +1 -0
- package/dist/chunk-DO5SIBgu.js +305 -0
- package/dist/chunk-DO5SIBgu.js.map +1 -0
- package/dist/chunk-DOQ_7eE5.d.ts +6662 -0
- package/dist/chunk-DThaaNeb.d.cts +15 -0
- package/dist/chunk-DThaaNeb.d.ts +15 -0
- package/dist/chunk-DUQzjUJy.d.ts +78 -0
- package/dist/chunk-DX37IPhV.cjs +1903 -0
- package/dist/chunk-DX37IPhV.cjs.map +1 -0
- package/dist/chunk-Damps5Tk.cjs +155 -0
- package/dist/chunk-Damps5Tk.cjs.map +1 -0
- package/dist/chunk-DbK5PhpJ.d.ts +1654 -0
- package/dist/chunk-De0vAASv.d.ts +253 -0
- package/dist/chunk-DhSZ7YZt.d.cts +6662 -0
- package/dist/chunk-DjEvqvPA.cjs +43 -0
- package/dist/chunk-DjEvqvPA.cjs.map +1 -0
- package/dist/chunk-DkwDzwvu.d.cts +121 -0
- package/dist/chunk-DkwDzwvu.d.ts +121 -0
- package/dist/chunk-Dmszv9If.js +71 -0
- package/dist/chunk-Dmszv9If.js.map +1 -0
- package/dist/chunk-Dp_ftNWY.d.cts +511 -0
- package/dist/chunk-DsHQySz0.js +31 -0
- package/dist/chunk-DsHQySz0.js.map +1 -0
- package/dist/chunk-DwoUyHHh.js +281 -0
- package/dist/chunk-DwoUyHHh.js.map +1 -0
- package/dist/chunk-IaIDQflj.d.cts +2315 -0
- package/dist/chunk-IaIDQflj.d.ts +2315 -0
- package/dist/chunk-cVXLsZfL.d.ts +839 -0
- package/dist/chunk-mIaCX9EJ.d.cts +11583 -0
- package/dist/chunk-nJQxbOwQ.cjs +8962 -0
- package/dist/chunk-nJQxbOwQ.cjs.map +1 -0
- package/dist/chunk-o9jaxhCO.js +8852 -0
- package/dist/chunk-o9jaxhCO.js.map +1 -0
- package/dist/chunk-p-Tt_Lwz.js +14 -0
- package/dist/chunk-p-Tt_Lwz.js.map +1 -0
- package/dist/engines/index.cjs +2091 -0
- package/dist/engines/index.cjs.map +1 -0
- package/dist/engines/index.d.cts +2176 -0
- package/dist/engines/index.d.ts +2176 -0
- package/dist/engines/index.js +2075 -0
- package/dist/engines/index.js.map +1 -0
- package/dist/handlers/index.cjs +53 -0
- package/dist/handlers/index.cjs.map +1 -0
- package/dist/handlers/index.d.cts +403 -0
- package/dist/handlers/index.d.ts +403 -0
- package/dist/handlers/index.js +33 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/index.cjs +3511 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +3033 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/index.cjs +510 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.cts +296 -0
- package/dist/plugins/index.d.ts +296 -0
- package/dist/plugins/index.js +489 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/seams/index.cjs +89 -0
- package/dist/seams/index.cjs.map +1 -0
- package/dist/seams/index.d.cts +452 -0
- package/dist/seams/index.d.ts +452 -0
- package/dist/seams/index.js +49 -0
- package/dist/seams/index.js.map +1 -0
- package/dist/strings/fr/index.cjs +2135 -0
- package/dist/strings/fr/index.cjs.map +1 -0
- package/dist/strings/fr/index.d.cts +17 -0
- package/dist/strings/fr/index.d.ts +17 -0
- package/dist/strings/fr/index.js +2130 -0
- package/dist/strings/fr/index.js.map +1 -0
- package/dist/strings/index.cjs +2384 -0
- package/dist/strings/index.cjs.map +1 -0
- package/dist/strings/index.d.cts +3 -0
- package/dist/strings/index.d.ts +3 -0
- package/dist/strings/index.js +2353 -0
- package/dist/strings/index.js.map +1 -0
- package/dist/testing/index.cjs +230 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +246 -0
- package/dist/testing/index.d.ts +246 -0
- package/dist/testing/index.js +219 -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 +41 -0
- package/dist/time/index.d.ts +41 -0
- package/dist/time/index.js +23 -0
- package/dist/time/index.js.map +1 -0
- package/package.json +224 -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 +29 -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 +451 -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 +857 -0
- package/src/bus/rules/confirmation.ts +22 -0
- package/src/bus/rules/defineRegistry.ts +24 -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 +804 -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 +575 -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 +89 -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 +215 -0
- package/src/embed/rules/snippet.ts +531 -0
- package/src/embed/rules/tableCode.ts +270 -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 +1065 -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 +1050 -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 +202 -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 +211 -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 +30 -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 +199 -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,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The camera, and what it is pointed at.
|
|
3
|
+
*
|
|
4
|
+
* One namespace per module, assembled in {@link studioToolContracts}. The split is not filing: a
|
|
5
|
+
* namespace is the unit a consumer adopts and the unit a reviewer reads, and a single table of
|
|
6
|
+
* every verb in the studio is neither.
|
|
7
|
+
*
|
|
8
|
+
* A `studio.map` verb another topic implements is stated in that topic's own contracts, in a
|
|
9
|
+
* module of this name.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import * as z from "zod";
|
|
13
|
+
|
|
14
|
+
import { POINT_ZOOM } from "@mountaya/elements/camera";
|
|
15
|
+
import { LONGITUDE_LIMIT } from "@mountaya/elements/geo";
|
|
16
|
+
import { DEGREES_PER_TURN } from "@mountaya/elements/units";
|
|
17
|
+
|
|
18
|
+
import { emptyInput, toolNoDataSchema } from "../../bus/contracts/shared.js";
|
|
19
|
+
import { CAMERA_PITCH_MAX, CAMERA_ZOOM_MAX } from "../../search/rules/params.js";
|
|
20
|
+
import { namedBoundingBoxSchema, namedLngLatSchema } from "../rules/coordinates.js";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* fitPaddingSchema is the breathing room a fit keeps between the framed bounds and the
|
|
24
|
+
* viewport edges: one number for all four sides, or a per-edge object.
|
|
25
|
+
*
|
|
26
|
+
* The per-edge form is what lets a surface reserve an inset for chrome it draws over the map
|
|
27
|
+
* (a docked elevation panel takes a larger bottom), so the route frames inside the space that
|
|
28
|
+
* is actually visible rather than behind a panel.
|
|
29
|
+
*
|
|
30
|
+
* Omitted, the fit keeps whatever framing the host chose as its default. How much room to
|
|
31
|
+
* leave is a HANDLER's judgement: it depends on what that host renders over the map, which is
|
|
32
|
+
* the one thing a published schema cannot know.
|
|
33
|
+
*/
|
|
34
|
+
const fitPaddingSchema = z.union([
|
|
35
|
+
z.number(),
|
|
36
|
+
z.object({ bottom: z.number(), left: z.number(), right: z.number(), top: z.number() }),
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* CAMERA_BEARING_MIN is the lowest bearing `studio.map.applyCamera` takes, in degrees: half a
|
|
41
|
+
* turn west of north.
|
|
42
|
+
*
|
|
43
|
+
* A renderer reports its bearing between minus and plus half a turn, which is what
|
|
44
|
+
* `studio.map.getView` answers, and an embed's captured view states one between zero and a
|
|
45
|
+
* whole turn. The verb takes both ranges, so a view read with one verb can be applied with the
|
|
46
|
+
* other, and its handler wraps what it is given into the second.
|
|
47
|
+
*/
|
|
48
|
+
const CAMERA_BEARING_MIN = -DEGREES_PER_TURN / 2;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* CAMERA_LATITUDE_LIMIT is how far from the equator a camera's center may sit, in degrees. It
|
|
52
|
+
* stops short of the poles: past it the Mercator projection has no finite y, so a pole is not
|
|
53
|
+
* a camera position the renderer can hold.
|
|
54
|
+
*/
|
|
55
|
+
const CAMERA_LATITUDE_LIMIT = 85;
|
|
56
|
+
|
|
57
|
+
/** Every `map` verb the map topic implements, keyed by the name the bus dispatches. */
|
|
58
|
+
export const mapToolContracts = {
|
|
59
|
+
"studio.map.applyCamera": {
|
|
60
|
+
capability: "embedding",
|
|
61
|
+
description:
|
|
62
|
+
"Apply a default view to the map: center ([lng,lat]), zoom, bearing (0=north, clockwise; a bearing west of north may be given as a negative number, as studio.map.getView reports it), and/or pitch. With a center the camera jumps to the whole anchor; without one the angle/zoom overlays the current center.",
|
|
63
|
+
// Every channel is optional, and an omitted one keeps its current value, so a caller can
|
|
64
|
+
// apply only the angle, only the zoom, or the full anchor.
|
|
65
|
+
input: z.object({
|
|
66
|
+
bearing: z.number().min(CAMERA_BEARING_MIN).max(DEGREES_PER_TURN).optional(),
|
|
67
|
+
center: z
|
|
68
|
+
.tuple([
|
|
69
|
+
z.number().min(-LONGITUDE_LIMIT).max(LONGITUDE_LIMIT),
|
|
70
|
+
z.number().min(-CAMERA_LATITUDE_LIMIT).max(CAMERA_LATITUDE_LIMIT),
|
|
71
|
+
])
|
|
72
|
+
.optional(),
|
|
73
|
+
pitch: z.number().min(0).max(CAMERA_PITCH_MAX).optional(),
|
|
74
|
+
zoom: z.number().min(0).max(CAMERA_ZOOM_MAX).optional(),
|
|
75
|
+
}),
|
|
76
|
+
output: toolNoDataSchema,
|
|
77
|
+
},
|
|
78
|
+
"studio.map.fitBounds": {
|
|
79
|
+
capability: "embedding",
|
|
80
|
+
description: "Fit the map viewport to a [west, south, east, north] bounding box.",
|
|
81
|
+
input: z.object({
|
|
82
|
+
// `false` jumps straight to the framed box, which is what a cold load wants: the first
|
|
83
|
+
// frame is already the destination, so nothing pans visibly under a loading cover.
|
|
84
|
+
animate: z.boolean().optional(),
|
|
85
|
+
bounds: namedBoundingBoxSchema,
|
|
86
|
+
maxZoom: z.number().optional(),
|
|
87
|
+
padding: fitPaddingSchema.optional(),
|
|
88
|
+
}),
|
|
89
|
+
output: toolNoDataSchema,
|
|
90
|
+
},
|
|
91
|
+
"studio.map.fitBoundsOrFly": {
|
|
92
|
+
capability: "embedding",
|
|
93
|
+
description: `Move the camera to frame a result: when bounds is given, fit the [west, south, east, north] box; otherwise fly to the [lng, lat] point at zoom (default ${POINT_ZOOM}).`,
|
|
94
|
+
input: z
|
|
95
|
+
.object({
|
|
96
|
+
bounds: namedBoundingBoxSchema.optional(),
|
|
97
|
+
point: namedLngLatSchema.optional(),
|
|
98
|
+
zoom: z.number().optional(),
|
|
99
|
+
})
|
|
100
|
+
// Naming neither is a camera move with no destination. Refusing it here is what lets a
|
|
101
|
+
// handler branch on `bounds` alone, rather than carrying a third do-nothing path.
|
|
102
|
+
.refine((input) => input.bounds !== undefined || input.point !== undefined, {
|
|
103
|
+
message: "fitBoundsOrFly requires either bounds or point",
|
|
104
|
+
}),
|
|
105
|
+
output: toolNoDataSchema,
|
|
106
|
+
},
|
|
107
|
+
"studio.map.fitBoundsToSegment": {
|
|
108
|
+
capability: "embedding",
|
|
109
|
+
description:
|
|
110
|
+
"Zoom and pan the map to fit an itinerary segment (null fits the whole itinerary).",
|
|
111
|
+
input: z.object({
|
|
112
|
+
// `false` jumps straight to the framed route, which is what a cold load wants: the first
|
|
113
|
+
// frame is already the destination, so nothing pans visibly under a loading cover.
|
|
114
|
+
animate: z.boolean().optional(),
|
|
115
|
+
maxZoom: z.number().optional(),
|
|
116
|
+
padding: fitPaddingSchema.optional(),
|
|
117
|
+
segmentId: z.string().nullable(),
|
|
118
|
+
}),
|
|
119
|
+
output: toolNoDataSchema,
|
|
120
|
+
},
|
|
121
|
+
"studio.map.locate": {
|
|
122
|
+
capability: "embedding",
|
|
123
|
+
description:
|
|
124
|
+
"Center the map on the device's current location, or open the prompt that asks the reader to share it when asking would prompt. Returns `forbidden` when the permission to read the position is refused, and `unavailable` when the device gives no position or the page has no geolocation.",
|
|
125
|
+
input: emptyInput,
|
|
126
|
+
output: toolNoDataSchema,
|
|
127
|
+
},
|
|
128
|
+
"studio.map.resetNorth": {
|
|
129
|
+
capability: "embedding",
|
|
130
|
+
description: "Reset the map orientation to north (clears bearing and pitch).",
|
|
131
|
+
input: emptyInput,
|
|
132
|
+
output: toolNoDataSchema,
|
|
133
|
+
},
|
|
134
|
+
"studio.map.zoomIn": {
|
|
135
|
+
capability: "embedding",
|
|
136
|
+
description: "Zoom the map in by one step.",
|
|
137
|
+
input: emptyInput,
|
|
138
|
+
output: toolNoDataSchema,
|
|
139
|
+
},
|
|
140
|
+
"studio.map.zoomOut": {
|
|
141
|
+
capability: "embedding",
|
|
142
|
+
description: "Zoom the map out by one step.",
|
|
143
|
+
input: emptyInput,
|
|
144
|
+
output: toolNoDataSchema,
|
|
145
|
+
},
|
|
146
|
+
} as const;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Street View: opening it on a point, moving it, closing it.
|
|
3
|
+
*
|
|
4
|
+
* One namespace per module, assembled in {@link studioToolContracts}. The split is not filing: a
|
|
5
|
+
* namespace is the unit a consumer adopts and the unit a reviewer reads, and a single table of
|
|
6
|
+
* every verb in the studio is neither.
|
|
7
|
+
*
|
|
8
|
+
* `open` and `move` take the same position because they are the same write: the panorama's
|
|
9
|
+
* position is one slot, and a walker stepping forward is the Maps SDK reporting a new value
|
|
10
|
+
* for it. They are two verbs so that a consumer can tell the two apart in a transcript.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import * as z from "zod";
|
|
14
|
+
|
|
15
|
+
import { emptyInput, toolNoDataSchema } from "../../bus/contracts/shared.js";
|
|
16
|
+
import { streetviewPositionSchema } from "../../chrome/stores/chrome.js";
|
|
17
|
+
|
|
18
|
+
/** Every `streetview` verb a consumer can drive, keyed by the name the bus dispatches. */
|
|
19
|
+
export const streetViewToolContracts = {
|
|
20
|
+
"studio.streetview.close": {
|
|
21
|
+
capability: "embedding",
|
|
22
|
+
description: "Close the Street View panorama.",
|
|
23
|
+
input: emptyInput,
|
|
24
|
+
output: toolNoDataSchema,
|
|
25
|
+
},
|
|
26
|
+
"studio.streetview.corridor.set": {
|
|
27
|
+
capability: "embedding",
|
|
28
|
+
description: "Draw or clear the Street View droppable-corridor band on the map.",
|
|
29
|
+
input: z.object({
|
|
30
|
+
lines: z.array(z.array(z.tuple([z.number(), z.number()]))).nullable(),
|
|
31
|
+
radiusMeters: z.number().positive(),
|
|
32
|
+
}),
|
|
33
|
+
output: toolNoDataSchema,
|
|
34
|
+
},
|
|
35
|
+
"studio.streetview.coverage.set": {
|
|
36
|
+
capability: "embedding",
|
|
37
|
+
description: "Show or hide the Street View coverage overlay on the map.",
|
|
38
|
+
input: z.object({ visible: z.boolean() }),
|
|
39
|
+
output: toolNoDataSchema,
|
|
40
|
+
},
|
|
41
|
+
"studio.streetview.move": {
|
|
42
|
+
capability: "embedding",
|
|
43
|
+
description: "Update the Street View open position as the walker steps forward.",
|
|
44
|
+
input: streetviewPositionSchema,
|
|
45
|
+
output: toolNoDataSchema,
|
|
46
|
+
},
|
|
47
|
+
"studio.streetview.open": {
|
|
48
|
+
capability: "embedding",
|
|
49
|
+
description: "Open the Street View panorama at a [lng, lat] coordinate.",
|
|
50
|
+
input: streetviewPositionSchema,
|
|
51
|
+
output: toolNoDataSchema,
|
|
52
|
+
},
|
|
53
|
+
} as const;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base terrain, and reading elevation off it.
|
|
3
|
+
*
|
|
4
|
+
* One namespace per module, assembled in {@link studioToolContracts}. The split is not filing: a
|
|
5
|
+
* namespace is the unit a consumer adopts and the unit a reviewer reads, and a single table of
|
|
6
|
+
* every verb in the studio is neither.
|
|
7
|
+
*
|
|
8
|
+
* Two shapes live here. `set` is a display verb: it swaps the base layer, and an anonymous
|
|
9
|
+
* embed drives it, hence `embedding`. The samplers READ the DEM the browser already holds, which
|
|
10
|
+
* is what separates them from the Data API's terrain operations: they answer instantly off the
|
|
11
|
+
* GPU and are blind to ground the map has not drawn.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as z from "zod";
|
|
15
|
+
|
|
16
|
+
import { lngLatSchema, toolNoDataSchema } from "../../bus/contracts/shared.js";
|
|
17
|
+
import { terrainVariantSchema } from "../../search/rules/params.js";
|
|
18
|
+
import { worldBoundingBoxSchema, worldLngLatSchema } from "../rules/coordinates.js";
|
|
19
|
+
import { overlaySampleResultSchema } from "../rules/terrainReading.js";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* SAMPLES_MIN / MAX bound how many points a sample along a segment reads.
|
|
23
|
+
*
|
|
24
|
+
* The floor is what makes a sample a profile rather than a reading. The ceiling is a cost: each
|
|
25
|
+
* point is its own DEM read on the main thread, so an unbounded count turns one call into an
|
|
26
|
+
* unbounded amount of work. The contract bounds the count and does not default it: how closely
|
|
27
|
+
* to read a route when the caller did not say is a HANDLER's judgement. The overlay contract's
|
|
28
|
+
* sample along a segment reads the same bounds.
|
|
29
|
+
*/
|
|
30
|
+
export const SAMPLES_MIN = 2;
|
|
31
|
+
export const SAMPLES_MAX = 50;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* AREA_GRID_MIN / AREA_GRID_MAX bound a single axis of the area-sample grid (columns or rows).
|
|
35
|
+
*
|
|
36
|
+
* At least 2 along an axis so the grid spans the bbox edges; the per-axis cap keeps the request
|
|
37
|
+
* describable. The TOTAL cell count is capped separately by whoever samples, because how many
|
|
38
|
+
* DEM reads one frame can afford is a property of the sampler and not of the request.
|
|
39
|
+
*/
|
|
40
|
+
export const AREA_GRID_MIN = 2;
|
|
41
|
+
const AREA_GRID_MAX = 64;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The two halves of a sampled point, spread into each reading's own members: a point the DEM
|
|
45
|
+
* covers states its `sample`, and one it does not states `loaded: false` and no reading.
|
|
46
|
+
*
|
|
47
|
+
* `loaded` is the member a reader branches on, in a point's answer, in a segment's samples and
|
|
48
|
+
* in an area's cells alike.
|
|
49
|
+
*/
|
|
50
|
+
const loadedReading = { loaded: z.literal(true), sample: overlaySampleResultSchema };
|
|
51
|
+
const unloadedReading = { loaded: z.literal(false) };
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* terrainPointSampleSchema is what `studio.terrain.sampleAt` answers: the point as named, with
|
|
55
|
+
* its surface reading, or with the reason there is none where the terrain is not loaded.
|
|
56
|
+
*/
|
|
57
|
+
const terrainPointSampleSchema = z.discriminatedUnion("loaded", [
|
|
58
|
+
z.strictObject({ lngLat: worldLngLatSchema, ...loadedReading }),
|
|
59
|
+
z.strictObject({ lngLat: worldLngLatSchema, reason: z.string(), ...unloadedReading }),
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* terrainSegmentSamplesSchema is what `studio.terrain.sampleAlongSegment` answers: the segment
|
|
64
|
+
* read, and one sample per point in the order of the line, each at its `fraction` of the
|
|
65
|
+
* line's length from 0 to 1.
|
|
66
|
+
*/
|
|
67
|
+
const terrainSegmentSamplesSchema = z.strictObject({
|
|
68
|
+
samples: z.array(
|
|
69
|
+
z.discriminatedUnion("loaded", [
|
|
70
|
+
z.strictObject({ fraction: z.number(), lngLat: lngLatSchema, ...loadedReading }),
|
|
71
|
+
z.strictObject({ fraction: z.number(), lngLat: lngLatSchema, ...unloadedReading }),
|
|
72
|
+
]),
|
|
73
|
+
),
|
|
74
|
+
segmentId: z.string(),
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/** A cell's place in an area's grid: its column from the west and its row from the south. */
|
|
78
|
+
const areaCell = { col: z.number().int(), lngLat: lngLatSchema, row: z.number().int() };
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* terrainAreaSamplesSchema is what `studio.terrain.sampleArea` answers: the box as named, the
|
|
82
|
+
* grid that was read, and its cells row by row from the south-west corner.
|
|
83
|
+
*
|
|
84
|
+
* `cols` and `rows` are the grid read, which is the grid asked for unless `clamped` is true:
|
|
85
|
+
* a grid past the sampler's cell cap is read at a smaller one of the same proportions.
|
|
86
|
+
*/
|
|
87
|
+
const terrainAreaSamplesSchema = z.strictObject({
|
|
88
|
+
bbox: worldBoundingBoxSchema,
|
|
89
|
+
cells: z.array(
|
|
90
|
+
z.discriminatedUnion("loaded", [
|
|
91
|
+
z.strictObject({ ...areaCell, ...loadedReading }),
|
|
92
|
+
z.strictObject({ ...areaCell, ...unloadedReading }),
|
|
93
|
+
]),
|
|
94
|
+
),
|
|
95
|
+
clamped: z.boolean(),
|
|
96
|
+
cols: z.number().int(),
|
|
97
|
+
rows: z.number().int(),
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
/** Every `studio.terrain` verb a consumer can drive, keyed by the name the bus dispatches. */
|
|
101
|
+
export const terrainToolContracts = {
|
|
102
|
+
"studio.terrain.sampleAlongSegment": {
|
|
103
|
+
capability: "authenticated",
|
|
104
|
+
description:
|
|
105
|
+
"Sample the surface (elevation, slope, aspect, and steepness band) at evenly-spaced points along an itinerary segment from the terrain DEM. Returns each sample's fraction along the line, its [lng, lat], and the surface reading (or loaded:false where terrain is not loaded).",
|
|
106
|
+
// The endpoints are always included, so the sample spans the full segment.
|
|
107
|
+
input: z.object({
|
|
108
|
+
samples: z.number().int().min(SAMPLES_MIN).max(SAMPLES_MAX).optional(),
|
|
109
|
+
segmentId: z.string(),
|
|
110
|
+
}),
|
|
111
|
+
output: terrainSegmentSamplesSchema,
|
|
112
|
+
},
|
|
113
|
+
"studio.terrain.sampleArea": {
|
|
114
|
+
capability: "authenticated",
|
|
115
|
+
description:
|
|
116
|
+
"Sample the surface (elevation in m, slope in degrees, aspect 0–360° downhill, and the steepness band) over a [west, south, east, north] bbox on a cols × rows grid of evenly-spaced points from the terrain DEM. Returns each cell's row/col, [lng, lat], and surface reading (or loaded:false where terrain is not loaded). Threshold or contour the grid to build an area zone (slope band, aspect sector, elevation band). The total cell count is capped; an oversized grid is clamped and the clamp is reported.",
|
|
117
|
+
// The refine is what rejects a zero-area or inverted box at the boundary, where the tuple
|
|
118
|
+
// alone would accept one and the sampler would answer with an empty grid.
|
|
119
|
+
input: z
|
|
120
|
+
.object({
|
|
121
|
+
bbox: worldBoundingBoxSchema,
|
|
122
|
+
cols: z.number().int().min(AREA_GRID_MIN).max(AREA_GRID_MAX).optional(),
|
|
123
|
+
rows: z.number().int().min(AREA_GRID_MIN).max(AREA_GRID_MAX).optional(),
|
|
124
|
+
})
|
|
125
|
+
.refine((input) => input.bbox[0] < input.bbox[2] && input.bbox[1] < input.bbox[3], {
|
|
126
|
+
message: "bbox must be [west, south, east, north] with west < east and south < north",
|
|
127
|
+
}),
|
|
128
|
+
output: terrainAreaSamplesSchema,
|
|
129
|
+
},
|
|
130
|
+
"studio.terrain.sampleAt": {
|
|
131
|
+
capability: "authenticated",
|
|
132
|
+
description:
|
|
133
|
+
"Sample the surface at a single [lng, lat] from the terrain DEM: elevation (m), slope (degrees), aspect (0–360° compass bearing, downhill), and the steepness band (25-30..45+, derived from slope; absent below 25°). Use it for surface analysis (steepness, aspect, steepness exposure) and the steepness/aspectslope overlays. Returns loaded:false when terrain is not loaded at the point.",
|
|
134
|
+
// A sample point is a coordinate a caller named, so it is held to the world.
|
|
135
|
+
input: z.object({ lngLat: worldLngLatSchema }),
|
|
136
|
+
output: terrainPointSampleSchema,
|
|
137
|
+
},
|
|
138
|
+
"studio.terrain.set": {
|
|
139
|
+
capability: "embedding",
|
|
140
|
+
description:
|
|
141
|
+
"Switch the studio base layer to a terrain by slug (e.g. topo, satellite), optionally setting its light/dark tint.",
|
|
142
|
+
// The terrain is a slug resolved against the layers manifest at render time, so it is a
|
|
143
|
+
// free non-empty string rather than a fixed enum. The optional variant is the base layer's
|
|
144
|
+
// light/dark tint: present, it is set alongside the slug (an embed seeds the organization's
|
|
145
|
+
// configured terrain AND its tint through this one verb); omitted, the tint is left as is.
|
|
146
|
+
input: z.object({
|
|
147
|
+
terrain: z.string().min(1),
|
|
148
|
+
variant: terrainVariantSchema.optional(),
|
|
149
|
+
}),
|
|
150
|
+
output: toolNoDataSchema,
|
|
151
|
+
},
|
|
152
|
+
} as const;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { ZodError } from "zod";
|
|
2
|
+
|
|
3
|
+
import type { OverlayFeature } from "@mountaya/elements/map-client";
|
|
4
|
+
import { classifySteepness, STEEPNESS_OVERLAY_SLUG } from "@mountaya/elements/profile";
|
|
5
|
+
|
|
6
|
+
import type { ToolFailure } from "../../bus/rules/types.js";
|
|
7
|
+
import type { StudioToolDefinition } from "../../viewer/rules/context.js";
|
|
8
|
+
import { overlayFeatureSchema, poiInfoSchema } from "../rules/mapEvents.js";
|
|
9
|
+
import { terrainChannelsOf } from "../rules/terrainReading.js";
|
|
10
|
+
|
|
11
|
+
/** The lists a right-click reads off the map, each validated before it is stored. */
|
|
12
|
+
const poiListSchema = poiInfoSchema.array();
|
|
13
|
+
const overlayFeatureListSchema = overlayFeatureSchema.array();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* notWhatTheMenuHolds answers the refusal for a list a map client handed over that the menu's
|
|
17
|
+
* slot cannot hold, naming the method that answered it: a value in another shape than the
|
|
18
|
+
* client's type states, or a number that is not finite. `internal`, since nothing the caller
|
|
19
|
+
* sent is wrong.
|
|
20
|
+
*/
|
|
21
|
+
const notWhatTheMenuHolds = (method: string, error: ZodError): ToolFailure => {
|
|
22
|
+
const issue = error.issues[0];
|
|
23
|
+
const where = issue ? `at ${issue.path.join(".") || "the list"}: ${issue.message}` : "no detail";
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
code: "internal",
|
|
27
|
+
error: `open context menu: the map client's ${method} answered a value the menu cannot hold (${where}), so nothing is stored.`,
|
|
28
|
+
ok: false,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* openContextMenu opens the right-click context menu at a [lng, lat]. It is a
|
|
34
|
+
* client tool driving the map surface: it reads the map to project the
|
|
35
|
+
* coordinate to a container pixel, to query the points-of-interest rendered
|
|
36
|
+
* there, and to query the active overlay's vector features under the cursor,
|
|
37
|
+
* then writes the menu slot in the UI store. It guards on a mounted map and
|
|
38
|
+
* returns a structured failure rather than throwing when none is present, so an
|
|
39
|
+
* agent open before the map exists is a clean no-op. The public embedded studio
|
|
40
|
+
* shows the same read-only right-click readouts (elevation, POI, overlay, zone)
|
|
41
|
+
* the authenticated studio does; the popup's only authoring affordance (add
|
|
42
|
+
* waypoint) is itself editor-gated and hidden on the embed, so the menu surfaces
|
|
43
|
+
* readouts alone there. ctx is the first positional parameter.
|
|
44
|
+
*
|
|
45
|
+
* The points of interest and the overlay's vector features are validated with `poiInfoSchema`
|
|
46
|
+
* and `overlayFeatureSchema` before the slot is written. A map client that answers either list
|
|
47
|
+
* in another shape, or with a number that is not finite, is refused with `internal` and
|
|
48
|
+
* nothing is stored, so every reader of the slot reads a parsed value.
|
|
49
|
+
*
|
|
50
|
+
* The terrain reading is read as `studio.terrain.sampleAt` reads it ({@link terrainChannelsOf}):
|
|
51
|
+
* a channel that is no finite number is dropped, the menu opens over the channels the reading
|
|
52
|
+
* does hold, and a reading that holds none appends nothing.
|
|
53
|
+
*/
|
|
54
|
+
export const openContextMenu: StudioToolDefinition<"studio.contextmenu.open"> = {
|
|
55
|
+
handler: (ctx, input) => {
|
|
56
|
+
if (!ctx.map) {
|
|
57
|
+
return { code: "no-map", error: "no map is currently mounted", ok: false };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const point = ctx.map.project(input.lngLat);
|
|
61
|
+
const pois = poiListSchema.safeParse(ctx.map.queryPoisAt(input.lngLat));
|
|
62
|
+
if (!pois.success) {
|
|
63
|
+
return notWhatTheMenuHolds("queryPoisAt", pois.error);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const vectorFeatures = overlayFeatureListSchema.safeParse(
|
|
67
|
+
ctx.map.queryOverlayFeaturesAt(input.lngLat),
|
|
68
|
+
);
|
|
69
|
+
if (!vectorFeatures.success) {
|
|
70
|
+
return notWhatTheMenuHolds("queryOverlayFeaturesAt", vectorFeatures.error);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The zone under the cursor (null when the right-click did not land inside
|
|
74
|
+
// one). It rides through to the store slot so the popup can render the zone's
|
|
75
|
+
// details (description, level, the active window) alongside the POI and
|
|
76
|
+
// overlay readouts, resolved from the same map the pixel/POI/overlay come from.
|
|
77
|
+
const zone = ctx.map.zoneAtPoint(input.lngLat);
|
|
78
|
+
// The map returns an always-on terrain readout (elevation, slope, aspect)
|
|
79
|
+
// whenever 3D terrain is loaded under the cursor; the readout rides the
|
|
80
|
+
// same OverlayFeature shape as the vector-tile features so the popup
|
|
81
|
+
// renders both sources through one path (humanizeOverlayKey). When the
|
|
82
|
+
// slope steepness overlay is active and drawn, attach the steepness-band
|
|
83
|
+
// classification derived from the sampled slope: the only
|
|
84
|
+
// overlay-conditional field. The store keeps a slug a link named for a
|
|
85
|
+
// viewer who does not hold `map-overlays`, whose map draws no overlay, so
|
|
86
|
+
// the band is read under the same gate the map draws by.
|
|
87
|
+
const reading = terrainChannelsOf(ctx.map.sampleOverlayAt(input.lngLat));
|
|
88
|
+
const overlayFeatures = vectorFeatures.data;
|
|
89
|
+
if (reading) {
|
|
90
|
+
const enriched: OverlayFeature = {};
|
|
91
|
+
for (const [channel, value] of Object.entries(reading)) {
|
|
92
|
+
if (value !== undefined) {
|
|
93
|
+
enriched[channel] = value;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const steepnessClass =
|
|
98
|
+
ctx.ui.getState().activeOverlay === STEEPNESS_OVERLAY_SLUG &&
|
|
99
|
+
reading.slope !== undefined &&
|
|
100
|
+
ctx.viewer.hasEntitlement("map-overlays")
|
|
101
|
+
? classifySteepness(reading.slope)
|
|
102
|
+
: null;
|
|
103
|
+
if (steepnessClass !== null) {
|
|
104
|
+
enriched.steepness_class = steepnessClass;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
overlayFeatures.push(enriched);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
ctx.ui.getState().setContextMenu({
|
|
111
|
+
lngLat: input.lngLat,
|
|
112
|
+
overlayFeatures,
|
|
113
|
+
point,
|
|
114
|
+
pois: pois.data,
|
|
115
|
+
zone,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const [lng, lat] = input.lngLat;
|
|
119
|
+
|
|
120
|
+
return { ok: true, summary: `Opened the context menu at ${lng}, ${lat}.` };
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* closeContextMenu closes the right-click context menu by clearing the menu
|
|
126
|
+
* slot. It writes only the UI store and pairs with the open above. ctx is the
|
|
127
|
+
* first positional parameter.
|
|
128
|
+
*/
|
|
129
|
+
export const closeContextMenu: StudioToolDefinition<"studio.contextmenu.close"> = {
|
|
130
|
+
handler: (ctx) => {
|
|
131
|
+
ctx.ui.getState().setContextMenu(null);
|
|
132
|
+
|
|
133
|
+
return { ok: true, summary: "Closed the context menu." };
|
|
134
|
+
},
|
|
135
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { StudioToolDefinition } from "../../viewer/rules/context.js";
|
|
2
|
+
import { locateThroughMap } from "./map.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* openGeolocatePrompt opens the studio's pre-prompt modal that asks the viewer
|
|
6
|
+
* to share their location before the browser's own permission UI fires. The
|
|
7
|
+
* modal lets the studio frame why it needs the fix and lets a previously-denied
|
|
8
|
+
* viewer recover by deep-linking into site settings. ctx is the first positional
|
|
9
|
+
* parameter.
|
|
10
|
+
*/
|
|
11
|
+
export const openGeolocatePrompt: StudioToolDefinition<"studio.geolocate.prompt.open"> = {
|
|
12
|
+
handler: (ctx) => {
|
|
13
|
+
ctx.ui.getState().setGeolocatePromptOpen(true);
|
|
14
|
+
|
|
15
|
+
return { ok: true, summary: "Opened the geolocate prompt." };
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* closeGeolocatePrompt closes the pre-prompt modal without asking the browser
|
|
21
|
+
* for a location fix.
|
|
22
|
+
*/
|
|
23
|
+
export const closeGeolocatePrompt: StudioToolDefinition<"studio.geolocate.prompt.close"> = {
|
|
24
|
+
handler: (ctx) => {
|
|
25
|
+
ctx.ui.getState().setGeolocatePromptOpen(false);
|
|
26
|
+
|
|
27
|
+
return { ok: true, summary: "Closed the geolocate prompt." };
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* confirmGeolocate is the pre-prompt's confirm: it closes the modal and takes the fix through
|
|
33
|
+
* the map client.
|
|
34
|
+
*
|
|
35
|
+
* The fix is `locateThroughMap`, the one `studio.map.locate` takes when asking is already
|
|
36
|
+
* granted: the locating flag is raised while a fix is in flight (the geolocate control reads as
|
|
37
|
+
* busy), a fix lands silently with the camera framed, and a denied permission, a sensor that
|
|
38
|
+
* does not answer or a missing API each raises the alert for its reason and answers that
|
|
39
|
+
* reason's refusal. Returns a structured failure when no map is mounted, with the modal closed
|
|
40
|
+
* all the same.
|
|
41
|
+
*/
|
|
42
|
+
export const confirmGeolocate: StudioToolDefinition<"studio.geolocate.confirm"> = {
|
|
43
|
+
handler: async (ctx) => {
|
|
44
|
+
ctx.ui.getState().setGeolocatePromptOpen(false);
|
|
45
|
+
|
|
46
|
+
if (!ctx.map) {
|
|
47
|
+
return { code: "no-map", error: "no map is currently mounted", ok: false };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return locateThroughMap(ctx, ctx.map);
|
|
51
|
+
},
|
|
52
|
+
};
|