@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,2600 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, {
|
|
3
|
+
__esModule: { value: true },
|
|
4
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
5
|
+
});
|
|
6
|
+
const require_rolldown_runtime = require("../chunk-Bn6ZbxkS.cjs");
|
|
7
|
+
const require_routeHazardCopy = require("../chunk-Csr3KDpZ.cjs");
|
|
8
|
+
const require_errors = require("../chunk-Damps5Tk.cjs");
|
|
9
|
+
const require_viewer = require("../chunk-BgngsvK8.cjs");
|
|
10
|
+
const require_tabs = require("../chunk-CSyHY67q.cjs");
|
|
11
|
+
const require_listeners = require("../chunk-BIEc_SkR.cjs");
|
|
12
|
+
const require_confirmCopy = require("../chunk-CnrsRK2u.cjs");
|
|
13
|
+
const require_context = require("../chunk-B5Uz3Qct.cjs");
|
|
14
|
+
const require_directorThreads = require("../chunk-BaPiaz5X.cjs");
|
|
15
|
+
let zod = require("zod");
|
|
16
|
+
zod = require_rolldown_runtime.__toESM(zod);
|
|
17
|
+
let _mountaya_elements_geo = require("@mountaya/elements/geo");
|
|
18
|
+
let zustand_vanilla = require("zustand/vanilla");
|
|
19
|
+
let _mountaya_elements_agent = require("@mountaya/elements/agent");
|
|
20
|
+
const editingOf = (ui) => {
|
|
21
|
+
if (ui.segmentEditSession) return [ui.segmentEditSession.segmentId ?? null, "segment"];
|
|
22
|
+
if (ui.waypointEditSession) return [ui.waypointEditSession.waypointId ?? null, "waypoint"];
|
|
23
|
+
if (ui.zoneEditSession) return [ui.zoneEditSession.zoneId ?? null, "zone"];
|
|
24
|
+
return [null, null];
|
|
25
|
+
};
|
|
26
|
+
const captureStudioState = (ctx) => {
|
|
27
|
+
const ui = ctx.ui.getState();
|
|
28
|
+
const itinerary = ui.activeItinerary;
|
|
29
|
+
const [editingId, editingKind] = editingOf(ui);
|
|
30
|
+
return {
|
|
31
|
+
activeOverlay: ui.activeOverlay ?? null,
|
|
32
|
+
editingId,
|
|
33
|
+
editingKind,
|
|
34
|
+
itineraryId: itinerary?.id ?? null,
|
|
35
|
+
itineraryName: itinerary?.name ?? null,
|
|
36
|
+
segmentCount: itinerary?.segments.length ?? 0,
|
|
37
|
+
selectionId: ui.selection?.id ?? null,
|
|
38
|
+
selectionKind: ui.selection?.kind ?? null,
|
|
39
|
+
waypointCount: itinerary?.waypoints.length ?? 0
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const diffStudioState = (before, after) => {
|
|
43
|
+
const delta = {};
|
|
44
|
+
let changed = false;
|
|
45
|
+
for (const key of Object.keys(after)) if (before[key] !== after[key]) {
|
|
46
|
+
Object.assign(delta, { [key]: after[key] });
|
|
47
|
+
changed = true;
|
|
48
|
+
}
|
|
49
|
+
return changed ? delta : void 0;
|
|
50
|
+
};
|
|
51
|
+
const segmentTargetSchema = zod.object({ segmentId: zod.string().min(1) });
|
|
52
|
+
const waypointTargetSchema = zod.object({ waypointId: zod.string().min(1) });
|
|
53
|
+
const contracts = require_viewer.studioToolContracts;
|
|
54
|
+
const agentEditLockTarget = (name, input) => {
|
|
55
|
+
if (contracts[name]?.capability !== "editor") return null;
|
|
56
|
+
const segment = segmentTargetSchema.safeParse(input);
|
|
57
|
+
if (segment.success) return {
|
|
58
|
+
id: segment.data.segmentId,
|
|
59
|
+
kind: "segment"
|
|
60
|
+
};
|
|
61
|
+
const waypoint = waypointTargetSchema.safeParse(input);
|
|
62
|
+
if (waypoint.success) return {
|
|
63
|
+
id: waypoint.data.waypointId,
|
|
64
|
+
kind: "waypoint"
|
|
65
|
+
};
|
|
66
|
+
return null;
|
|
67
|
+
};
|
|
68
|
+
const agentHandoffTools = /* @__PURE__ */ new Set(["studio.itinerary.segment.editPropose", "studio.itinerary.waypoint.editPropose"]);
|
|
69
|
+
const agentTakesEntityBack = (name, input) => !agentHandoffTools.has(name) && agentEditLockTarget(name, input) !== null;
|
|
70
|
+
const copilotOrganizationId = (state) => {
|
|
71
|
+
if (state.activeItinerary) return state.activeItinerary.organization_id;
|
|
72
|
+
if (state.activeZone) return state.activeZone.organization_id;
|
|
73
|
+
return state.zoneEditSession?.intent === "create" ? state.zoneEditSession.organizationId : void 0;
|
|
74
|
+
};
|
|
75
|
+
const routerStateFrom = (ctx) => {
|
|
76
|
+
const ui = ctx.ui.getState();
|
|
77
|
+
const editSession = ui.segmentEditSession ? "segment" : ui.waypointEditSession ? "waypoint" : ui.zoneEditSession ? "zone" : null;
|
|
78
|
+
const openResource = ui.activeZone !== null ? "zone" : ui.activeItinerary !== null ? "itinerary" : null;
|
|
79
|
+
return {
|
|
80
|
+
editSession,
|
|
81
|
+
importDraft: ui.importSession !== null,
|
|
82
|
+
openResource,
|
|
83
|
+
suggestDraft: ui.suggestSession !== null,
|
|
84
|
+
videoOpen: ui.videoExport !== null
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const compareIds = (a, b) => {
|
|
88
|
+
if (a === b) return 0;
|
|
89
|
+
return a < b ? -1 : 1;
|
|
90
|
+
};
|
|
91
|
+
const createStudioRouter = ({ playbook, skillRoutes, surfaceLocks, surfaces: surfaceTable }) => {
|
|
92
|
+
const wideFallbackSurfaces = () => surfaceTable.filter((surface) => surface.wideFallback).map((surface) => surface.id);
|
|
93
|
+
const alwaysOn = () => surfaceTable.filter((surface) => surface.always).map((surface) => surface.id);
|
|
94
|
+
const lockHolds = (lock, state) => state[lock.field] === lock.equals;
|
|
95
|
+
const MAX_TASK_SURFACES = 2;
|
|
96
|
+
const MAX_CARRIED_SURFACES = 4;
|
|
97
|
+
const foldApostrophes = (message) => message.replace(/’/g, "'");
|
|
98
|
+
const matchSkillRoutes = (message) => {
|
|
99
|
+
const lowered = message.toLowerCase();
|
|
100
|
+
const hits = skillRoutes.map((route) => ({
|
|
101
|
+
matches: route.intents.filter((intent) => intent !== "" && lowered.includes(intent)).length,
|
|
102
|
+
route
|
|
103
|
+
})).filter((entry) => entry.matches > 0).sort((a, b) => b.matches - a.matches || compareIds(a.route.id, b.route.id)).slice(0, 3);
|
|
104
|
+
const surfaces = [];
|
|
105
|
+
for (const hit of hits) for (const id of hit.route.surfaces) {
|
|
106
|
+
if (surfaces.length >= MAX_CARRIED_SURFACES) return surfaces;
|
|
107
|
+
if (!surfaces.includes(id)) surfaces.push(id);
|
|
108
|
+
}
|
|
109
|
+
return surfaces;
|
|
110
|
+
};
|
|
111
|
+
const surfacePatterns = new Map(surfaceTable.map((surface) => [surface.id, surface.keywords.map((keyword) => new RegExp(`(?<![\\p{L}_])${keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\p{L}\\p{N}_])`, "iu"))]));
|
|
112
|
+
const scoreSurface = (surface, message) => {
|
|
113
|
+
let score = 0;
|
|
114
|
+
for (const pattern of surfacePatterns.get(surface.id) ?? []) if (pattern.test(message)) score += 1;
|
|
115
|
+
return score;
|
|
116
|
+
};
|
|
117
|
+
const selectSurfaces = (message, state = {}, previous = []) => {
|
|
118
|
+
const core = alwaysOn();
|
|
119
|
+
const known = new Set(surfaceTable.map((surface) => surface.id));
|
|
120
|
+
const folded = foldApostrophes(message);
|
|
121
|
+
const locked = surfaceLocks.filter((lock) => lockHolds(lock, state)).map((lock) => lock.surface).filter((id) => known.has(id) && !core.includes(id)).slice(0, MAX_TASK_SURFACES);
|
|
122
|
+
const skillDriven = matchSkillRoutes(folded).filter((id) => known.has(id) && !core.includes(id));
|
|
123
|
+
const keywordMatched = surfaceTable.filter((surface) => !surface.always && surface.keywords.length > 0).map((surface) => ({
|
|
124
|
+
id: surface.id,
|
|
125
|
+
score: scoreSurface(surface, folded)
|
|
126
|
+
})).filter((entry) => entry.score > 0).sort((a, b) => b.score - a.score || compareIds(a.id, b.id)).slice(0, MAX_TASK_SURFACES).map((entry) => entry.id);
|
|
127
|
+
const matched = [];
|
|
128
|
+
for (const id of [
|
|
129
|
+
...locked,
|
|
130
|
+
...skillDriven,
|
|
131
|
+
...keywordMatched
|
|
132
|
+
]) {
|
|
133
|
+
if (matched.length >= MAX_CARRIED_SURFACES) break;
|
|
134
|
+
if (!matched.includes(id)) matched.push(id);
|
|
135
|
+
}
|
|
136
|
+
let carried = previous.filter((id) => known.has(id) && !core.includes(id));
|
|
137
|
+
if (carried.length > MAX_CARRIED_SURFACES) carried = [];
|
|
138
|
+
if (matched.length === 0) {
|
|
139
|
+
if (carried.length > 0) return {
|
|
140
|
+
reason: "sticky",
|
|
141
|
+
surfaces: [...core, ...carried]
|
|
142
|
+
};
|
|
143
|
+
return {
|
|
144
|
+
reason: "wide",
|
|
145
|
+
surfaces: wideFallbackSurfaces()
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
if (carried.length > 0 && matched.every((id) => carried.includes(id))) return {
|
|
149
|
+
reason: "sticky",
|
|
150
|
+
surfaces: [...core, ...carried]
|
|
151
|
+
};
|
|
152
|
+
let reason = "intent";
|
|
153
|
+
if (locked.length > 0) reason = "lock";
|
|
154
|
+
else if (skillDriven.length > 0) reason = "skill";
|
|
155
|
+
return {
|
|
156
|
+
reason,
|
|
157
|
+
surfaces: [...core, ...matched]
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
const surfaceTools = (surfaces) => {
|
|
161
|
+
const wanted = new Set(surfaces);
|
|
162
|
+
const tools = /* @__PURE__ */ new Set();
|
|
163
|
+
for (const surface of surfaceTable) {
|
|
164
|
+
if (!wanted.has(surface.id)) continue;
|
|
165
|
+
for (const member of surface.members) tools.add(member);
|
|
166
|
+
}
|
|
167
|
+
return tools;
|
|
168
|
+
};
|
|
169
|
+
const recoveryFor = (tool, code) => {
|
|
170
|
+
if (!code) return;
|
|
171
|
+
return playbook.find((entry) => entry.id === tool)?.recovery.find((item) => item.code === code)?.do;
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
recoveryFor,
|
|
175
|
+
selectSurfaces,
|
|
176
|
+
surfaceTools
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
const studioStateDelta = {
|
|
180
|
+
capture: captureStudioState,
|
|
181
|
+
diff: diffStudioState
|
|
182
|
+
};
|
|
183
|
+
const PLAYBOOK = [
|
|
184
|
+
{
|
|
185
|
+
confirms: false,
|
|
186
|
+
description: "Classify an existing line by surface, way type, trail difficulty, and steepness. Typed operation first, and anything else only when none of them fits.",
|
|
187
|
+
id: "analyzeGeometry",
|
|
188
|
+
kind: "read",
|
|
189
|
+
recovery: [{
|
|
190
|
+
code: "invalid-input",
|
|
191
|
+
do: "Coordinates are [longitude, latitude] pairs. A saved segment's positions carry an altitude, and a routed one is a GeometryCollection: take its LineString, drop the altitude, and retry once."
|
|
192
|
+
}],
|
|
193
|
+
surfaces: ["routing"]
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
confirms: false,
|
|
197
|
+
description: "Run a raw read-only GraphQL query against the Data API. Typed operation first, and anything else only when none of them fits.",
|
|
198
|
+
id: "data.query",
|
|
199
|
+
kind: "read",
|
|
200
|
+
recovery: [{
|
|
201
|
+
code: "invalid-input",
|
|
202
|
+
do: "Do not iterate on the syntax. Switch to the typed operation that covers the question."
|
|
203
|
+
}, {
|
|
204
|
+
code: "forbidden",
|
|
205
|
+
do: "The query attempted a write or an unpermitted root field. It will not succeed rewritten."
|
|
206
|
+
}],
|
|
207
|
+
surfaces: ["advanced"]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
confirms: false,
|
|
211
|
+
description: "Compute a route between waypoints for an activity, with its distance, duration, and geometry. You intend to change the user's route. This alone changes nothing; propose the edit.",
|
|
212
|
+
id: "directions.compute",
|
|
213
|
+
kind: "read",
|
|
214
|
+
recovery: [
|
|
215
|
+
{
|
|
216
|
+
code: "invalid-input",
|
|
217
|
+
do: "Check dimensionality and coordinate order, then retry once."
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
code: "not-found",
|
|
221
|
+
do: "Report it as a real answer, not a failure. The network may genuinely not connect them for this activity."
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
code: "rate-limited",
|
|
225
|
+
do: "Stop computing alternatives and report what you have."
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
surfaces: ["routing"]
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
confirms: false,
|
|
232
|
+
description: "Compute the area reachable from one or more origins within a time or distance budget. Typed operation first, and anything else only when none of them fits.",
|
|
233
|
+
id: "isochrones",
|
|
234
|
+
kind: "read",
|
|
235
|
+
recovery: [{
|
|
236
|
+
code: "invalid-input",
|
|
237
|
+
do: "Reduce the budget and retry once. Very large ranges are refused rather than truncated."
|
|
238
|
+
}, {
|
|
239
|
+
code: "upgrade-required",
|
|
240
|
+
do: "The organization does not hold the Data API. Say so; do not retry."
|
|
241
|
+
}],
|
|
242
|
+
surfaces: ["zones"]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
confirms: false,
|
|
246
|
+
description: "Compute travel time and distance between many origins and destinations in one call. Typed operation first, and anything else only when none of them fits.",
|
|
247
|
+
id: "matrix",
|
|
248
|
+
kind: "read",
|
|
249
|
+
recovery: [{
|
|
250
|
+
code: "invalid-input",
|
|
251
|
+
do: "Indices are into the locations array. Rebuild them and retry once with fewer points."
|
|
252
|
+
}, {
|
|
253
|
+
code: "rate-limited",
|
|
254
|
+
do: "Stop. Rank what you already have rather than waiting."
|
|
255
|
+
}],
|
|
256
|
+
surfaces: ["routing"]
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
capability: "authenticated",
|
|
260
|
+
confirms: false,
|
|
261
|
+
description: "Resolve a named place to coordinates. Named place, free text, category, or \"propose me something\".",
|
|
262
|
+
id: "studio.data.geocode",
|
|
263
|
+
kind: "read",
|
|
264
|
+
recovery: [{
|
|
265
|
+
code: "not-found",
|
|
266
|
+
do: "No place by that name. Try search, which matches loosely, before telling the user it does not exist."
|
|
267
|
+
}, {
|
|
268
|
+
code: "rate-limited",
|
|
269
|
+
do: "Stop looking things up. Work with what you have and say so."
|
|
270
|
+
}],
|
|
271
|
+
surfaces: ["discovery"]
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
capability: "authenticated",
|
|
275
|
+
confirms: false,
|
|
276
|
+
description: "List points of interest of a category within an area. Named place, free text, category, or \"propose me something\".",
|
|
277
|
+
id: "studio.data.pois",
|
|
278
|
+
kind: "read",
|
|
279
|
+
recovery: [{
|
|
280
|
+
code: "invalid-input",
|
|
281
|
+
do: "A bbox is [minLongitude, minLatitude, maxLongitude, maxLatitude]. Rebuild it and retry once."
|
|
282
|
+
}],
|
|
283
|
+
surfaces: ["discovery"]
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
capability: "authenticated",
|
|
287
|
+
confirms: false,
|
|
288
|
+
description: "Name the place at a coordinate. Named place, free text, category, or \"propose me something\".",
|
|
289
|
+
id: "studio.data.reverseGeocode",
|
|
290
|
+
kind: "read",
|
|
291
|
+
recovery: [{
|
|
292
|
+
code: "not-found",
|
|
293
|
+
do: "Nothing named there. Describe the point by its position on the route instead."
|
|
294
|
+
}],
|
|
295
|
+
surfaces: ["discovery"]
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
capability: "authenticated",
|
|
299
|
+
confirms: false,
|
|
300
|
+
description: "Search free text across places, points of interest, and itineraries, collections, and zones the user can see. Named place, free text, category, or \"propose me something\".",
|
|
301
|
+
id: "studio.data.search",
|
|
302
|
+
kind: "read",
|
|
303
|
+
recovery: [{
|
|
304
|
+
code: "rate-limited",
|
|
305
|
+
do: "Stop searching. Report what you have already found."
|
|
306
|
+
}],
|
|
307
|
+
surfaces: ["discovery"]
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
capability: "editor",
|
|
311
|
+
confirms: false,
|
|
312
|
+
description: "Copy an itinerary, or a continuous stretch of it, into a new itinerary. Not for moving or renaming an itinerary; this always leaves the original in place and adds a second one.",
|
|
313
|
+
id: "studio.itinerary.duplicate",
|
|
314
|
+
kind: "mutate",
|
|
315
|
+
recovery: [
|
|
316
|
+
{
|
|
317
|
+
code: "draft-open",
|
|
318
|
+
do: "A proposal is not a saved itinerary and has nothing to copy. Tell the user to save or discard the draft first, and stop."
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
code: "invalid-input",
|
|
322
|
+
do: "Re-read the itinerary and keep an unbroken stretch, or leave segmentIds and waypointIds out to copy it whole, before retrying once."
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
code: "upgrade-required",
|
|
326
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
code: "forbidden",
|
|
330
|
+
do: "Report which organization was refused and offer the ones they can write to, then stop."
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
code: "conflict",
|
|
334
|
+
do: "When the refusal names the itinerary holding the name, ask the user for another name and copy under it. Otherwise this same copy is still being made and may yet land: wait a moment and look for the new itinerary before telling the user it failed, and do not copy again while it may appear. Never resend a write that may still land."
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
code: "limit-reached",
|
|
338
|
+
do: "The personal space is full. Say so and stop; do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
surfaces: ["authoring"]
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
capability: "authenticated",
|
|
345
|
+
confirms: false,
|
|
346
|
+
description: "Read the open itinerary: its segments, waypoints, and elevation summary. The narrowest read that answers the question.",
|
|
347
|
+
id: "studio.itinerary.getActive",
|
|
348
|
+
kind: "read",
|
|
349
|
+
recovery: [{
|
|
350
|
+
code: "not-found",
|
|
351
|
+
do: "No itinerary is open. Ask the user to open one rather than creating one uninvited."
|
|
352
|
+
}],
|
|
353
|
+
surfaces: ["core"]
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
capability: "editor",
|
|
357
|
+
confirms: false,
|
|
358
|
+
description: "Present a run of neighbouring segments as one named, coloured leg on the elevation profile. Not for actually joining the segments into one; that is studio.itinerary.segment.merge.",
|
|
359
|
+
id: "studio.itinerary.group.create",
|
|
360
|
+
kind: "mutate",
|
|
361
|
+
recovery: [
|
|
362
|
+
{
|
|
363
|
+
code: "draft-open",
|
|
364
|
+
do: "A proposal has no stored segments to group. Tell the user to save or discard the draft first, and stop."
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
code: "invalid-input",
|
|
368
|
+
do: "Re-read the itinerary, pick neighbours in chain order, and retry once."
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
code: "conflict",
|
|
372
|
+
do: "Re-read the itinerary. If the group you asked for is there, it landed: do not make it again. Otherwise tell the user which group holds the segment. Do not retry blind: edit or remove that group first, only if the user agrees. When no group holds it yet, wait a moment and re-read once more, since a conflict can mean the write is still being made. Never resend a write that may still land."
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
code: "collab-locked",
|
|
376
|
+
do: "Report who holds it and stop. Grouping is serialized to one editor at a time."
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
code: "not-found",
|
|
380
|
+
do: "Re-read the itinerary; the chain changed underneath you."
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
code: "upgrade-required",
|
|
384
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
385
|
+
}
|
|
386
|
+
],
|
|
387
|
+
surfaces: ["authoring"]
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
capability: "editor",
|
|
391
|
+
confirms: false,
|
|
392
|
+
description: "Dissolve a group so its segments read as separate legs again. Not for deleting segments. This removes a label; the route is untouched. Deleting a segment is its own verb.",
|
|
393
|
+
id: "studio.itinerary.group.delete",
|
|
394
|
+
kind: "mutate",
|
|
395
|
+
recovery: [
|
|
396
|
+
{
|
|
397
|
+
code: "draft-open",
|
|
398
|
+
do: "A proposal carries no stored groups. Tell the user to save or discard the draft first, and stop."
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
code: "collab-locked",
|
|
402
|
+
do: "Report who holds it and stop. Group edits are serialized to one editor at a time."
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
code: "conflict",
|
|
406
|
+
do: "Re-read the itinerary. If the group is gone, the dissolve landed: do not make it again. If it is still there, wait a moment and re-read once more, since a conflict can mean the write is still being made, and dissolve it again only if it remains. Never resend a write that may still land."
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
code: "not-found",
|
|
410
|
+
do: "Re-read the itinerary. It may already have been dissolved, including automatically, when a merge or a delete dropped its run below two segments."
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
code: "upgrade-required",
|
|
414
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
415
|
+
}
|
|
416
|
+
],
|
|
417
|
+
surfaces: ["authoring"]
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
capability: "editor",
|
|
421
|
+
confirms: false,
|
|
422
|
+
description: "Change which run of segments an existing group covers. Not for renaming or recolouring; that is studio.itinerary.group.update.",
|
|
423
|
+
id: "studio.itinerary.group.setRange",
|
|
424
|
+
kind: "mutate",
|
|
425
|
+
recovery: [
|
|
426
|
+
{
|
|
427
|
+
code: "draft-open",
|
|
428
|
+
do: "A proposal carries no stored groups. Tell the user to save or discard the draft first, and stop."
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
code: "invalid-input",
|
|
432
|
+
do: "Re-read the itinerary, rebuild the full membership in chain order, and retry once. If the user wanted the group gone, dissolve it instead."
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
code: "collab-locked",
|
|
436
|
+
do: "Report who holds it and stop. Group edits are serialized to one editor at a time."
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
code: "conflict",
|
|
440
|
+
do: "Re-read the itinerary. If the group already spans the run you sent, the change landed: do not make it again. Otherwise tell the user which group now holds the segment. Do not retry blind: the run they asked for may no longer be free. When no other group holds it, wait a moment and re-read once more, since a conflict can mean the write is still being made. Never resend a write that may still land."
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
code: "not-found",
|
|
444
|
+
do: "Re-read the itinerary; the chain changed underneath you."
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
code: "upgrade-required",
|
|
448
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
449
|
+
}
|
|
450
|
+
],
|
|
451
|
+
surfaces: ["authoring"]
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
capability: "editor",
|
|
455
|
+
confirms: false,
|
|
456
|
+
description: "Change what an existing group is called, what colour it paints, or the pace it is timed at. Not for changing which segments the group covers; that is studio.itinerary.group.setRange.",
|
|
457
|
+
id: "studio.itinerary.group.update",
|
|
458
|
+
kind: "mutate",
|
|
459
|
+
recovery: [
|
|
460
|
+
{
|
|
461
|
+
code: "draft-open",
|
|
462
|
+
do: "A proposal carries no stored groups. Tell the user to save or discard the draft first, and stop."
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
code: "invalid-input",
|
|
466
|
+
do: "Correct the field the message names and retry once. A speed of zero is not a pace; send null if the user wanted the override removed."
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
code: "collab-locked",
|
|
470
|
+
do: "Report who holds it and stop. Group edits are serialized to one editor at a time."
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
code: "conflict",
|
|
474
|
+
do: "Re-read the itinerary. If the group already reads as you asked, the change landed: do not make it again. If it does not, wait a moment and re-read once more, since a conflict can mean the write is still being made, then apply the user's change to the group as it stands now, and retry once. Never resend a write that may still land."
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
code: "not-found",
|
|
478
|
+
do: "Re-read the itinerary; it may have been dissolved underneath you."
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
code: "upgrade-required",
|
|
482
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
483
|
+
}
|
|
484
|
+
],
|
|
485
|
+
surfaces: ["authoring"]
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
capability: "editor",
|
|
489
|
+
confirms: false,
|
|
490
|
+
description: "Append a new routed segment to the end of the open itinerary, through 2–45 vias. Ask when they have not said which, and where. A wrong guess rewrites their work.",
|
|
491
|
+
id: "studio.itinerary.segment.create",
|
|
492
|
+
kind: "mutate",
|
|
493
|
+
recovery: [
|
|
494
|
+
{
|
|
495
|
+
code: "invalid-input",
|
|
496
|
+
do: "Coordinates are [longitude, latitude], longitude first. Simplify to the working range and retry once."
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
code: "conflict",
|
|
500
|
+
do: "Re-read the itinerary. If the segment you appended is there, the append landed: do not make it again. If it is not, wait a moment and re-read once more, since a conflict can mean the write is still being made, and rebuild the append against the current revision only if it is still absent. Never resend a write that may still land."
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
code: "collab-locked",
|
|
504
|
+
do: "Report who holds it and stop."
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
code: "upgrade-required",
|
|
508
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
509
|
+
}
|
|
510
|
+
],
|
|
511
|
+
surfaces: ["routing"]
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
capability: "editor",
|
|
515
|
+
confirms: false,
|
|
516
|
+
description: "Propose new via points for a segment, opening a live editable draft the user reviews and saves. Propose opens a draft the user saves. The agent never commits.",
|
|
517
|
+
id: "studio.itinerary.segment.editPropose",
|
|
518
|
+
kind: "propose",
|
|
519
|
+
recovery: [
|
|
520
|
+
{
|
|
521
|
+
code: "edit-in-progress",
|
|
522
|
+
do: "Read the live draft. Iterate on it rather than starting a new one."
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
code: "collab-locked",
|
|
526
|
+
do: "Report who holds it and stop. Retrying will not acquire the lock."
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
code: "conflict",
|
|
530
|
+
do: "Re-read the itinerary and rebuild the proposal against the current revision."
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
code: "invalid-input",
|
|
534
|
+
do: "Coordinates are [longitude, latitude], longitude first, and the cap is 45. Reduce to the working range of two to six and retry once."
|
|
535
|
+
}
|
|
536
|
+
],
|
|
537
|
+
surfaces: ["routing"]
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
capability: "editor",
|
|
541
|
+
confirms: false,
|
|
542
|
+
description: "Add a new segment INSIDE the chain, after a named segment or at the head, and renumber what follows. Ask when they have not said which, and where. A wrong guess rewrites their work.",
|
|
543
|
+
id: "studio.itinerary.segment.insert",
|
|
544
|
+
kind: "mutate",
|
|
545
|
+
recovery: [
|
|
546
|
+
{
|
|
547
|
+
code: "draft-open",
|
|
548
|
+
do: "A proposal has nothing to insert into. Tell the user to save or discard the draft first, and stop."
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
code: "invalid-input",
|
|
552
|
+
do: "Append with studio.itinerary.segment.create when the gap is at the end. Otherwise re-read the chain and retry once with a valid anchor."
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
code: "collab-locked",
|
|
556
|
+
do: "Report who holds it and stop."
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
code: "upgrade-required",
|
|
560
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
code: "forbidden",
|
|
564
|
+
do: "Report which organization refused the edit and stop. Nothing changed."
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
code: "conflict",
|
|
568
|
+
do: "Re-read the itinerary; the anchor you picked may have moved or gone. If the segment you inserted is there, the insert landed: do not make it again. If it is not, wait a moment and re-read once more, since a conflict can mean the write is still being made, and insert again only if it is still absent. Never resend a write that may still land."
|
|
569
|
+
}
|
|
570
|
+
],
|
|
571
|
+
surfaces: ["routing"]
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
capability: "editor",
|
|
575
|
+
confirms: true,
|
|
576
|
+
description: "Join a segment with the one that follows it, leaving a single segment in their place. Not for making two segments merely READ as one leg; that is studio.itinerary.group.create.",
|
|
577
|
+
id: "studio.itinerary.segment.merge",
|
|
578
|
+
kind: "mutate",
|
|
579
|
+
recovery: [
|
|
580
|
+
{
|
|
581
|
+
code: "draft-open",
|
|
582
|
+
do: "A proposal has no stored segments to join. Tell the user to save or discard the draft first, and stop."
|
|
583
|
+
},
|
|
584
|
+
{
|
|
585
|
+
code: "invalid-input",
|
|
586
|
+
do: "Nothing was changed. The refusal states the limit the two segments pass together, such as the 45 waypoints of a routed merge or the 10,000 positions of a freehand one. Report it and stop; do not thin the user's via points or line to make the merge fit."
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
code: "collab-locked",
|
|
590
|
+
do: "Report who holds it and stop. Both segments must be free to merge."
|
|
591
|
+
},
|
|
592
|
+
{
|
|
593
|
+
code: "conflict",
|
|
594
|
+
do: "Re-read the itinerary. If the two segments are already one, the merge landed: do not make it again. Otherwise check the segment is not last, that both use the same engine and belong to the same group or to none, and re-decide which pair the user meant before retrying once. When nothing in the itinerary explains the refusal, wait a moment and re-read first, since a conflict can mean the write is still being made. Never resend a write that may still land."
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
code: "upgrade-required",
|
|
598
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
599
|
+
}
|
|
600
|
+
],
|
|
601
|
+
surfaces: ["routing"]
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
capability: "editor",
|
|
605
|
+
confirms: true,
|
|
606
|
+
description: "Switch one segment between following the trail network and following the line as drawn. Not for making the route take a different path; that is studio.itinerary.segment.editPropose.",
|
|
607
|
+
id: "studio.itinerary.segment.setMode",
|
|
608
|
+
kind: "mutate",
|
|
609
|
+
recovery: [
|
|
610
|
+
{
|
|
611
|
+
code: "draft-open",
|
|
612
|
+
do: "A proposal has no stored segment whose engine could change. Tell the user to save or discard the draft first, and stop."
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
code: "invalid-input",
|
|
616
|
+
do: "Nothing was written. When the refusal names the engine the segment already uses, there is nothing to change: say so. Otherwise report that the line cannot be routed and leave the segment freehand. Do not retry the same call."
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
code: "collab-locked",
|
|
620
|
+
do: "Report who holds it and stop."
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
code: "conflict",
|
|
624
|
+
do: "Re-read the itinerary. If the segment already uses the engine you asked for, the switch landed: do not make it again. If it does not, wait a moment and re-read once more, since a conflict can mean the write is still being made, and switch again only if it is still unchanged. Never resend a write that may still land."
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
code: "internal",
|
|
628
|
+
do: "The segment is unchanged. Report the failure and retry once at most."
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
code: "upgrade-required",
|
|
632
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
633
|
+
}
|
|
634
|
+
],
|
|
635
|
+
surfaces: ["routing"]
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
capability: "editor",
|
|
639
|
+
confirms: true,
|
|
640
|
+
description: "Cut one segment in two at a point along its length, given as a fraction of that length. Not for making the route go somewhere else; that is studio.itinerary.segment.editPropose.",
|
|
641
|
+
id: "studio.itinerary.segment.split",
|
|
642
|
+
kind: "mutate",
|
|
643
|
+
recovery: [
|
|
644
|
+
{
|
|
645
|
+
code: "draft-open",
|
|
646
|
+
do: "A proposal has no stored segment to cut. Tell the user to save or discard the draft first, and stop."
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
code: "invalid-input",
|
|
650
|
+
do: "Pick a point further from both ends and retry once."
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
code: "collab-locked",
|
|
654
|
+
do: "Report who holds it and stop."
|
|
655
|
+
},
|
|
656
|
+
{
|
|
657
|
+
code: "upgrade-required",
|
|
658
|
+
do: "This organization's agreement does not include this action. Say so and stop. Do not retry, and do not copy the itinerary elsewhere unless the user asks."
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
code: "forbidden",
|
|
662
|
+
do: "Report which organization refused the edit and stop. Nothing changed."
|
|
663
|
+
},
|
|
664
|
+
{
|
|
665
|
+
code: "conflict",
|
|
666
|
+
do: "Re-read the itinerary; the length you based the fraction on may have changed. If the segment is already split where you asked, the split landed: do not make it again. If it is not, wait a moment and re-read once more, since a conflict can mean the write is still being made, and split again only if it is still whole. Never resend a write that may still land."
|
|
667
|
+
}
|
|
668
|
+
],
|
|
669
|
+
surfaces: ["routing"]
|
|
670
|
+
},
|
|
671
|
+
{
|
|
672
|
+
capability: "editor",
|
|
673
|
+
confirms: false,
|
|
674
|
+
description: "Write a segment's geometry directly, the path a human drag-and-drop takes. Propose opens a draft the user saves. The agent never commits.",
|
|
675
|
+
id: "studio.itinerary.segment.updateGeometry",
|
|
676
|
+
kind: "mutate",
|
|
677
|
+
recovery: [{
|
|
678
|
+
code: "capability-denied",
|
|
679
|
+
do: "Expected. Propose the edit instead."
|
|
680
|
+
}],
|
|
681
|
+
surfaces: ["routing"]
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
capability: "authenticated",
|
|
685
|
+
confirms: false,
|
|
686
|
+
description: "Read the map viewport: centre, zoom, bearing, and pitch. The narrowest read that answers the question.",
|
|
687
|
+
id: "studio.map.getView",
|
|
688
|
+
kind: "read",
|
|
689
|
+
recovery: [{
|
|
690
|
+
code: "internal",
|
|
691
|
+
do: "The map is not ready. Proceed without it and bound your work by the itinerary instead."
|
|
692
|
+
}],
|
|
693
|
+
surfaces: ["core"]
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
capability: "authenticated",
|
|
697
|
+
confirms: false,
|
|
698
|
+
description: "List the overlays the scope in view can draw, with their kind and category. You already listed them in this run and the scope has not moved since.",
|
|
699
|
+
id: "studio.overlay.listAvailable",
|
|
700
|
+
kind: "read",
|
|
701
|
+
recovery: [{
|
|
702
|
+
code: "internal",
|
|
703
|
+
do: "Proceed without the catalog and let studio.overlay.set report not-found for an identifier that does not exist, rather than blocking the task."
|
|
704
|
+
}],
|
|
705
|
+
surfaces: ["terrain"]
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
capability: "embedding",
|
|
709
|
+
confirms: false,
|
|
710
|
+
description: "Show or hide a raster overlay on the map for the user to look at. Overlays are for the user's eyes. Numbers come from sampling, never from a visual.",
|
|
711
|
+
id: "studio.overlay.set",
|
|
712
|
+
kind: "mutate",
|
|
713
|
+
recovery: [
|
|
714
|
+
{
|
|
715
|
+
code: "invalid-input",
|
|
716
|
+
do: "Call studio.overlay.listAvailable and pick from the catalog it returns."
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
code: "capability-denied",
|
|
720
|
+
do: "The caller cannot change overlays. Report what you found in words instead."
|
|
721
|
+
},
|
|
722
|
+
{
|
|
723
|
+
code: "upgrade-required",
|
|
724
|
+
do: "Report what you found in words instead, and say overlays are not available in this scope. Do not retry."
|
|
725
|
+
}
|
|
726
|
+
],
|
|
727
|
+
surfaces: ["terrain"]
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
capability: "authenticated",
|
|
731
|
+
confirms: false,
|
|
732
|
+
description: "Read what is currently selected. The narrowest read that answers the question.",
|
|
733
|
+
id: "studio.selection.get",
|
|
734
|
+
kind: "read",
|
|
735
|
+
recovery: [{
|
|
736
|
+
code: "capability-denied",
|
|
737
|
+
do: "The caller cannot read the studio. Ask the user what they meant instead."
|
|
738
|
+
}],
|
|
739
|
+
surfaces: ["core"]
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
capability: "authenticated",
|
|
743
|
+
confirms: false,
|
|
744
|
+
description: "Open the share-link dialog for one itinerary or one collection, named by its kind and id. Not for the map running inside a page of their own. That is the embed wizard, not a link.",
|
|
745
|
+
id: "studio.share.open",
|
|
746
|
+
kind: "navigate",
|
|
747
|
+
recovery: [
|
|
748
|
+
{
|
|
749
|
+
code: "forbidden",
|
|
750
|
+
do: "Report why rather than retrying. There is no second route to a link."
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
code: "not-found",
|
|
754
|
+
do: "Re-read the itineraries or collections the user can see and confirm which one they meant."
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
code: "capability-denied",
|
|
758
|
+
do: "The caller cannot open studio dialogs. Say the link has to be made from the studio."
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
surfaces: ["sharing", "collections"]
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
capability: "authenticated",
|
|
765
|
+
confirms: false,
|
|
766
|
+
description: "Read the whole studio state: itinerary, open zone, selection, open edit draft, overlays, viewport, preferences. The narrowest read that answers the question.",
|
|
767
|
+
id: "studio.state.get",
|
|
768
|
+
kind: "read",
|
|
769
|
+
recovery: [{
|
|
770
|
+
code: "internal",
|
|
771
|
+
do: "Fall back to the narrow reads (selection, viewport, active itinerary) and proceed with what you can establish."
|
|
772
|
+
}],
|
|
773
|
+
surfaces: ["core"]
|
|
774
|
+
},
|
|
775
|
+
{
|
|
776
|
+
confirms: false,
|
|
777
|
+
description: "Propose candidate routes matching activity, distance, and ascent constraints. Named place, free text, category, or \"propose me something\".",
|
|
778
|
+
id: "suggestions",
|
|
779
|
+
kind: "read",
|
|
780
|
+
recovery: [
|
|
781
|
+
{
|
|
782
|
+
code: "not-found",
|
|
783
|
+
do: "No candidates fit. Loosen the tightest constraint once, then report that the ask is too narrow."
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
code: "invalid-input",
|
|
787
|
+
do: "A real answer, not a failure. Try a different start point once; if it repeats, say the area cannot be suggested from there and offer to draw the route with directions instead, which the user can take across it knowingly."
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
code: "upgrade-required",
|
|
791
|
+
do: "The organization does not hold the Data API. Say so; do not retry."
|
|
792
|
+
}
|
|
793
|
+
],
|
|
794
|
+
surfaces: ["discovery"]
|
|
795
|
+
},
|
|
796
|
+
{
|
|
797
|
+
confirms: false,
|
|
798
|
+
description: "Sample elevation, slope and aspect over a rectangular grid of the DEM. A few known points, along a known line, or over an unknown area.",
|
|
799
|
+
id: "terrainGrid",
|
|
800
|
+
kind: "read",
|
|
801
|
+
recovery: [
|
|
802
|
+
{
|
|
803
|
+
code: "invalid-input",
|
|
804
|
+
do: "The box may cover at most 100 km²: shrink it around the feature, about 10 km a side, rather than reusing the view bounds; resolution does not change the area. Keep cols and rows between 2 and 64, then retry once."
|
|
805
|
+
},
|
|
806
|
+
{
|
|
807
|
+
code: "rate-limited",
|
|
808
|
+
do: "Stop sampling. Report what you already have rather than waiting."
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
code: "upgrade-required",
|
|
812
|
+
do: "The organization does not hold the Data API. Say so; do not retry."
|
|
813
|
+
}
|
|
814
|
+
],
|
|
815
|
+
surfaces: ["terrain"]
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
confirms: false,
|
|
819
|
+
description: "Sample the surface at a fixed interval along a geometry. A few known points, along a known line, or over an unknown area.",
|
|
820
|
+
id: "terrainProfile",
|
|
821
|
+
kind: "read",
|
|
822
|
+
recovery: [{
|
|
823
|
+
code: "invalid-input",
|
|
824
|
+
do: "Coordinates are [longitude, latitude] pairs, longitude first. A saved segment's positions carry an altitude, and a routed one is a GeometryCollection: take its LineString, drop the altitude, and retry once with spacing at the default."
|
|
825
|
+
}, {
|
|
826
|
+
code: "rate-limited",
|
|
827
|
+
do: "Stop sampling. Report what you already have rather than waiting."
|
|
828
|
+
}],
|
|
829
|
+
surfaces: ["terrain"]
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
confirms: false,
|
|
833
|
+
description: "Sample elevation, slope, and aspect at specific coordinates. A few known points, along a known line, or over an unknown area.",
|
|
834
|
+
id: "terrainSamples",
|
|
835
|
+
kind: "read",
|
|
836
|
+
recovery: [{
|
|
837
|
+
code: "invalid-input",
|
|
838
|
+
do: "Coordinates are [longitude, latitude], longitude first. Split the batch and retry once."
|
|
839
|
+
}, {
|
|
840
|
+
code: "upgrade-required",
|
|
841
|
+
do: "The organization does not hold the Data API. Say so; do not retry."
|
|
842
|
+
}],
|
|
843
|
+
surfaces: ["terrain"]
|
|
844
|
+
}
|
|
845
|
+
];
|
|
846
|
+
const SURFACES = [
|
|
847
|
+
{
|
|
848
|
+
always: true,
|
|
849
|
+
id: "core",
|
|
850
|
+
keywords: [],
|
|
851
|
+
members: [
|
|
852
|
+
"studio.alert.dismiss",
|
|
853
|
+
"studio.alert.show",
|
|
854
|
+
"studio.itinerary.getActive",
|
|
855
|
+
"studio.map.applyCamera",
|
|
856
|
+
"studio.map.fitBounds",
|
|
857
|
+
"studio.map.fitBoundsOrFly",
|
|
858
|
+
"studio.map.fitBoundsToSegment",
|
|
859
|
+
"studio.map.getView",
|
|
860
|
+
"studio.map.resetNorth",
|
|
861
|
+
"studio.map.zoomIn",
|
|
862
|
+
"studio.map.zoomOut",
|
|
863
|
+
"studio.overlay.getActive",
|
|
864
|
+
"studio.panel.close",
|
|
865
|
+
"studio.panel.toggle",
|
|
866
|
+
"studio.preferences.set",
|
|
867
|
+
"studio.question.ask",
|
|
868
|
+
"studio.selection.get",
|
|
869
|
+
"studio.sidenav.back",
|
|
870
|
+
"studio.state.get",
|
|
871
|
+
"studio.tabs.close",
|
|
872
|
+
"studio.tabs.create",
|
|
873
|
+
"studio.tabs.open",
|
|
874
|
+
"studio.tabs.switch"
|
|
875
|
+
],
|
|
876
|
+
purpose: "Read the world, move the map, talk to the user. Needed by every run.",
|
|
877
|
+
title: "Core",
|
|
878
|
+
wideFallback: true
|
|
879
|
+
},
|
|
880
|
+
{
|
|
881
|
+
always: false,
|
|
882
|
+
id: "routing",
|
|
883
|
+
keywords: [
|
|
884
|
+
"reroute",
|
|
885
|
+
"via",
|
|
886
|
+
"waypoint order",
|
|
887
|
+
"steeper",
|
|
888
|
+
"flatter",
|
|
889
|
+
"avoid",
|
|
890
|
+
"detour",
|
|
891
|
+
"shorter",
|
|
892
|
+
"longer",
|
|
893
|
+
"how long",
|
|
894
|
+
"compare",
|
|
895
|
+
"split",
|
|
896
|
+
"cut",
|
|
897
|
+
"merge",
|
|
898
|
+
"join",
|
|
899
|
+
"insert",
|
|
900
|
+
"freehand",
|
|
901
|
+
"routed",
|
|
902
|
+
"engine",
|
|
903
|
+
"évite",
|
|
904
|
+
"éviter",
|
|
905
|
+
"contourne",
|
|
906
|
+
"contourner",
|
|
907
|
+
"détour",
|
|
908
|
+
"passe par",
|
|
909
|
+
"passer par",
|
|
910
|
+
"plus court",
|
|
911
|
+
"plus courte",
|
|
912
|
+
"plus long",
|
|
913
|
+
"plus longue",
|
|
914
|
+
"plus raide",
|
|
915
|
+
"moins raide",
|
|
916
|
+
"raccourci",
|
|
917
|
+
"tracé",
|
|
918
|
+
"couper",
|
|
919
|
+
"scinder",
|
|
920
|
+
"fusionner",
|
|
921
|
+
"joindre",
|
|
922
|
+
"insérer",
|
|
923
|
+
"tracé libre",
|
|
924
|
+
"moteur"
|
|
925
|
+
],
|
|
926
|
+
members: [
|
|
927
|
+
"analyzeGeometry",
|
|
928
|
+
"directions.compute",
|
|
929
|
+
"matrix",
|
|
930
|
+
"studio.itinerary.directions.close",
|
|
931
|
+
"studio.itinerary.directions.open",
|
|
932
|
+
"studio.itinerary.segment.create",
|
|
933
|
+
"studio.itinerary.segment.editBegin",
|
|
934
|
+
"studio.itinerary.segment.editCancel",
|
|
935
|
+
"studio.itinerary.segment.editCommit",
|
|
936
|
+
"studio.itinerary.segment.editPropose",
|
|
937
|
+
"studio.itinerary.segment.editRedo",
|
|
938
|
+
"studio.itinerary.segment.editUndo",
|
|
939
|
+
"studio.itinerary.segment.insert",
|
|
940
|
+
"studio.itinerary.segment.insertBegin",
|
|
941
|
+
"studio.itinerary.segment.merge",
|
|
942
|
+
"studio.itinerary.segment.recolor",
|
|
943
|
+
"studio.itinerary.segment.remove",
|
|
944
|
+
"studio.itinerary.segment.rename",
|
|
945
|
+
"studio.itinerary.segment.roadAccessClose",
|
|
946
|
+
"studio.itinerary.segment.roadAccessOpen",
|
|
947
|
+
"studio.itinerary.segment.select",
|
|
948
|
+
"studio.itinerary.segment.setMode",
|
|
949
|
+
"studio.itinerary.segment.setSpeed",
|
|
950
|
+
"studio.itinerary.segment.split",
|
|
951
|
+
"studio.itinerary.segment.splitPickBegin",
|
|
952
|
+
"studio.itinerary.segment.splitPickCancel",
|
|
953
|
+
"studio.itinerary.segment.splitPickSet",
|
|
954
|
+
"studio.itinerary.segment.updateGeometry",
|
|
955
|
+
"studio.itinerary.segment.via.promptClose",
|
|
956
|
+
"studio.itinerary.segment.via.promptOpen",
|
|
957
|
+
"studio.itinerary.segment.via.remove",
|
|
958
|
+
"studio.itinerary.segment.via.repeat",
|
|
959
|
+
"studio.segment.length",
|
|
960
|
+
"studio.segment.pointAtFraction"
|
|
961
|
+
],
|
|
962
|
+
purpose: "Change the geometry of an existing route by proposing vias for the user to save.",
|
|
963
|
+
title: "Segment routing and editing",
|
|
964
|
+
wideFallback: true
|
|
965
|
+
},
|
|
966
|
+
{
|
|
967
|
+
always: false,
|
|
968
|
+
id: "terrain",
|
|
969
|
+
keywords: [
|
|
970
|
+
"elevation",
|
|
971
|
+
"slope",
|
|
972
|
+
"aspect",
|
|
973
|
+
"steep",
|
|
974
|
+
"north face",
|
|
975
|
+
"hillshade",
|
|
976
|
+
"snow",
|
|
977
|
+
"weather",
|
|
978
|
+
"overlay",
|
|
979
|
+
"altitude",
|
|
980
|
+
"dénivelé",
|
|
981
|
+
"pente",
|
|
982
|
+
"orientation",
|
|
983
|
+
"exposition",
|
|
984
|
+
"raide",
|
|
985
|
+
"versant",
|
|
986
|
+
"face nord",
|
|
987
|
+
"relief",
|
|
988
|
+
"ombrage",
|
|
989
|
+
"neige",
|
|
990
|
+
"météo",
|
|
991
|
+
"vent",
|
|
992
|
+
"calque",
|
|
993
|
+
"couche"
|
|
994
|
+
],
|
|
995
|
+
members: [
|
|
996
|
+
"studio.itinerary.profile.sheet.set",
|
|
997
|
+
"studio.itinerary.profileMarker.set",
|
|
998
|
+
"studio.overlay.category.set",
|
|
999
|
+
"studio.overlay.enrichment.set",
|
|
1000
|
+
"studio.overlay.listAvailable",
|
|
1001
|
+
"studio.overlay.pois.display.set",
|
|
1002
|
+
"studio.overlay.pois.group.set",
|
|
1003
|
+
"studio.overlay.sampleAlongSegment",
|
|
1004
|
+
"studio.overlay.sampleAt",
|
|
1005
|
+
"studio.overlay.set",
|
|
1006
|
+
"studio.overlay.timestamp.set",
|
|
1007
|
+
"studio.terrain.set",
|
|
1008
|
+
"terrainGrid",
|
|
1009
|
+
"terrainProfile",
|
|
1010
|
+
"terrainSamples"
|
|
1011
|
+
],
|
|
1012
|
+
purpose: "Measure the surface (elevation, slope, aspect) and control what the user sees on it.",
|
|
1013
|
+
title: "Terrain and overlays",
|
|
1014
|
+
wideFallback: true
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
always: false,
|
|
1018
|
+
id: "authoring",
|
|
1019
|
+
keywords: [
|
|
1020
|
+
"create",
|
|
1021
|
+
"copy",
|
|
1022
|
+
"duplicate",
|
|
1023
|
+
"rename",
|
|
1024
|
+
"delete",
|
|
1025
|
+
"colour",
|
|
1026
|
+
"icon",
|
|
1027
|
+
"emphasis",
|
|
1028
|
+
"waypoint",
|
|
1029
|
+
"name it",
|
|
1030
|
+
"group",
|
|
1031
|
+
"stage",
|
|
1032
|
+
"leg",
|
|
1033
|
+
"crée",
|
|
1034
|
+
"créer",
|
|
1035
|
+
"copie",
|
|
1036
|
+
"copier",
|
|
1037
|
+
"dupliquer",
|
|
1038
|
+
"renomme",
|
|
1039
|
+
"renommer",
|
|
1040
|
+
"supprime",
|
|
1041
|
+
"supprimer",
|
|
1042
|
+
"couleur",
|
|
1043
|
+
"icône",
|
|
1044
|
+
"étape",
|
|
1045
|
+
"point de passage",
|
|
1046
|
+
"groupe",
|
|
1047
|
+
"grouper"
|
|
1048
|
+
],
|
|
1049
|
+
members: [
|
|
1050
|
+
"itinerary.get",
|
|
1051
|
+
"studio.itinerary.activate",
|
|
1052
|
+
"studio.itinerary.create",
|
|
1053
|
+
"studio.itinerary.createOpen",
|
|
1054
|
+
"studio.itinerary.delete",
|
|
1055
|
+
"studio.itinerary.duplicate",
|
|
1056
|
+
"studio.itinerary.emphasis.set",
|
|
1057
|
+
"studio.itinerary.exclusions.set",
|
|
1058
|
+
"studio.itinerary.group.create",
|
|
1059
|
+
"studio.itinerary.group.delete",
|
|
1060
|
+
"studio.itinerary.group.modal.close",
|
|
1061
|
+
"studio.itinerary.group.modal.open",
|
|
1062
|
+
"studio.itinerary.group.setRange",
|
|
1063
|
+
"studio.itinerary.group.update",
|
|
1064
|
+
"studio.itinerary.openForEdit",
|
|
1065
|
+
"studio.itinerary.rename",
|
|
1066
|
+
"studio.itinerary.tiles.refresh",
|
|
1067
|
+
"studio.itinerary.update",
|
|
1068
|
+
"studio.itinerary.waypoint.create",
|
|
1069
|
+
"studio.itinerary.waypoint.detailsClose",
|
|
1070
|
+
"studio.itinerary.waypoint.detailsOpen",
|
|
1071
|
+
"studio.itinerary.waypoint.editBegin",
|
|
1072
|
+
"studio.itinerary.waypoint.editCancel",
|
|
1073
|
+
"studio.itinerary.waypoint.editCommit",
|
|
1074
|
+
"studio.itinerary.waypoint.editPropose",
|
|
1075
|
+
"studio.itinerary.waypoint.editRedo",
|
|
1076
|
+
"studio.itinerary.waypoint.editSetColor",
|
|
1077
|
+
"studio.itinerary.waypoint.editSetIcon",
|
|
1078
|
+
"studio.itinerary.waypoint.editSetName",
|
|
1079
|
+
"studio.itinerary.waypoint.editSetPosition",
|
|
1080
|
+
"studio.itinerary.waypoint.editUndo",
|
|
1081
|
+
"studio.itinerary.waypoint.recolor",
|
|
1082
|
+
"studio.itinerary.waypoint.remove",
|
|
1083
|
+
"studio.itinerary.waypoint.rename",
|
|
1084
|
+
"studio.itinerary.waypoint.select",
|
|
1085
|
+
"studio.itinerary.waypoint.setDetails",
|
|
1086
|
+
"studio.itinerary.waypoint.setIcon"
|
|
1087
|
+
],
|
|
1088
|
+
purpose: "Create, copy, rename, restyle, and delete itineraries, their waypoints, and their segment groups.",
|
|
1089
|
+
title: "Itinerary authoring",
|
|
1090
|
+
wideFallback: true
|
|
1091
|
+
},
|
|
1092
|
+
{
|
|
1093
|
+
always: false,
|
|
1094
|
+
id: "discovery",
|
|
1095
|
+
keywords: [
|
|
1096
|
+
"find",
|
|
1097
|
+
"near",
|
|
1098
|
+
"where is",
|
|
1099
|
+
"hut",
|
|
1100
|
+
"peak",
|
|
1101
|
+
"parking",
|
|
1102
|
+
"suggest",
|
|
1103
|
+
"propose a route",
|
|
1104
|
+
"plan a route",
|
|
1105
|
+
"plan me a route",
|
|
1106
|
+
"loop",
|
|
1107
|
+
"plan",
|
|
1108
|
+
"target",
|
|
1109
|
+
"ascent",
|
|
1110
|
+
"km",
|
|
1111
|
+
"options",
|
|
1112
|
+
"trouve",
|
|
1113
|
+
"trouver",
|
|
1114
|
+
"cherche",
|
|
1115
|
+
"chercher",
|
|
1116
|
+
"près de",
|
|
1117
|
+
"autour de",
|
|
1118
|
+
"où est",
|
|
1119
|
+
"refuge",
|
|
1120
|
+
"sommet",
|
|
1121
|
+
"col",
|
|
1122
|
+
"boucle",
|
|
1123
|
+
"suggère",
|
|
1124
|
+
"suggérer",
|
|
1125
|
+
"propose",
|
|
1126
|
+
"proposer",
|
|
1127
|
+
"planifie",
|
|
1128
|
+
"planifier",
|
|
1129
|
+
"génère",
|
|
1130
|
+
"générer",
|
|
1131
|
+
"objectif",
|
|
1132
|
+
"ascension",
|
|
1133
|
+
"montée"
|
|
1134
|
+
],
|
|
1135
|
+
members: [
|
|
1136
|
+
"studio.contextmenu.close",
|
|
1137
|
+
"studio.contextmenu.open",
|
|
1138
|
+
"studio.data.geocode",
|
|
1139
|
+
"studio.data.pois",
|
|
1140
|
+
"studio.data.reverseGeocode",
|
|
1141
|
+
"studio.data.search",
|
|
1142
|
+
"studio.geolocate.confirm",
|
|
1143
|
+
"studio.geolocate.prompt.close",
|
|
1144
|
+
"studio.geolocate.prompt.open",
|
|
1145
|
+
"studio.itinerary.suggest.applyCandidate",
|
|
1146
|
+
"studio.itinerary.suggest.beginPick",
|
|
1147
|
+
"studio.itinerary.suggest.cancelPick",
|
|
1148
|
+
"studio.itinerary.suggest.clearDraft",
|
|
1149
|
+
"studio.itinerary.suggest.commit",
|
|
1150
|
+
"studio.itinerary.suggest.discard",
|
|
1151
|
+
"studio.itinerary.suggest.generate",
|
|
1152
|
+
"studio.itinerary.suggest.select",
|
|
1153
|
+
"studio.itinerary.suggest.setActivity",
|
|
1154
|
+
"studio.itinerary.suggest.setAscent",
|
|
1155
|
+
"studio.itinerary.suggest.setCollections",
|
|
1156
|
+
"studio.itinerary.suggest.setDistance",
|
|
1157
|
+
"studio.itinerary.suggest.setEnd",
|
|
1158
|
+
"studio.itinerary.suggest.setName",
|
|
1159
|
+
"studio.itinerary.suggest.setOrganization",
|
|
1160
|
+
"studio.itinerary.suggest.setPrivate",
|
|
1161
|
+
"studio.itinerary.suggest.setRouteType",
|
|
1162
|
+
"studio.itinerary.suggest.setSpeed",
|
|
1163
|
+
"studio.itinerary.suggest.setStart",
|
|
1164
|
+
"studio.itinerary.suggest.startFrom",
|
|
1165
|
+
"studio.itinerary.suggest.toggleKeep",
|
|
1166
|
+
"studio.itinerary.suggestOpen",
|
|
1167
|
+
"studio.map.locate",
|
|
1168
|
+
"suggestions"
|
|
1169
|
+
],
|
|
1170
|
+
purpose: "Find a place, a point of interest, or a candidate route to start from.",
|
|
1171
|
+
title: "Places and route discovery",
|
|
1172
|
+
wideFallback: true
|
|
1173
|
+
},
|
|
1174
|
+
{
|
|
1175
|
+
always: false,
|
|
1176
|
+
id: "zones",
|
|
1177
|
+
keywords: [
|
|
1178
|
+
"zone",
|
|
1179
|
+
"area",
|
|
1180
|
+
"reachability",
|
|
1181
|
+
"isochrone",
|
|
1182
|
+
"hazard",
|
|
1183
|
+
"perimeter",
|
|
1184
|
+
"sector",
|
|
1185
|
+
"radius",
|
|
1186
|
+
"how far can I get",
|
|
1187
|
+
"reachable",
|
|
1188
|
+
"secteur",
|
|
1189
|
+
"périmètre",
|
|
1190
|
+
"rayon",
|
|
1191
|
+
"accessible",
|
|
1192
|
+
"danger"
|
|
1193
|
+
],
|
|
1194
|
+
members: [
|
|
1195
|
+
"isochrones",
|
|
1196
|
+
"studio.zone.beginOriginPick",
|
|
1197
|
+
"studio.zone.cancelOriginPick",
|
|
1198
|
+
"studio.zone.create",
|
|
1199
|
+
"studio.zone.createBegin",
|
|
1200
|
+
"studio.zone.delete",
|
|
1201
|
+
"studio.zone.editBegin",
|
|
1202
|
+
"studio.zone.editCancel",
|
|
1203
|
+
"studio.zone.editCommit",
|
|
1204
|
+
"studio.zone.editPropose",
|
|
1205
|
+
"studio.zone.editRedo",
|
|
1206
|
+
"studio.zone.editUndo",
|
|
1207
|
+
"studio.zone.open",
|
|
1208
|
+
"studio.zone.openForEdit",
|
|
1209
|
+
"studio.zone.openForView",
|
|
1210
|
+
"studio.zone.publish",
|
|
1211
|
+
"studio.zone.reachabilityPreview",
|
|
1212
|
+
"studio.zone.recompute",
|
|
1213
|
+
"studio.zone.setCreateMethod",
|
|
1214
|
+
"studio.zone.setLevel",
|
|
1215
|
+
"studio.zone.setOrigin",
|
|
1216
|
+
"studio.zone.unpublish",
|
|
1217
|
+
"studio.zone.update"
|
|
1218
|
+
],
|
|
1219
|
+
purpose: "Draw and maintain zones, the map areas marking reachability, hazard, or interest.",
|
|
1220
|
+
title: "Zones",
|
|
1221
|
+
wideFallback: true
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
always: false,
|
|
1225
|
+
id: "collections",
|
|
1226
|
+
keywords: [
|
|
1227
|
+
"collection",
|
|
1228
|
+
"group",
|
|
1229
|
+
"folder",
|
|
1230
|
+
"add to",
|
|
1231
|
+
"organize",
|
|
1232
|
+
"tidy up",
|
|
1233
|
+
"groupe",
|
|
1234
|
+
"dossier",
|
|
1235
|
+
"ajoute à",
|
|
1236
|
+
"ajouter à",
|
|
1237
|
+
"range",
|
|
1238
|
+
"ranger",
|
|
1239
|
+
"organise",
|
|
1240
|
+
"organiser"
|
|
1241
|
+
],
|
|
1242
|
+
members: [
|
|
1243
|
+
"studio.collection.addItinerary",
|
|
1244
|
+
"studio.collection.addZone",
|
|
1245
|
+
"studio.collection.create",
|
|
1246
|
+
"studio.collection.createClose",
|
|
1247
|
+
"studio.collection.createOpen",
|
|
1248
|
+
"studio.collection.delete",
|
|
1249
|
+
"studio.collection.editClose",
|
|
1250
|
+
"studio.collection.editOpen",
|
|
1251
|
+
"studio.collection.manage.close",
|
|
1252
|
+
"studio.collection.manage.open",
|
|
1253
|
+
"studio.collection.openForEdit",
|
|
1254
|
+
"studio.collection.removeItinerary",
|
|
1255
|
+
"studio.collection.removeZone",
|
|
1256
|
+
"studio.collection.reorderItinerary",
|
|
1257
|
+
"studio.collection.update",
|
|
1258
|
+
"studio.share.close",
|
|
1259
|
+
"studio.share.open"
|
|
1260
|
+
],
|
|
1261
|
+
purpose: "Group itineraries and zones into a folder the whole organization shares.",
|
|
1262
|
+
title: "Collections",
|
|
1263
|
+
wideFallback: true
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
always: false,
|
|
1267
|
+
id: "import",
|
|
1268
|
+
keywords: [
|
|
1269
|
+
"import",
|
|
1270
|
+
"GPX",
|
|
1271
|
+
"upload",
|
|
1272
|
+
"from Strava",
|
|
1273
|
+
"from Garmin",
|
|
1274
|
+
"from a file",
|
|
1275
|
+
"importe",
|
|
1276
|
+
"importer",
|
|
1277
|
+
"téléverse",
|
|
1278
|
+
"téléverser",
|
|
1279
|
+
"depuis un fichier",
|
|
1280
|
+
"depuis strava",
|
|
1281
|
+
"depuis garmin"
|
|
1282
|
+
],
|
|
1283
|
+
members: [
|
|
1284
|
+
"studio.itinerary.import.clearDraft",
|
|
1285
|
+
"studio.itinerary.import.confirm",
|
|
1286
|
+
"studio.itinerary.import.discard",
|
|
1287
|
+
"studio.itinerary.import.open",
|
|
1288
|
+
"studio.itinerary.import.setActivity",
|
|
1289
|
+
"studio.itinerary.import.setCollections",
|
|
1290
|
+
"studio.itinerary.import.setGranularity",
|
|
1291
|
+
"studio.itinerary.import.setName",
|
|
1292
|
+
"studio.itinerary.import.setOrganization",
|
|
1293
|
+
"studio.itinerary.import.setPrivate",
|
|
1294
|
+
"studio.itinerary.import.setProvider",
|
|
1295
|
+
"studio.itinerary.import.setSegmentModes",
|
|
1296
|
+
"studio.itinerary.import.submitPreview",
|
|
1297
|
+
"studio.itinerary.import.toggleMode"
|
|
1298
|
+
],
|
|
1299
|
+
purpose: "Bring an external track into the studio and reconcile it before saving.",
|
|
1300
|
+
title: "Import",
|
|
1301
|
+
wideFallback: true
|
|
1302
|
+
},
|
|
1303
|
+
{
|
|
1304
|
+
always: false,
|
|
1305
|
+
id: "sharing",
|
|
1306
|
+
keywords: [
|
|
1307
|
+
"export",
|
|
1308
|
+
"GPX",
|
|
1309
|
+
"download",
|
|
1310
|
+
"share",
|
|
1311
|
+
"link",
|
|
1312
|
+
"embed",
|
|
1313
|
+
"iframe",
|
|
1314
|
+
"exporte",
|
|
1315
|
+
"exporter",
|
|
1316
|
+
"télécharge",
|
|
1317
|
+
"télécharger",
|
|
1318
|
+
"partage",
|
|
1319
|
+
"partager",
|
|
1320
|
+
"lien",
|
|
1321
|
+
"intégration"
|
|
1322
|
+
],
|
|
1323
|
+
members: [
|
|
1324
|
+
"studio.embed.close",
|
|
1325
|
+
"studio.embed.open",
|
|
1326
|
+
"studio.itinerary.export",
|
|
1327
|
+
"studio.itinerary.export.close",
|
|
1328
|
+
"studio.itinerary.export.open",
|
|
1329
|
+
"studio.share.close",
|
|
1330
|
+
"studio.share.open"
|
|
1331
|
+
],
|
|
1332
|
+
purpose: "Get an itinerary or a collection out of the studio, as a file, a link, or an embedded map.",
|
|
1333
|
+
title: "Export, share, and embed",
|
|
1334
|
+
wideFallback: true
|
|
1335
|
+
},
|
|
1336
|
+
{
|
|
1337
|
+
always: false,
|
|
1338
|
+
id: "streetview",
|
|
1339
|
+
keywords: [
|
|
1340
|
+
"street view",
|
|
1341
|
+
"ground level",
|
|
1342
|
+
"what does it look like",
|
|
1343
|
+
"photo",
|
|
1344
|
+
"à quoi ressemble",
|
|
1345
|
+
"au niveau du sol",
|
|
1346
|
+
"vue immersive"
|
|
1347
|
+
],
|
|
1348
|
+
members: [
|
|
1349
|
+
"studio.streetview.close",
|
|
1350
|
+
"studio.streetview.corridor.set",
|
|
1351
|
+
"studio.streetview.coverage.set",
|
|
1352
|
+
"studio.streetview.move",
|
|
1353
|
+
"studio.streetview.open"
|
|
1354
|
+
],
|
|
1355
|
+
purpose: "Inspect a location at ground level along a route corridor.",
|
|
1356
|
+
title: "Street view",
|
|
1357
|
+
wideFallback: true
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
always: false,
|
|
1361
|
+
id: "video",
|
|
1362
|
+
keywords: [
|
|
1363
|
+
"video",
|
|
1364
|
+
"flythrough",
|
|
1365
|
+
"shot",
|
|
1366
|
+
"orbit",
|
|
1367
|
+
"record",
|
|
1368
|
+
"export video",
|
|
1369
|
+
"vidéo",
|
|
1370
|
+
"survol",
|
|
1371
|
+
"orbite",
|
|
1372
|
+
"filme",
|
|
1373
|
+
"filmer"
|
|
1374
|
+
],
|
|
1375
|
+
members: [
|
|
1376
|
+
"studio.video.cancel",
|
|
1377
|
+
"studio.video.close",
|
|
1378
|
+
"studio.video.download",
|
|
1379
|
+
"studio.video.duration.set",
|
|
1380
|
+
"studio.video.mode.set",
|
|
1381
|
+
"studio.video.open",
|
|
1382
|
+
"studio.video.orbit",
|
|
1383
|
+
"studio.video.output.set",
|
|
1384
|
+
"studio.video.plan.get",
|
|
1385
|
+
"studio.video.preset.set",
|
|
1386
|
+
"studio.video.preview.pause",
|
|
1387
|
+
"studio.video.preview.play",
|
|
1388
|
+
"studio.video.preview.seek",
|
|
1389
|
+
"studio.video.preview.start",
|
|
1390
|
+
"studio.video.preview.stop",
|
|
1391
|
+
"studio.video.profile.design.set",
|
|
1392
|
+
"studio.video.profile.language.set",
|
|
1393
|
+
"studio.video.profile.toggle",
|
|
1394
|
+
"studio.video.profile.units.set",
|
|
1395
|
+
"studio.video.record",
|
|
1396
|
+
"studio.video.route.set",
|
|
1397
|
+
"studio.video.shot.add",
|
|
1398
|
+
"studio.video.shot.addHold",
|
|
1399
|
+
"studio.video.shot.remove",
|
|
1400
|
+
"studio.video.shot.set",
|
|
1401
|
+
"studio.video.step.set"
|
|
1402
|
+
],
|
|
1403
|
+
purpose: "Compose a flythrough video of a route. Owned by the Video Director, not the studio co-pilot.",
|
|
1404
|
+
title: "Video director",
|
|
1405
|
+
wideFallback: false
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
always: false,
|
|
1409
|
+
id: "advanced",
|
|
1410
|
+
keywords: [
|
|
1411
|
+
"graphql",
|
|
1412
|
+
"data api",
|
|
1413
|
+
"raw query",
|
|
1414
|
+
"requête brute"
|
|
1415
|
+
],
|
|
1416
|
+
members: ["data.query", "data.schema"],
|
|
1417
|
+
purpose: "Escape hatch for geospatial questions no typed operation covers. Off by default: a typed operation is always the better answer when one exists.",
|
|
1418
|
+
title: "Raw Data API access",
|
|
1419
|
+
wideFallback: false
|
|
1420
|
+
}
|
|
1421
|
+
];
|
|
1422
|
+
const studioRouter = createStudioRouter({
|
|
1423
|
+
playbook: PLAYBOOK,
|
|
1424
|
+
skillRoutes: [
|
|
1425
|
+
{
|
|
1426
|
+
id: "analyze-terrain-along-route",
|
|
1427
|
+
intents: [
|
|
1428
|
+
"how steep is this",
|
|
1429
|
+
"where does it get hard",
|
|
1430
|
+
"is this north facing",
|
|
1431
|
+
"what's the terrain like",
|
|
1432
|
+
"how exposed is this route",
|
|
1433
|
+
"how technical is this trail",
|
|
1434
|
+
"is this route hard underfoot",
|
|
1435
|
+
"c'est raide",
|
|
1436
|
+
"c'est technique",
|
|
1437
|
+
"où ça devient dur",
|
|
1438
|
+
"comment est le terrain",
|
|
1439
|
+
"est-ce exposé",
|
|
1440
|
+
"orienté nord"
|
|
1441
|
+
],
|
|
1442
|
+
surfaces: ["terrain"]
|
|
1443
|
+
},
|
|
1444
|
+
{
|
|
1445
|
+
id: "build-route-from-scratch",
|
|
1446
|
+
intents: [
|
|
1447
|
+
"plan a route from",
|
|
1448
|
+
"create a new route",
|
|
1449
|
+
"i want to go from the village to the hut",
|
|
1450
|
+
"make me a loop starting here",
|
|
1451
|
+
"planifie un itinéraire",
|
|
1452
|
+
"crée un itinéraire",
|
|
1453
|
+
"fais-moi une boucle depuis",
|
|
1454
|
+
"du village au refuge"
|
|
1455
|
+
],
|
|
1456
|
+
surfaces: [
|
|
1457
|
+
"authoring",
|
|
1458
|
+
"discovery",
|
|
1459
|
+
"routing"
|
|
1460
|
+
]
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
id: "compare-alternative-routes",
|
|
1464
|
+
intents: [
|
|
1465
|
+
"which way is better",
|
|
1466
|
+
"compare these two",
|
|
1467
|
+
"worth going via",
|
|
1468
|
+
"what if i went the other way",
|
|
1469
|
+
"quel chemin est mieux",
|
|
1470
|
+
"compare ces deux",
|
|
1471
|
+
"ça vaut le coup de passer par",
|
|
1472
|
+
"par l'autre côté"
|
|
1473
|
+
],
|
|
1474
|
+
surfaces: ["routing", "terrain"]
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
id: "create-reachability-zone",
|
|
1478
|
+
intents: [
|
|
1479
|
+
"how far can i get in 2 hours",
|
|
1480
|
+
"what's within an hour of the hut",
|
|
1481
|
+
"draw the reachable area from here",
|
|
1482
|
+
"mark everything within 5 km on foot",
|
|
1483
|
+
"jusqu'où puis-je aller",
|
|
1484
|
+
"à moins d'une heure",
|
|
1485
|
+
"dessine la zone accessible",
|
|
1486
|
+
"accessible à pied"
|
|
1487
|
+
],
|
|
1488
|
+
surfaces: ["discovery", "zones"]
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
id: "create-zone-from-terrain-threshold",
|
|
1492
|
+
intents: [
|
|
1493
|
+
"mark everything steeper than",
|
|
1494
|
+
"highlight the north facing slopes",
|
|
1495
|
+
"show me the avalanche terrain here",
|
|
1496
|
+
"draw a zone over the steep part",
|
|
1497
|
+
"marque tout ce qui est plus raide",
|
|
1498
|
+
"les pentes orientées nord",
|
|
1499
|
+
"le terrain avalancheux",
|
|
1500
|
+
"dessine une zone sur les pentes"
|
|
1501
|
+
],
|
|
1502
|
+
surfaces: ["terrain", "zones"]
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
id: "export-and-share",
|
|
1506
|
+
intents: [
|
|
1507
|
+
"export this as gpx",
|
|
1508
|
+
"send this to my watch",
|
|
1509
|
+
"share this route",
|
|
1510
|
+
"share this collection",
|
|
1511
|
+
"give me a link",
|
|
1512
|
+
"embed this on my site",
|
|
1513
|
+
"exporte en gpx",
|
|
1514
|
+
"envoie sur ma montre",
|
|
1515
|
+
"partage cet itinéraire",
|
|
1516
|
+
"partage cette collection",
|
|
1517
|
+
"donne-moi un lien",
|
|
1518
|
+
"intègre sur mon site"
|
|
1519
|
+
],
|
|
1520
|
+
surfaces: ["sharing"]
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
id: "find-and-add-waypoints",
|
|
1524
|
+
intents: [
|
|
1525
|
+
"are there huts on this route",
|
|
1526
|
+
"where can i park",
|
|
1527
|
+
"add a water stop",
|
|
1528
|
+
"mark the summit",
|
|
1529
|
+
"des refuges sur ce parcours",
|
|
1530
|
+
"où me garer",
|
|
1531
|
+
"ajoute une étape",
|
|
1532
|
+
"marque le sommet",
|
|
1533
|
+
"un point d'eau"
|
|
1534
|
+
],
|
|
1535
|
+
surfaces: ["discovery", "authoring"]
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
id: "generate-route-suggestions",
|
|
1539
|
+
intents: [
|
|
1540
|
+
"suggest a route",
|
|
1541
|
+
"find me a 20 km loop",
|
|
1542
|
+
"something with 1000 m of climbing near here",
|
|
1543
|
+
"what can i do around",
|
|
1544
|
+
"suggère un itinéraire",
|
|
1545
|
+
"propose une boucle",
|
|
1546
|
+
"boucle de",
|
|
1547
|
+
"avec du dénivelé près de",
|
|
1548
|
+
"que faire autour de",
|
|
1549
|
+
"génère des itinéraires",
|
|
1550
|
+
"propose des itinéraires",
|
|
1551
|
+
"itinéraires de",
|
|
1552
|
+
"dénivelé positif",
|
|
1553
|
+
"point de départ"
|
|
1554
|
+
],
|
|
1555
|
+
surfaces: ["discovery", "authoring"]
|
|
1556
|
+
},
|
|
1557
|
+
{
|
|
1558
|
+
id: "increase-route-ascent",
|
|
1559
|
+
intents: [
|
|
1560
|
+
"make it steeper",
|
|
1561
|
+
"more climbing",
|
|
1562
|
+
"meters of elevation gain",
|
|
1563
|
+
"metres of elevation gain",
|
|
1564
|
+
"harder version of this route",
|
|
1565
|
+
"i want more vertical",
|
|
1566
|
+
"plus raide",
|
|
1567
|
+
"plus de dénivelé",
|
|
1568
|
+
"plus de montée",
|
|
1569
|
+
"version plus dure",
|
|
1570
|
+
"ajoute du dénivelé",
|
|
1571
|
+
"de dénivelé en plus"
|
|
1572
|
+
],
|
|
1573
|
+
surfaces: ["terrain", "routing"]
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
id: "modify-existing-segment",
|
|
1577
|
+
intents: [
|
|
1578
|
+
"reroute this",
|
|
1579
|
+
"avoid the",
|
|
1580
|
+
"go via",
|
|
1581
|
+
"make it shorter",
|
|
1582
|
+
"take the other side of the valley",
|
|
1583
|
+
"keep it off the road",
|
|
1584
|
+
"modifie le tracé",
|
|
1585
|
+
"évite",
|
|
1586
|
+
"passe par",
|
|
1587
|
+
"plus court",
|
|
1588
|
+
"raccourcis",
|
|
1589
|
+
"intègre la boucle",
|
|
1590
|
+
"intègre cette boucle",
|
|
1591
|
+
"ajoute cette boucle"
|
|
1592
|
+
],
|
|
1593
|
+
surfaces: ["routing", "discovery"]
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
id: "prepare-map-for-editing",
|
|
1597
|
+
intents: [
|
|
1598
|
+
"let's work on this route",
|
|
1599
|
+
"open my route",
|
|
1600
|
+
"i want to edit this",
|
|
1601
|
+
"show me the whole thing",
|
|
1602
|
+
"travaillons sur",
|
|
1603
|
+
"ouvre mon itinéraire",
|
|
1604
|
+
"je veux modifier",
|
|
1605
|
+
"montre-moi tout le parcours"
|
|
1606
|
+
],
|
|
1607
|
+
surfaces: ["routing"]
|
|
1608
|
+
},
|
|
1609
|
+
{
|
|
1610
|
+
id: "visualize-terrain",
|
|
1611
|
+
intents: [
|
|
1612
|
+
"show me the steepness",
|
|
1613
|
+
"turn on hillshade",
|
|
1614
|
+
"can i see the snow depth",
|
|
1615
|
+
"display the aspect",
|
|
1616
|
+
"montre la pente",
|
|
1617
|
+
"affiche la pente",
|
|
1618
|
+
"active le calque",
|
|
1619
|
+
"montre le relief",
|
|
1620
|
+
"hauteur de neige"
|
|
1621
|
+
],
|
|
1622
|
+
surfaces: ["terrain"]
|
|
1623
|
+
}
|
|
1624
|
+
],
|
|
1625
|
+
surfaceLocks: [
|
|
1626
|
+
{
|
|
1627
|
+
equals: "segment",
|
|
1628
|
+
field: "editSession",
|
|
1629
|
+
surface: "routing"
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
equals: "waypoint",
|
|
1633
|
+
field: "editSession",
|
|
1634
|
+
surface: "authoring"
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
equals: true,
|
|
1638
|
+
field: "suggestDraft",
|
|
1639
|
+
surface: "discovery"
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
equals: "zone",
|
|
1643
|
+
field: "editSession",
|
|
1644
|
+
surface: "zones"
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
equals: "zone",
|
|
1648
|
+
field: "openResource",
|
|
1649
|
+
surface: "zones"
|
|
1650
|
+
},
|
|
1651
|
+
{
|
|
1652
|
+
equals: true,
|
|
1653
|
+
field: "importDraft",
|
|
1654
|
+
surface: "import"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
equals: true,
|
|
1658
|
+
field: "videoOpen",
|
|
1659
|
+
surface: "video"
|
|
1660
|
+
}
|
|
1661
|
+
],
|
|
1662
|
+
surfaces: SURFACES
|
|
1663
|
+
});
|
|
1664
|
+
const recoveryFor = studioRouter.recoveryFor;
|
|
1665
|
+
const selectSurfaces = studioRouter.selectSurfaces;
|
|
1666
|
+
const surfaceTools = studioRouter.surfaceTools;
|
|
1667
|
+
const addendumFor = (addendum, tool, code) => {
|
|
1668
|
+
if (addendum === void 0) return;
|
|
1669
|
+
let answered;
|
|
1670
|
+
try {
|
|
1671
|
+
answered = addendum(tool, code);
|
|
1672
|
+
} catch (fault) {
|
|
1673
|
+
require_listeners.surfaceFault(fault);
|
|
1674
|
+
return;
|
|
1675
|
+
}
|
|
1676
|
+
const sentence = typeof answered === "string" ? answered.trim() : "";
|
|
1677
|
+
return sentence === "" ? void 0 : sentence;
|
|
1678
|
+
};
|
|
1679
|
+
const studioRecoveryFor = (tool, code, addendum) => {
|
|
1680
|
+
if (code === void 0 || code === "") return;
|
|
1681
|
+
const recovery = recoveryFor(tool, code);
|
|
1682
|
+
const extra = addendumFor(addendum, tool, code);
|
|
1683
|
+
if (recovery === void 0 || extra === void 0) return recovery ?? extra;
|
|
1684
|
+
return `${recovery} ${extra}`;
|
|
1685
|
+
};
|
|
1686
|
+
const transcriptObserver = (config) => {
|
|
1687
|
+
const { draftWarning, errorCopy, writer } = config;
|
|
1688
|
+
return {
|
|
1689
|
+
onChecksUnmet: writer.appendChecksUnmet,
|
|
1690
|
+
onError: (message, code) => writer.appendError((0, _mountaya_elements_agent.resolveAgentError)(message, code, errorCopy(), draftWarning?.())),
|
|
1691
|
+
onMessage: writer.setAssistantMessage,
|
|
1692
|
+
onMessageDelta: writer.appendAssistantDelta,
|
|
1693
|
+
onRunId: writer.setRunId,
|
|
1694
|
+
onStateChange: writer.setSessionState,
|
|
1695
|
+
onToolActivity: writer.setActiveTool,
|
|
1696
|
+
onToolCall: (name, input, toolCallId) => writer.appendToolActivity({
|
|
1697
|
+
input: (0, _mountaya_elements_agent.boundedInputJson)(input),
|
|
1698
|
+
name,
|
|
1699
|
+
toolCallId
|
|
1700
|
+
}),
|
|
1701
|
+
onToolResult: writer.settleToolActivity
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
const WITHHELD_TAB_ID = "withheld";
|
|
1705
|
+
const idleThread = (runId) => ({
|
|
1706
|
+
pendingConfirmation: null,
|
|
1707
|
+
runId,
|
|
1708
|
+
state: "awaiting_input",
|
|
1709
|
+
transcript: []
|
|
1710
|
+
});
|
|
1711
|
+
const heldThread = (threads, threadId) => Object.hasOwn(threads, threadId) ? threads[threadId] : void 0;
|
|
1712
|
+
const updateThread = (threads, threadId, transform) => {
|
|
1713
|
+
const thread = heldThread(threads, threadId);
|
|
1714
|
+
if (!thread) return threads;
|
|
1715
|
+
return {
|
|
1716
|
+
...threads,
|
|
1717
|
+
[threadId]: transform(thread)
|
|
1718
|
+
};
|
|
1719
|
+
};
|
|
1720
|
+
const initialState = {
|
|
1721
|
+
activeId: null,
|
|
1722
|
+
activeTabId: null,
|
|
1723
|
+
order: [],
|
|
1724
|
+
threads: {}
|
|
1725
|
+
};
|
|
1726
|
+
const createAgentThreadsStore = () => (0, zustand_vanilla.createStore)((set) => ({
|
|
1727
|
+
...initialState,
|
|
1728
|
+
addCopilotTab: (threadId) => set((current) => {
|
|
1729
|
+
if (heldThread(current.threads, threadId)) return current;
|
|
1730
|
+
return {
|
|
1731
|
+
activeId: threadId,
|
|
1732
|
+
activeTabId: threadId,
|
|
1733
|
+
order: [...current.order, threadId],
|
|
1734
|
+
threads: {
|
|
1735
|
+
...current.threads,
|
|
1736
|
+
[threadId]: idleThread(null)
|
|
1737
|
+
}
|
|
1738
|
+
};
|
|
1739
|
+
}),
|
|
1740
|
+
answerQuestion: (threadId, entryId, label) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1741
|
+
...thread,
|
|
1742
|
+
transcript: (0, _mountaya_elements_agent.answerQuestionEntry)(thread.transcript, entryId, label)
|
|
1743
|
+
})) })),
|
|
1744
|
+
appendAssistantDelta: (threadId, delta) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1745
|
+
...thread,
|
|
1746
|
+
transcript: (0, _mountaya_elements_agent.accumulateAssistant)(thread.transcript, delta)
|
|
1747
|
+
})) })),
|
|
1748
|
+
appendChecksUnmet: (threadId, unmet) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1749
|
+
...thread,
|
|
1750
|
+
transcript: (0, _mountaya_elements_agent.appendWarningEntry)(thread.transcript, unmet)
|
|
1751
|
+
})) })),
|
|
1752
|
+
appendError: (threadId, message) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1753
|
+
...thread,
|
|
1754
|
+
transcript: (0, _mountaya_elements_agent.appendErrorEntry)(thread.transcript, message)
|
|
1755
|
+
})) })),
|
|
1756
|
+
appendQuestion: (threadId, question) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1757
|
+
...thread,
|
|
1758
|
+
transcript: (0, _mountaya_elements_agent.appendQuestionEntry)(thread.transcript, question)
|
|
1759
|
+
})) })),
|
|
1760
|
+
appendSuggestions: (threadId, suggestions) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1761
|
+
...thread,
|
|
1762
|
+
transcript: (0, _mountaya_elements_agent.appendSuggestionsEntry)(thread.transcript, suggestions)
|
|
1763
|
+
})) })),
|
|
1764
|
+
appendToolActivity: (threadId, activity) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1765
|
+
...thread,
|
|
1766
|
+
transcript: (0, _mountaya_elements_agent.appendActivityEntry)(thread.transcript, activity)
|
|
1767
|
+
})) })),
|
|
1768
|
+
appendUserMessage: (threadId, content) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1769
|
+
...thread,
|
|
1770
|
+
transcript: (0, _mountaya_elements_agent.appendUserEntry)((0, _mountaya_elements_agent.settleOpenSuggestionEntries)((0, _mountaya_elements_agent.settleOpenQuestionEntries)(thread.transcript)), content)
|
|
1771
|
+
})) })),
|
|
1772
|
+
chooseSuggestion: (threadId, entryId, seed) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1773
|
+
...thread,
|
|
1774
|
+
transcript: (0, _mountaya_elements_agent.chooseSuggestionEntry)(thread.transcript, entryId, seed)
|
|
1775
|
+
})) })),
|
|
1776
|
+
clearPendingConfirmation: (threadId) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1777
|
+
...thread,
|
|
1778
|
+
pendingConfirmation: null
|
|
1779
|
+
})) })),
|
|
1780
|
+
closeCopilotTab: (threadId) => set((current) => {
|
|
1781
|
+
if (threadId === "search" || threadId === "withheld") return current;
|
|
1782
|
+
const order = current.order.filter((id) => id !== threadId);
|
|
1783
|
+
const { [threadId]: _closed, ...threads } = current.threads;
|
|
1784
|
+
const activeId = current.activeId === threadId ? order.at(-1) ?? null : current.activeId;
|
|
1785
|
+
return {
|
|
1786
|
+
activeId,
|
|
1787
|
+
activeTabId: current.activeTabId === threadId ? activeId ?? "search" : current.activeTabId,
|
|
1788
|
+
order,
|
|
1789
|
+
threads
|
|
1790
|
+
};
|
|
1791
|
+
}),
|
|
1792
|
+
closeThread: (threadId) => set((current) => {
|
|
1793
|
+
const order = current.order.filter((id) => id !== threadId);
|
|
1794
|
+
const { [threadId]: _closed, ...threads } = current.threads;
|
|
1795
|
+
const activeId = current.activeId === threadId ? order.at(-1) ?? null : current.activeId;
|
|
1796
|
+
return {
|
|
1797
|
+
activeId,
|
|
1798
|
+
activeTabId: current.activeTabId === threadId ? activeId ?? "search" : current.activeTabId,
|
|
1799
|
+
order,
|
|
1800
|
+
threads
|
|
1801
|
+
};
|
|
1802
|
+
}),
|
|
1803
|
+
createThread: (threadId, runId = null) => set((current) => {
|
|
1804
|
+
if (heldThread(current.threads, threadId)) return current;
|
|
1805
|
+
return {
|
|
1806
|
+
activeId: threadId,
|
|
1807
|
+
order: [...current.order, threadId],
|
|
1808
|
+
threads: {
|
|
1809
|
+
...current.threads,
|
|
1810
|
+
[threadId]: idleThread(runId)
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
}),
|
|
1814
|
+
setActive: (threadId) => set((current) => heldThread(current.threads, threadId) ? { activeId: threadId } : current),
|
|
1815
|
+
setActiveTab: (tabId) => set((current) => {
|
|
1816
|
+
if (tabId === "search") return { activeTabId: require_tabs.SEARCH_TAB_ID };
|
|
1817
|
+
if (tabId === "withheld") return { activeTabId: WITHHELD_TAB_ID };
|
|
1818
|
+
if (!heldThread(current.threads, tabId)) return current;
|
|
1819
|
+
return {
|
|
1820
|
+
activeId: tabId,
|
|
1821
|
+
activeTabId: tabId
|
|
1822
|
+
};
|
|
1823
|
+
}),
|
|
1824
|
+
setAssistantMessage: (threadId, content, messageIndex) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1825
|
+
...thread,
|
|
1826
|
+
transcript: (0, _mountaya_elements_agent.replaceAssistant)(thread.transcript, content, messageIndex)
|
|
1827
|
+
})) })),
|
|
1828
|
+
setPendingConfirmation: (threadId, confirmation) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1829
|
+
...thread,
|
|
1830
|
+
pendingConfirmation: confirmation
|
|
1831
|
+
})) })),
|
|
1832
|
+
setRunId: (threadId, runId) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1833
|
+
...thread,
|
|
1834
|
+
runId
|
|
1835
|
+
})) })),
|
|
1836
|
+
setSessionState: (threadId, state) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1837
|
+
...thread,
|
|
1838
|
+
state
|
|
1839
|
+
})) })),
|
|
1840
|
+
settleToolActivity: (threadId, toolCallId, outcome) => set((current) => ({ threads: updateThread(current.threads, threadId, (thread) => ({
|
|
1841
|
+
...thread,
|
|
1842
|
+
transcript: (0, _mountaya_elements_agent.settleActivityEntry)(thread.transcript, toolCallId, outcome)
|
|
1843
|
+
})) }))
|
|
1844
|
+
}));
|
|
1845
|
+
const selectAgentDriving = (state) => state.order.some((id) => state.threads[id]?.state === "running");
|
|
1846
|
+
const QUESTION_TOOL = "studio.question.ask";
|
|
1847
|
+
const GENERATE_TOOL = "studio.itinerary.suggest.generate";
|
|
1848
|
+
const ACCESS_REVOKED = "access-revoked";
|
|
1849
|
+
const holdRejection = (dispatched) => {
|
|
1850
|
+
Promise.resolve(dispatched).then(void 0, () => void 0);
|
|
1851
|
+
};
|
|
1852
|
+
const isOutcome = (answered) => typeof answered === "object" && answered !== null && "ok" in answered && typeof answered.ok === "boolean";
|
|
1853
|
+
const restorableThreads = (named) => {
|
|
1854
|
+
const kept = /* @__PURE__ */ new Map();
|
|
1855
|
+
const entries = Array.isArray(named) ? named : [];
|
|
1856
|
+
for (const entry of entries) {
|
|
1857
|
+
if (kept.size >= 1) break;
|
|
1858
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
1859
|
+
const id = "id" in entry ? entry.id : void 0;
|
|
1860
|
+
const runId = "runId" in entry ? entry.runId : void 0;
|
|
1861
|
+
if (typeof id !== "string" || id === "" || id === "search" || id === "withheld" || kept.has(id)) continue;
|
|
1862
|
+
kept.set(id, {
|
|
1863
|
+
id,
|
|
1864
|
+
runId: typeof runId === "string" && runId !== "" ? runId : null
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1867
|
+
return [...kept.values()];
|
|
1868
|
+
};
|
|
1869
|
+
var AgentThreadsEngine = class {
|
|
1870
|
+
config;
|
|
1871
|
+
ids;
|
|
1872
|
+
store;
|
|
1873
|
+
tabs;
|
|
1874
|
+
subscriptions = /* @__PURE__ */ new Set();
|
|
1875
|
+
releaseStore = null;
|
|
1876
|
+
mirrored = null;
|
|
1877
|
+
unrestored = null;
|
|
1878
|
+
heard = null;
|
|
1879
|
+
hosts = /* @__PURE__ */ new Map();
|
|
1880
|
+
confirmations = /* @__PURE__ */ new Map();
|
|
1881
|
+
surfaces = /* @__PURE__ */ new Map();
|
|
1882
|
+
lastRouted = /* @__PURE__ */ new Map();
|
|
1883
|
+
suggestBatchOwner = null;
|
|
1884
|
+
stagingPicks = /* @__PURE__ */ new Set();
|
|
1885
|
+
awaitingTurn = /* @__PURE__ */ new Set();
|
|
1886
|
+
sessionStates = /* @__PURE__ */ new Map();
|
|
1887
|
+
parked = true;
|
|
1888
|
+
disposed = false;
|
|
1889
|
+
tabSurface = {
|
|
1890
|
+
addCopilotTab: () => this.live() ? this.openTab() : this.shownTab(),
|
|
1891
|
+
closeCopilotTab: (tabId) => {
|
|
1892
|
+
if (this.live()) this.closeTab(tabId);
|
|
1893
|
+
},
|
|
1894
|
+
countOpen: () => this.store.getState().order.length,
|
|
1895
|
+
hasTab: (tabId) => tabId === "search" || tabId === "withheld" && this.withheld() || this.store.getState().order.includes(tabId),
|
|
1896
|
+
openCopilot: () => this.live() ? this.openOrReveal() : this.shownTab(),
|
|
1897
|
+
reset: () => {
|
|
1898
|
+
if (this.live()) this.resetThreads();
|
|
1899
|
+
},
|
|
1900
|
+
setActiveTab: (tabId) => {
|
|
1901
|
+
if (this.live()) this.showTab(tabId);
|
|
1902
|
+
}
|
|
1903
|
+
};
|
|
1904
|
+
constructor(options) {
|
|
1905
|
+
const { ids, store, tabs, ...config } = options;
|
|
1906
|
+
this.config = config;
|
|
1907
|
+
this.ids = ids;
|
|
1908
|
+
this.tabs = tabs;
|
|
1909
|
+
this.store = store ?? createAgentThreadsStore();
|
|
1910
|
+
this.seed(config.threadsUrl?.readOnce() ?? {});
|
|
1911
|
+
}
|
|
1912
|
+
getSnapshot() {
|
|
1913
|
+
return this.store.getState();
|
|
1914
|
+
}
|
|
1915
|
+
subscribe(listener) {
|
|
1916
|
+
if (this.disposed) return () => {};
|
|
1917
|
+
const subscription = { listener };
|
|
1918
|
+
this.subscriptions.add(subscription);
|
|
1919
|
+
if (this.parked) this.resume();
|
|
1920
|
+
return () => {
|
|
1921
|
+
if (!this.subscriptions.delete(subscription) || this.subscriptions.size > 0) return;
|
|
1922
|
+
if (!this.parked) this.park();
|
|
1923
|
+
};
|
|
1924
|
+
}
|
|
1925
|
+
configure(config) {
|
|
1926
|
+
this.config = config;
|
|
1927
|
+
if (this.mirrored !== null && this.mirrored !== config.context.ui) {
|
|
1928
|
+
this.releaseMirror();
|
|
1929
|
+
this.mirrorInto(config.context.ui);
|
|
1930
|
+
}
|
|
1931
|
+
if (this.heard !== null && this.heard.viewer !== config.context.viewer) {
|
|
1932
|
+
this.hearViewer(config.context.viewer);
|
|
1933
|
+
this.restoreForEntitled();
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
dispose() {
|
|
1937
|
+
if (this.disposed) return;
|
|
1938
|
+
if (!this.parked) this.park();
|
|
1939
|
+
this.disposed = true;
|
|
1940
|
+
this.subscriptions.clear();
|
|
1941
|
+
}
|
|
1942
|
+
answerQuestion(entryId, label) {
|
|
1943
|
+
const threadId = this.activeThread();
|
|
1944
|
+
if (threadId === null || !this.hasOpenQuestion(threadId, entryId)) return;
|
|
1945
|
+
this.store.getState().answerQuestion(threadId, entryId, label);
|
|
1946
|
+
this.send(threadId, label);
|
|
1947
|
+
}
|
|
1948
|
+
chooseSuggestion(entryId, seed, label) {
|
|
1949
|
+
const threadId = this.activeThread();
|
|
1950
|
+
if (threadId === null || this.stagingPicks.has(entryId)) return;
|
|
1951
|
+
this.stagingPicks.add(entryId);
|
|
1952
|
+
this.applyPick(threadId, entryId, seed, label);
|
|
1953
|
+
}
|
|
1954
|
+
closeAiTab(tabId) {
|
|
1955
|
+
if (this.live()) holdRejection(this.config.bus.dispatch(this.tabsContext(), "studio.tabs.close", { tabId }));
|
|
1956
|
+
}
|
|
1957
|
+
newAiTab() {
|
|
1958
|
+
if (this.live()) holdRejection(this.config.bus.dispatch(this.tabsContext(), "studio.tabs.create", { kind: "copilot" }));
|
|
1959
|
+
}
|
|
1960
|
+
previewCandidate(seed) {
|
|
1961
|
+
if (this.live()) holdRejection(this.config.bus.dispatch(this.config.context, "studio.itinerary.suggest.select", { seed }));
|
|
1962
|
+
}
|
|
1963
|
+
resolveConfirmation(approved) {
|
|
1964
|
+
const threadId = this.activeThread();
|
|
1965
|
+
if (threadId === null) return;
|
|
1966
|
+
const resolve = this.confirmations.get(threadId);
|
|
1967
|
+
if (resolve === void 0) return;
|
|
1968
|
+
this.confirmations.delete(threadId);
|
|
1969
|
+
this.store.getState().clearPendingConfirmation(threadId);
|
|
1970
|
+
resolve(approved);
|
|
1971
|
+
}
|
|
1972
|
+
stopActive() {
|
|
1973
|
+
const threadId = this.activeThread();
|
|
1974
|
+
if (threadId === null) return;
|
|
1975
|
+
this.denyPendingConfirmation(threadId);
|
|
1976
|
+
this.ensureHost(threadId).restart();
|
|
1977
|
+
this.store.getState().setRunId(threadId, null);
|
|
1978
|
+
this.settle(threadId);
|
|
1979
|
+
this.syncUrl();
|
|
1980
|
+
}
|
|
1981
|
+
submit(message) {
|
|
1982
|
+
const threadId = this.activeThread();
|
|
1983
|
+
if (threadId !== null) this.send(threadId, message);
|
|
1984
|
+
}
|
|
1985
|
+
switchTab(tabId) {
|
|
1986
|
+
if (this.live()) holdRejection(this.config.bus.dispatch(this.tabsContext(), "studio.tabs.switch", { tabId }));
|
|
1987
|
+
}
|
|
1988
|
+
live() {
|
|
1989
|
+
if (this.parked || this.disposed) return false;
|
|
1990
|
+
this.restoreForEntitled();
|
|
1991
|
+
return true;
|
|
1992
|
+
}
|
|
1993
|
+
isOpen(threadId) {
|
|
1994
|
+
return this.live() && this.store.getState().threads[threadId] !== void 0;
|
|
1995
|
+
}
|
|
1996
|
+
activeThread() {
|
|
1997
|
+
return this.live() ? this.store.getState().activeId : null;
|
|
1998
|
+
}
|
|
1999
|
+
shownTab() {
|
|
2000
|
+
return this.store.getState().activeTabId ?? "search";
|
|
2001
|
+
}
|
|
2002
|
+
withheld() {
|
|
2003
|
+
return !this.config.context.viewer.hasEntitlement("copilot");
|
|
2004
|
+
}
|
|
2005
|
+
seed(mirrored) {
|
|
2006
|
+
if (this.withheld()) {
|
|
2007
|
+
this.unrestored = mirrored;
|
|
2008
|
+
this.store.getState().setActiveTab(mirrored.activeThreadId === "withheld" ? WITHHELD_TAB_ID : require_tabs.SEARCH_TAB_ID);
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
this.restore(mirrored);
|
|
2012
|
+
}
|
|
2013
|
+
restore(mirrored) {
|
|
2014
|
+
const state = this.store.getState();
|
|
2015
|
+
const named = restorableThreads(mirrored.threads).filter(({ id }) => !Object.hasOwn(state.threads, id));
|
|
2016
|
+
const initial = mirrored.activeThreadId;
|
|
2017
|
+
if (named.length === 0) {
|
|
2018
|
+
const created = state.order.length === 0 ? [this.ids.next()] : [];
|
|
2019
|
+
for (const id of created) state.createThread(id);
|
|
2020
|
+
state.setActiveTab(require_tabs.SEARCH_TAB_ID);
|
|
2021
|
+
return created;
|
|
2022
|
+
}
|
|
2023
|
+
for (const { id, runId } of named) state.createThread(id, runId);
|
|
2024
|
+
const open = this.store.getState().order;
|
|
2025
|
+
state.setActiveTab(initial !== void 0 && (initial === "search" || open.includes(initial)) ? initial : require_tabs.SEARCH_TAB_ID);
|
|
2026
|
+
return named.map(({ id }) => id);
|
|
2027
|
+
}
|
|
2028
|
+
restoreForEntitled() {
|
|
2029
|
+
const mirrored = this.unrestored;
|
|
2030
|
+
if (mirrored === null || this.withheld()) return;
|
|
2031
|
+
this.unrestored = null;
|
|
2032
|
+
const created = this.restore(mirrored);
|
|
2033
|
+
this.syncUrl();
|
|
2034
|
+
if (!this.parked && !this.disposed) for (const id of created) this.connect(id);
|
|
2035
|
+
}
|
|
2036
|
+
hearViewer(viewer) {
|
|
2037
|
+
this.heard?.release();
|
|
2038
|
+
this.heard = null;
|
|
2039
|
+
let release = () => void 0;
|
|
2040
|
+
this.tellSeam(() => {
|
|
2041
|
+
release = viewer.subscribe(() => this.restoreForEntitled());
|
|
2042
|
+
});
|
|
2043
|
+
this.heard = {
|
|
2044
|
+
release,
|
|
2045
|
+
viewer
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
connect(threadId) {
|
|
2049
|
+
this.ensureHost(threadId).resume(this.store.getState().threads[threadId]?.runId ?? null, (error) => this.faultsFor(threadId).resumeFailed(error));
|
|
2050
|
+
}
|
|
2051
|
+
resume() {
|
|
2052
|
+
this.restoreForEntitled();
|
|
2053
|
+
this.parked = false;
|
|
2054
|
+
this.releaseStore = this.store.subscribe((state) => {
|
|
2055
|
+
this.syncDriving(state);
|
|
2056
|
+
require_listeners.notifyListeners(Array.from(this.subscriptions, ({ listener }) => listener));
|
|
2057
|
+
});
|
|
2058
|
+
this.mirrorInto(this.config.context.ui);
|
|
2059
|
+
for (const id of [...this.store.getState().order]) this.connect(id);
|
|
2060
|
+
this.hearViewer(this.config.context.viewer);
|
|
2061
|
+
this.tellSeam(() => this.tabs?.register(this.tabSurface));
|
|
2062
|
+
}
|
|
2063
|
+
park() {
|
|
2064
|
+
this.parked = true;
|
|
2065
|
+
this.releaseStore?.();
|
|
2066
|
+
this.releaseStore = null;
|
|
2067
|
+
for (const host of this.hosts.values()) host.dispose();
|
|
2068
|
+
this.awaitingTurn.clear();
|
|
2069
|
+
this.sessionStates.clear();
|
|
2070
|
+
this.settleStreamingThreads();
|
|
2071
|
+
for (const threadId of [...this.confirmations.keys()]) this.denyPendingConfirmation(threadId);
|
|
2072
|
+
this.releaseMirror();
|
|
2073
|
+
const heard = this.heard;
|
|
2074
|
+
this.heard = null;
|
|
2075
|
+
if (heard !== null) this.tellSeam(heard.release);
|
|
2076
|
+
this.tellSeam(() => this.tabs?.unregister());
|
|
2077
|
+
}
|
|
2078
|
+
tellSeam(tell) {
|
|
2079
|
+
try {
|
|
2080
|
+
tell();
|
|
2081
|
+
} catch (fault) {
|
|
2082
|
+
require_listeners.surfaceFault(fault);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
send(threadId, message) {
|
|
2086
|
+
if (this.sessionStates.get(threadId) !== "running") this.awaitingTurn.add(threadId);
|
|
2087
|
+
this.writeSessionState(threadId, "running");
|
|
2088
|
+
this.ensureHost(threadId).submit(message);
|
|
2089
|
+
}
|
|
2090
|
+
settle(threadId) {
|
|
2091
|
+
this.awaitingTurn.delete(threadId);
|
|
2092
|
+
this.writeSessionState(threadId, "awaiting_input");
|
|
2093
|
+
}
|
|
2094
|
+
reportSessionState(threadId, state) {
|
|
2095
|
+
this.sessionStates.set(threadId, state);
|
|
2096
|
+
if (!this.live() || state === "awaiting_input" && this.awaitingTurn.has(threadId)) return;
|
|
2097
|
+
this.awaitingTurn.delete(threadId);
|
|
2098
|
+
this.writeSessionState(threadId, state);
|
|
2099
|
+
}
|
|
2100
|
+
writeSessionState(threadId, state) {
|
|
2101
|
+
const thread = this.store.getState().threads[threadId];
|
|
2102
|
+
if (thread !== void 0 && thread.state !== state) this.store.getState().setSessionState(threadId, state);
|
|
2103
|
+
}
|
|
2104
|
+
hasOpenQuestion(threadId, entryId) {
|
|
2105
|
+
return this.store.getState().threads[threadId]?.transcript.some((entry) => entry.role === "question" && entry.id === entryId && !entry.settled) ?? false;
|
|
2106
|
+
}
|
|
2107
|
+
settleStreamingThreads() {
|
|
2108
|
+
const { order, threads } = this.store.getState();
|
|
2109
|
+
for (const id of order) if (threads[id]?.state === "running") this.store.getState().setSessionState(id, "awaiting_input");
|
|
2110
|
+
}
|
|
2111
|
+
mirrorInto(ui) {
|
|
2112
|
+
this.mirrored = ui;
|
|
2113
|
+
this.syncDriving(this.store.getState());
|
|
2114
|
+
}
|
|
2115
|
+
releaseMirror() {
|
|
2116
|
+
const ui = this.mirrored;
|
|
2117
|
+
if (ui === null) return;
|
|
2118
|
+
this.mirrored = null;
|
|
2119
|
+
ui.getState().setAgentDriving(false);
|
|
2120
|
+
ui.getState().agentClearEditLocks();
|
|
2121
|
+
ui.getState().setAgentHandoff(null);
|
|
2122
|
+
}
|
|
2123
|
+
syncDriving(state) {
|
|
2124
|
+
const ui = this.mirrored;
|
|
2125
|
+
if (ui === null) return;
|
|
2126
|
+
const driving = selectAgentDriving(state);
|
|
2127
|
+
if (ui.getState().agentDriving === driving) return;
|
|
2128
|
+
ui.getState().setAgentDriving(driving);
|
|
2129
|
+
if (!driving) ui.getState().agentClearEditLocks(require_viewer.agentHandoffTarget(ui.getState()));
|
|
2130
|
+
}
|
|
2131
|
+
syncUrl() {
|
|
2132
|
+
const state = this.store.getState();
|
|
2133
|
+
const threads = state.order.map((id) => ({
|
|
2134
|
+
id,
|
|
2135
|
+
runId: state.threads[id]?.runId ?? null
|
|
2136
|
+
}));
|
|
2137
|
+
this.tellSeam(() => this.config.threadsUrl?.write({
|
|
2138
|
+
activeThreadId: state.activeTabId ?? null,
|
|
2139
|
+
threads
|
|
2140
|
+
}));
|
|
2141
|
+
}
|
|
2142
|
+
tabsContext() {
|
|
2143
|
+
return require_context.layerToolContext(this.config.context, { tabs: this.tabSurface });
|
|
2144
|
+
}
|
|
2145
|
+
ensureHost(threadId) {
|
|
2146
|
+
let host = this.hosts.get(threadId);
|
|
2147
|
+
if (host === void 0) {
|
|
2148
|
+
host = this.hostFor(threadId);
|
|
2149
|
+
this.hosts.set(threadId, host);
|
|
2150
|
+
}
|
|
2151
|
+
return host;
|
|
2152
|
+
}
|
|
2153
|
+
hostFor(threadId) {
|
|
2154
|
+
return (0, _mountaya_elements_agent.createConversationHost)({
|
|
2155
|
+
appendUserMessage: (message) => this.store.getState().appendUserMessage(threadId, message),
|
|
2156
|
+
buildContext: () => require_tabs.buildStudioSnapshot(this.config.context).catch(() => void 0),
|
|
2157
|
+
buildSession: () => this.sessionFor(threadId),
|
|
2158
|
+
onMissingOrganization: () => this.faultsFor(threadId).missingOrganization(),
|
|
2159
|
+
onSendFault: (error, runGone) => this.faultsFor(threadId).recover(runGone, error),
|
|
2160
|
+
onStartError: (organizationId, error, runId) => this.faultsFor(threadId).handleStartError(organizationId, error, runId),
|
|
2161
|
+
resolveOrganizationId: () => copilotOrganizationId(this.config.context.ui.getState()),
|
|
2162
|
+
routeForMessage: (message) => this.routeForMessage(threadId, message),
|
|
2163
|
+
routeForState: () => this.routeForState(threadId)
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
sessionFor(threadId) {
|
|
2167
|
+
this.sessionStates.delete(threadId);
|
|
2168
|
+
return new _mountaya_elements_agent.AgentEngine({
|
|
2169
|
+
bus: this.config.bus,
|
|
2170
|
+
confirmServerTool: (confirmation) => this.requestConfirmation(threadId, confirmation.name, this.config.strings.confirm.serverToolFallback(confirmation.name)),
|
|
2171
|
+
ctx: require_context.layerToolContext(this.config.context, {
|
|
2172
|
+
confirm: (request) => this.requestConfirmation(threadId, request.name, require_confirmCopy.confirmSentence(this.config.strings, request.descriptionLabel, request.values) ?? request.description),
|
|
2173
|
+
origin: "agent"
|
|
2174
|
+
}),
|
|
2175
|
+
observer: this.observerFor(threadId),
|
|
2176
|
+
recoveryFor: (tool, code) => studioRecoveryFor(tool, code, this.config.recoveryAddendum),
|
|
2177
|
+
routesServerTools: this.config.routesServerTools,
|
|
2178
|
+
stateDelta: studioStateDelta,
|
|
2179
|
+
toolSurface: () => {
|
|
2180
|
+
const surfaces = this.surfaces.get(threadId);
|
|
2181
|
+
return surfaces === void 0 ? void 0 : surfaceTools(surfaces);
|
|
2182
|
+
},
|
|
2183
|
+
transport: this.config.transport
|
|
2184
|
+
});
|
|
2185
|
+
}
|
|
2186
|
+
observerFor(threadId) {
|
|
2187
|
+
const store = this.store;
|
|
2188
|
+
const transcript = transcriptObserver({
|
|
2189
|
+
draftWarning: () => ({
|
|
2190
|
+
note: this.config.strings.prompt.budgetDraftOpen,
|
|
2191
|
+
open: captureStudioState(this.config.context).editingKind !== null
|
|
2192
|
+
}),
|
|
2193
|
+
errorCopy: () => this.config.errorCopy,
|
|
2194
|
+
writer: {
|
|
2195
|
+
appendAssistantDelta: (delta) => store.getState().appendAssistantDelta(threadId, delta),
|
|
2196
|
+
appendChecksUnmet: (unmet) => store.getState().appendChecksUnmet(threadId, unmet),
|
|
2197
|
+
appendError: (message) => store.getState().appendError(threadId, message),
|
|
2198
|
+
appendToolActivity: (activity) => store.getState().appendToolActivity(threadId, activity),
|
|
2199
|
+
setAssistantMessage: (content, messageIndex) => store.getState().setAssistantMessage(threadId, content, messageIndex),
|
|
2200
|
+
setRunId: (runId) => store.getState().setRunId(threadId, runId),
|
|
2201
|
+
setSessionState: (state) => this.reportSessionState(threadId, state),
|
|
2202
|
+
settleToolActivity: (toolCallId, outcome) => store.getState().settleToolActivity(threadId, toolCallId, outcome)
|
|
2203
|
+
}
|
|
2204
|
+
});
|
|
2205
|
+
return {
|
|
2206
|
+
...transcript,
|
|
2207
|
+
onError: (message, code) => {
|
|
2208
|
+
transcript.onError?.(message, code);
|
|
2209
|
+
if (code === ACCESS_REVOKED) this.tellSeam(() => this.config.invalidateMemberships?.());
|
|
2210
|
+
},
|
|
2211
|
+
onRunId: (runId) => {
|
|
2212
|
+
transcript.onRunId?.(runId);
|
|
2213
|
+
this.syncUrl();
|
|
2214
|
+
},
|
|
2215
|
+
onToolCall: (name, input, toolCallId) => {
|
|
2216
|
+
if (this.appendQuestionCard(threadId, name, input, toolCallId)) return;
|
|
2217
|
+
if (name === GENERATE_TOOL) this.suggestBatchOwner = {
|
|
2218
|
+
threadId,
|
|
2219
|
+
toolCallId
|
|
2220
|
+
};
|
|
2221
|
+
const ui = this.config.context.ui;
|
|
2222
|
+
const target = agentEditLockTarget(name, input);
|
|
2223
|
+
if (target !== null) ui.getState().agentLockEntity(target.kind, target.id);
|
|
2224
|
+
if (agentTakesEntityBack(name, input)) ui.getState().setAgentHandoff(null);
|
|
2225
|
+
transcript.onToolCall?.(name, input, toolCallId);
|
|
2226
|
+
},
|
|
2227
|
+
onToolResult: (toolCallId, outcome) => {
|
|
2228
|
+
const settledGenerate = outcome.status === "ok" && this.isGenerate(threadId, toolCallId);
|
|
2229
|
+
transcript.onToolResult?.(toolCallId, outcome);
|
|
2230
|
+
if (settledGenerate) this.appendSuggestionsCard(threadId, toolCallId);
|
|
2231
|
+
this.hosts.get(threadId)?.reroute();
|
|
2232
|
+
}
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
appendQuestionCard(threadId, name, input, toolCallId) {
|
|
2236
|
+
if (name !== QUESTION_TOOL) return false;
|
|
2237
|
+
const parsed = require_viewer.questionToolContracts[QUESTION_TOOL].input.safeParse(input);
|
|
2238
|
+
if (!parsed.success) return false;
|
|
2239
|
+
this.store.getState().appendQuestion(threadId, {
|
|
2240
|
+
options: parsed.data.options.map((option) => ({
|
|
2241
|
+
description: option.description ?? null,
|
|
2242
|
+
label: option.label
|
|
2243
|
+
})),
|
|
2244
|
+
question: parsed.data.question,
|
|
2245
|
+
toolCallId
|
|
2246
|
+
});
|
|
2247
|
+
return true;
|
|
2248
|
+
}
|
|
2249
|
+
isGenerate(threadId, toolCallId) {
|
|
2250
|
+
return this.store.getState().threads[threadId]?.transcript.some((entry) => entry.role === "activity" && entry.id === toolCallId && entry.name === GENERATE_TOOL) ?? false;
|
|
2251
|
+
}
|
|
2252
|
+
appendSuggestionsCard(threadId, toolCallId) {
|
|
2253
|
+
const owner = this.suggestBatchOwner;
|
|
2254
|
+
if (owner?.threadId !== threadId || owner.toolCallId !== toolCallId) return;
|
|
2255
|
+
const context = this.config.context;
|
|
2256
|
+
const candidates = require_viewer.selectSuggestionSession(context.ui.getState())?.candidates ?? [];
|
|
2257
|
+
if (candidates.length === 0) return;
|
|
2258
|
+
const entryId = `${toolCallId}:card`;
|
|
2259
|
+
if ((this.store.getState().threads[threadId]?.transcript ?? []).some((entry) => entry.id === entryId)) return;
|
|
2260
|
+
this.store.getState().appendSuggestions(threadId, {
|
|
2261
|
+
candidates: candidates.map((candidate) => ({
|
|
2262
|
+
ascentMeters: candidate.ascentMeters,
|
|
2263
|
+
color: candidate.color,
|
|
2264
|
+
distanceMeters: candidate.distanceMeters,
|
|
2265
|
+
durationSeconds: candidate.durationSeconds,
|
|
2266
|
+
seed: candidate.seed
|
|
2267
|
+
})),
|
|
2268
|
+
entryId
|
|
2269
|
+
});
|
|
2270
|
+
if (this.store.getState().activeTabId !== threadId) return;
|
|
2271
|
+
const bounds = (0, _mountaya_elements_geo.boundsOf)(candidates.map((candidate) => candidate.geometry));
|
|
2272
|
+
if (bounds) holdRejection(this.config.bus.dispatch(context, "studio.map.fitBounds", { bounds }));
|
|
2273
|
+
}
|
|
2274
|
+
async stagePick(seed) {
|
|
2275
|
+
const context = this.config.context;
|
|
2276
|
+
try {
|
|
2277
|
+
const applied = await this.config.bus.dispatch(context, "studio.itinerary.suggest.applyCandidate", {
|
|
2278
|
+
seed,
|
|
2279
|
+
segmentName: require_viewer.defaultSegmentName(context.ui.getState().activeItinerary?.segments?.length ?? 0)
|
|
2280
|
+
});
|
|
2281
|
+
if (isOutcome(applied)) return applied;
|
|
2282
|
+
return {
|
|
2283
|
+
code: "internal",
|
|
2284
|
+
error: "the apply of a suggested route answered no result",
|
|
2285
|
+
ok: false
|
|
2286
|
+
};
|
|
2287
|
+
} catch (err) {
|
|
2288
|
+
return require_errors.failureFromThrown(err);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
async applyPick(threadId, entryId, seed, label) {
|
|
2292
|
+
try {
|
|
2293
|
+
const applied = await this.stagePick(seed);
|
|
2294
|
+
if (!this.isOpen(threadId)) return;
|
|
2295
|
+
if (!applied.ok) {
|
|
2296
|
+
if (require_routeHazardCopy.isConfirmationWithheld(applied)) return;
|
|
2297
|
+
this.store.getState().appendError(threadId, this.config.strings.prompt.suggestionsStageError);
|
|
2298
|
+
return;
|
|
2299
|
+
}
|
|
2300
|
+
this.store.getState().chooseSuggestion(threadId, entryId, seed);
|
|
2301
|
+
this.send(threadId, label);
|
|
2302
|
+
} finally {
|
|
2303
|
+
this.stagingPicks.delete(entryId);
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
requestConfirmation(threadId, name, summary) {
|
|
2307
|
+
if (!this.isOpen(threadId)) return Promise.resolve(false);
|
|
2308
|
+
return new Promise((resolve) => {
|
|
2309
|
+
this.confirmations.get(threadId)?.(false);
|
|
2310
|
+
this.confirmations.set(threadId, resolve);
|
|
2311
|
+
this.store.getState().setPendingConfirmation(threadId, {
|
|
2312
|
+
name,
|
|
2313
|
+
summary
|
|
2314
|
+
});
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
denyPendingConfirmation(threadId) {
|
|
2318
|
+
const resolve = this.confirmations.get(threadId);
|
|
2319
|
+
if (resolve !== void 0) {
|
|
2320
|
+
this.confirmations.delete(threadId);
|
|
2321
|
+
resolve(false);
|
|
2322
|
+
}
|
|
2323
|
+
this.store.getState().clearPendingConfirmation(threadId);
|
|
2324
|
+
}
|
|
2325
|
+
faultsFor(threadId) {
|
|
2326
|
+
const { context, invalidateAiConfig, invalidateMemberships, onSignInRefused, strings } = this.config;
|
|
2327
|
+
const store = this.store;
|
|
2328
|
+
return (0, _mountaya_elements_agent.createConversationFaults)({
|
|
2329
|
+
copy: {
|
|
2330
|
+
generic: strings.prompt.errorGeneric,
|
|
2331
|
+
missingOrganization: copilotOrganizationId(context.ui.getState()) === null ? strings.copilot.errorPersonalResource : strings.copilot.errorNoResource,
|
|
2332
|
+
noAccess: strings.copilot.errorNoAccess,
|
|
2333
|
+
notConfigured: strings.copilot.errorNotConfigured,
|
|
2334
|
+
notEntitled: strings.copilot.withheld,
|
|
2335
|
+
rateLimited: strings.prompt.errorRateLimited,
|
|
2336
|
+
tooLarge: strings.prompt.errorTooLarge
|
|
2337
|
+
},
|
|
2338
|
+
invalidateAiConfig,
|
|
2339
|
+
invalidateMemberships,
|
|
2340
|
+
onSettled: () => this.syncUrl(),
|
|
2341
|
+
onSignInRefused,
|
|
2342
|
+
writer: {
|
|
2343
|
+
appendError: (message) => store.getState().appendError(threadId, message),
|
|
2344
|
+
setRunId: (runId) => store.getState().setRunId(threadId, runId),
|
|
2345
|
+
setSessionState: (state) => {
|
|
2346
|
+
this.awaitingTurn.delete(threadId);
|
|
2347
|
+
this.writeSessionState(threadId, state);
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
}
|
|
2352
|
+
routeForMessage(threadId, message) {
|
|
2353
|
+
this.lastRouted.set(threadId, message);
|
|
2354
|
+
this.route(threadId, message);
|
|
2355
|
+
}
|
|
2356
|
+
routeForState(threadId) {
|
|
2357
|
+
this.route(threadId, this.lastRouted.get(threadId) ?? "");
|
|
2358
|
+
}
|
|
2359
|
+
route(threadId, message) {
|
|
2360
|
+
const decision = selectSurfaces(message, routerStateFrom(this.config.context), this.surfaces.get(threadId) ?? []);
|
|
2361
|
+
this.surfaces.set(threadId, decision.surfaces);
|
|
2362
|
+
}
|
|
2363
|
+
openTab() {
|
|
2364
|
+
const id = this.ids.next();
|
|
2365
|
+
this.store.getState().addCopilotTab(id);
|
|
2366
|
+
this.ensureHost(id);
|
|
2367
|
+
this.syncUrl();
|
|
2368
|
+
return id;
|
|
2369
|
+
}
|
|
2370
|
+
closeTab(tabId) {
|
|
2371
|
+
this.hosts.get(tabId)?.finish();
|
|
2372
|
+
this.hosts.delete(tabId);
|
|
2373
|
+
this.surfaces.delete(tabId);
|
|
2374
|
+
this.lastRouted.delete(tabId);
|
|
2375
|
+
this.awaitingTurn.delete(tabId);
|
|
2376
|
+
this.sessionStates.delete(tabId);
|
|
2377
|
+
this.denyPendingConfirmation(tabId);
|
|
2378
|
+
const context = this.config.context;
|
|
2379
|
+
const owner = this.suggestBatchOwner;
|
|
2380
|
+
const session = require_viewer.selectSuggestionSession(context.ui.getState());
|
|
2381
|
+
if (session !== null && !session.draft && context.ui.getState().openContent !== "suggest" && (owner === null || owner.threadId === tabId)) {
|
|
2382
|
+
this.suggestBatchOwner = null;
|
|
2383
|
+
holdRejection(this.config.bus.dispatch(context, "studio.itinerary.suggest.discard", {}));
|
|
2384
|
+
}
|
|
2385
|
+
this.store.getState().closeCopilotTab(tabId);
|
|
2386
|
+
if (!this.withheld() && this.store.getState().order.length === 0) {
|
|
2387
|
+
this.openTab();
|
|
2388
|
+
return;
|
|
2389
|
+
}
|
|
2390
|
+
this.syncUrl();
|
|
2391
|
+
}
|
|
2392
|
+
showTab(tabId) {
|
|
2393
|
+
this.store.getState().setActiveTab(tabId === "withheld" && !this.withheld() ? require_tabs.SEARCH_TAB_ID : tabId);
|
|
2394
|
+
this.syncUrl();
|
|
2395
|
+
}
|
|
2396
|
+
resetThreads() {
|
|
2397
|
+
for (const id of [...this.store.getState().order]) this.closeTab(id);
|
|
2398
|
+
this.showTab(require_tabs.SEARCH_TAB_ID);
|
|
2399
|
+
}
|
|
2400
|
+
openOrReveal() {
|
|
2401
|
+
if (this.withheld()) {
|
|
2402
|
+
this.showTab(WITHHELD_TAB_ID);
|
|
2403
|
+
return WITHHELD_TAB_ID;
|
|
2404
|
+
}
|
|
2405
|
+
const existing = this.store.getState().order.at(-1);
|
|
2406
|
+
if (existing !== void 0) {
|
|
2407
|
+
this.showTab(existing);
|
|
2408
|
+
return existing;
|
|
2409
|
+
}
|
|
2410
|
+
return this.openTab();
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
var DirectorChatEngine = class {
|
|
2414
|
+
config;
|
|
2415
|
+
store;
|
|
2416
|
+
subscriptions = /* @__PURE__ */ new Set();
|
|
2417
|
+
releaseStore = null;
|
|
2418
|
+
host = null;
|
|
2419
|
+
awaitingTurn = false;
|
|
2420
|
+
sessionState = "awaiting_input";
|
|
2421
|
+
parked = true;
|
|
2422
|
+
disposed = false;
|
|
2423
|
+
constructor(options) {
|
|
2424
|
+
const { store, ...config } = options;
|
|
2425
|
+
this.config = config;
|
|
2426
|
+
this.store = store ?? require_directorThreads.createVideoDirectorStore();
|
|
2427
|
+
}
|
|
2428
|
+
getSnapshot() {
|
|
2429
|
+
return this.store.getState();
|
|
2430
|
+
}
|
|
2431
|
+
subscribe(listener) {
|
|
2432
|
+
if (this.disposed) return () => {};
|
|
2433
|
+
const subscription = { listener };
|
|
2434
|
+
this.subscriptions.add(subscription);
|
|
2435
|
+
if (this.parked) this.resume();
|
|
2436
|
+
return () => {
|
|
2437
|
+
if (!this.subscriptions.delete(subscription) || this.subscriptions.size > 0) return;
|
|
2438
|
+
if (!this.parked) this.park();
|
|
2439
|
+
};
|
|
2440
|
+
}
|
|
2441
|
+
configure(config) {
|
|
2442
|
+
this.config = config;
|
|
2443
|
+
}
|
|
2444
|
+
dispose() {
|
|
2445
|
+
if (this.disposed) return;
|
|
2446
|
+
this.disposed = true;
|
|
2447
|
+
this.closeRun();
|
|
2448
|
+
if (!this.parked) this.park();
|
|
2449
|
+
this.subscriptions.clear();
|
|
2450
|
+
const { runId, state } = this.store.getState();
|
|
2451
|
+
if (runId !== null || state !== "awaiting_input") this.store.getState().stopRun();
|
|
2452
|
+
}
|
|
2453
|
+
stop() {
|
|
2454
|
+
if (!this.live()) return;
|
|
2455
|
+
this.ensureHost().restart();
|
|
2456
|
+
this.awaitingTurn = false;
|
|
2457
|
+
this.store.getState().stopRun();
|
|
2458
|
+
}
|
|
2459
|
+
submit(message) {
|
|
2460
|
+
if (!this.live()) return;
|
|
2461
|
+
this.awaitingTurn = this.sessionState !== "running";
|
|
2462
|
+
this.writeSessionState("running");
|
|
2463
|
+
this.ensureHost().submit(message);
|
|
2464
|
+
}
|
|
2465
|
+
live() {
|
|
2466
|
+
return !this.parked && !this.disposed;
|
|
2467
|
+
}
|
|
2468
|
+
resume() {
|
|
2469
|
+
this.parked = false;
|
|
2470
|
+
this.releaseStore = this.store.subscribe(() => {
|
|
2471
|
+
require_listeners.notifyListeners(Array.from(this.subscriptions, ({ listener }) => listener));
|
|
2472
|
+
});
|
|
2473
|
+
const { runId } = this.store.getState();
|
|
2474
|
+
if (runId !== null) this.ensureHost().resume(runId, () => {
|
|
2475
|
+
this.store.getState().setRunId(null);
|
|
2476
|
+
this.settle();
|
|
2477
|
+
});
|
|
2478
|
+
}
|
|
2479
|
+
park() {
|
|
2480
|
+
this.parked = true;
|
|
2481
|
+
this.releaseStore?.();
|
|
2482
|
+
this.releaseStore = null;
|
|
2483
|
+
this.host?.dispose();
|
|
2484
|
+
this.awaitingTurn = false;
|
|
2485
|
+
if (this.store.getState().state === "running") this.store.getState().setSessionState("awaiting_input");
|
|
2486
|
+
}
|
|
2487
|
+
closeRun() {
|
|
2488
|
+
if (!this.parked) {
|
|
2489
|
+
this.host?.finish();
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const { runId, state } = this.store.getState();
|
|
2493
|
+
if (runId !== null && state !== "ended") this.config.transport.sendInput(runId, { type: "close" }).catch(() => void 0);
|
|
2494
|
+
}
|
|
2495
|
+
settle() {
|
|
2496
|
+
this.awaitingTurn = false;
|
|
2497
|
+
this.writeSessionState("awaiting_input");
|
|
2498
|
+
}
|
|
2499
|
+
reportSessionState(state) {
|
|
2500
|
+
this.sessionState = state;
|
|
2501
|
+
if (!this.live() || state === "awaiting_input" && this.awaitingTurn) return;
|
|
2502
|
+
this.awaitingTurn = false;
|
|
2503
|
+
this.writeSessionState(state);
|
|
2504
|
+
}
|
|
2505
|
+
writeSessionState(state) {
|
|
2506
|
+
if (this.store.getState().state !== state) this.store.getState().setSessionState(state);
|
|
2507
|
+
}
|
|
2508
|
+
ensureHost() {
|
|
2509
|
+
this.host ??= (0, _mountaya_elements_agent.createConversationHost)({
|
|
2510
|
+
appendUserMessage: (message) => this.store.getState().appendUserMessage(message),
|
|
2511
|
+
buildContext: () => Promise.resolve(require_directorThreads.buildVideoSnapshot(this.config.context) ?? void 0),
|
|
2512
|
+
buildSession: () => this.session(),
|
|
2513
|
+
onMissingOrganization: () => this.faults().missingOrganization(),
|
|
2514
|
+
onSendFault: (error, runGone) => this.faults().recover(runGone, error),
|
|
2515
|
+
onStartError: (organizationId, error, runId) => this.faults().handleStartError(organizationId, error, runId),
|
|
2516
|
+
resolveOrganizationId: () => this.config.organizationId
|
|
2517
|
+
});
|
|
2518
|
+
return this.host;
|
|
2519
|
+
}
|
|
2520
|
+
session() {
|
|
2521
|
+
const store = this.store;
|
|
2522
|
+
this.sessionState = "awaiting_input";
|
|
2523
|
+
return new _mountaya_elements_agent.AgentEngine({
|
|
2524
|
+
bus: this.config.bus,
|
|
2525
|
+
confirmServerTool: (confirmation) => this.config.context.confirm?.({
|
|
2526
|
+
description: this.config.strings.confirm.serverToolFallback(confirmation.name),
|
|
2527
|
+
input: void 0,
|
|
2528
|
+
name: confirmation.name
|
|
2529
|
+
}) ?? Promise.resolve(false),
|
|
2530
|
+
ctx: this.config.context,
|
|
2531
|
+
observer: transcriptObserver({
|
|
2532
|
+
errorCopy: () => this.config.errorCopy,
|
|
2533
|
+
writer: {
|
|
2534
|
+
appendAssistantDelta: (delta) => store.getState().appendAssistantDelta(delta),
|
|
2535
|
+
appendError: (message) => store.getState().appendError(message),
|
|
2536
|
+
appendToolActivity: (activity) => store.getState().appendToolActivity(activity),
|
|
2537
|
+
setActiveTool: (summary) => store.getState().setActiveTool(summary),
|
|
2538
|
+
setAssistantMessage: (content) => store.getState().setAssistantMessage(content),
|
|
2539
|
+
setRunId: (runId) => store.getState().setRunId(runId),
|
|
2540
|
+
setSessionState: (state) => this.reportSessionState(state),
|
|
2541
|
+
settleToolActivity: (toolCallId, outcome) => store.getState().settleToolActivity(toolCallId, outcome)
|
|
2542
|
+
}
|
|
2543
|
+
}),
|
|
2544
|
+
profile: "video-director",
|
|
2545
|
+
recoveryFor: (tool, code) => studioRecoveryFor(tool, code, this.config.recoveryAddendum),
|
|
2546
|
+
transport: this.config.transport
|
|
2547
|
+
});
|
|
2548
|
+
}
|
|
2549
|
+
faults() {
|
|
2550
|
+
const { invalidateAiConfig, strings } = this.config;
|
|
2551
|
+
const store = this.store;
|
|
2552
|
+
return (0, _mountaya_elements_agent.createConversationFaults)({
|
|
2553
|
+
copy: {
|
|
2554
|
+
generic: strings.prompt.errorGeneric,
|
|
2555
|
+
missingOrganization: strings.director.errorNoOrganization,
|
|
2556
|
+
noAccess: strings.copilot.errorNoAccess,
|
|
2557
|
+
notConfigured: strings.copilot.errorNotConfigured,
|
|
2558
|
+
notEntitled: strings.copilot.withheld,
|
|
2559
|
+
rateLimited: strings.prompt.errorRateLimited,
|
|
2560
|
+
tooLarge: strings.prompt.errorTooLarge
|
|
2561
|
+
},
|
|
2562
|
+
invalidateAiConfig,
|
|
2563
|
+
writer: {
|
|
2564
|
+
appendError: (message) => store.getState().appendError(message),
|
|
2565
|
+
setRunId: (runId) => store.getState().setRunId(runId),
|
|
2566
|
+
setSessionState: (state) => {
|
|
2567
|
+
this.awaitingTurn = false;
|
|
2568
|
+
this.writeSessionState(state);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
});
|
|
2572
|
+
}
|
|
2573
|
+
};
|
|
2574
|
+
const agentErrorCopy = (strings) => ({
|
|
2575
|
+
accessRevoked: strings.prompt.errorAccessRevoked,
|
|
2576
|
+
budget: {
|
|
2577
|
+
cost: strings.prompt.budgetCost,
|
|
2578
|
+
generic: strings.prompt.budgetGeneric,
|
|
2579
|
+
turns: strings.prompt.budgetTurns
|
|
2580
|
+
},
|
|
2581
|
+
generic: strings.prompt.errorGeneric,
|
|
2582
|
+
looping: strings.prompt.errorLooping,
|
|
2583
|
+
notConfigured: strings.copilot.errorNotConfigured,
|
|
2584
|
+
rateLimited: strings.prompt.errorRateLimited
|
|
2585
|
+
});
|
|
2586
|
+
exports.AgentThreadsEngine = AgentThreadsEngine;
|
|
2587
|
+
exports.DirectorChatEngine = DirectorChatEngine;
|
|
2588
|
+
exports.PLAYBOOK = PLAYBOOK;
|
|
2589
|
+
exports.SEARCH_TAB_ID = require_tabs.SEARCH_TAB_ID;
|
|
2590
|
+
exports.SURFACES = SURFACES;
|
|
2591
|
+
exports.WITHHELD_TAB_ID = WITHHELD_TAB_ID;
|
|
2592
|
+
exports.agentErrorCopy = agentErrorCopy;
|
|
2593
|
+
exports.copilotOrganizationId = copilotOrganizationId;
|
|
2594
|
+
exports.createAgentThreadsStore = createAgentThreadsStore;
|
|
2595
|
+
exports.recoveryFor = recoveryFor;
|
|
2596
|
+
exports.selectAgentDriving = selectAgentDriving;
|
|
2597
|
+
exports.selectSurfaces = selectSurfaces;
|
|
2598
|
+
exports.surfaceTools = surfaceTools;
|
|
2599
|
+
|
|
2600
|
+
//# sourceMappingURL=index.cjs.map
|