feat(tours): the assistant edits stations, reverses and closes tours, sets breaks, colour and copies, and writes ski and paddle plans

City walk changes take edit, reverse and close_loop; edits alone keep the
saved way and never ask the router. update_tour turns a hike round or closes
its loop with reshape. New MCP tools mirror the Tours tab's REST writes and
reads: update_tour_details, set_tour_route_color, copy_tour,
classify_ski_track, set_paddle_plan, decide_paddle_obstacles,
restore_recorded_track, get_tour_trail_details and find_horse_routes, with
change cards, undo where the answer keeps the values before, and broadcast
parity cases.
This commit is contained in:
Maurice
2026-10-23 21:07:41 +02:00
parent 338548bf7f
commit c418eef7ce
68 changed files with 3574 additions and 39 deletions
+2
View File
@@ -170,6 +170,8 @@ export const ASSISTANT_CHANGE_LABEL_KEYS = [
// The recorded track a tour was done on; the part of the packing list a tour points at.
'track',
'packing',
// The minutes of breaks a tour plans on top of its moving time.
'breaks',
// A new order of a day's places or of the days, as the names in that order.
'order',
// An argument of a tool without a card of its own; the row names it in `field`.
@@ -27,6 +27,16 @@ export const TOUR_VERB_KEYS = [
// A tour pointed at its trip's packing list, or let go of it.
'linkPacking',
'unlinkPacking',
// A saved tour turned round or taken back to its start, copied, or its line drawn in another colour.
'reverseTour',
'closeLoop',
'copyTour',
'setRouteColor',
// The writes of a ski or paddle tour of its own, and a planned import taken back to its recording.
'classifySki',
'setPaddlePlan',
'decideObstacles',
'restoreTrack',
] as const;
/** 'tour' is a core entity already. */
export const TOUR_APPLIED_ENTITIES = [] as const;
+9
View File
@@ -498,11 +498,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'احتسابها في الإحصاءات مجددًا',
'assistant.change.verb.linkPacking': 'ربط قائمة التعبئة',
'assistant.change.verb.unlinkPacking': 'فك ربط قائمة التعبئة',
'assistant.change.verb.reverseTour': 'عكس اتجاه الجولة',
'assistant.change.verb.closeLoop': 'إغلاق الحلقة',
'assistant.change.verb.copyTour': 'نسخ الجولة',
'assistant.change.verb.setRouteColor': 'تغيير لون المسار',
'assistant.change.verb.classifySki': 'تغيير نوع التزلج',
'assistant.change.verb.setPaddlePlan': 'تغيير خطة التجديف',
'assistant.change.verb.decideObstacles': 'اتخاذ قرار بشأن العوائق',
'assistant.change.verb.restoreTrack': 'العودة إلى المسار المسجل',
'assistant.change.verb.importTour': 'إضافة جولة من ملف',
'assistant.change.label.field': 'القيمة',
'assistant.change.label.difficulty': 'أقصى مستوى لصعوبة الدرب',
'assistant.change.label.track': 'مسار مسجل',
'assistant.change.label.packing': 'قائمة التعبئة',
'assistant.change.label.breaks': 'الاستراحات',
'assistant.domain.tours': 'الجولات',
'assistant.domain.roadtrip': 'رحلة برية',
'assistant.domain.journey': 'يوميات السفر',
+9
View File
@@ -421,11 +421,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Yenidən statistikaya daxil et',
'assistant.change.verb.linkPacking': 'Əşya siyahısını bağla',
'assistant.change.verb.unlinkPacking': 'Əşya siyahısını ayır',
'assistant.change.verb.reverseTour': 'Turu tərsinə çevir',
'assistant.change.verb.closeLoop': 'Dairəni bağla',
'assistant.change.verb.copyTour': 'Turu kopyala',
'assistant.change.verb.setRouteColor': 'Marşrutun rəngini dəyiş',
'assistant.change.verb.classifySki': 'Xizək növünü dəyiş',
'assistant.change.verb.setPaddlePlan': 'Avarçəkmə planını dəyiş',
'assistant.change.verb.decideObstacles': 'Maneələr barədə qərar ver',
'assistant.change.verb.restoreTrack': 'Yazılmış treke qayıt',
'assistant.change.verb.importTour': 'Fayldan tur əlavə et',
'assistant.change.label.field': 'Dəyər',
'assistant.change.label.difficulty': 'Maksimum cığır çətinliyi',
'assistant.change.label.track': 'Qeydə alınmış marşrut',
'assistant.change.label.packing': 'Əşya siyahısı',
'assistant.change.label.breaks': 'Fasilələr',
'assistant.domain.tours': 'Turlar',
'assistant.domain.roadtrip': 'Avtosəyahət',
'assistant.domain.journey': 'Səyahət gündəliyi',
+9
View File
@@ -421,11 +421,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Contar nas estatísticas de novo',
'assistant.change.verb.linkPacking': 'Vincular lista de bagagem',
'assistant.change.verb.unlinkPacking': 'Desvincular lista de bagagem',
'assistant.change.verb.reverseTour': 'Inverter passeio',
'assistant.change.verb.closeLoop': 'Fechar o circuito',
'assistant.change.verb.copyTour': 'Copiar passeio',
'assistant.change.verb.setRouteColor': 'Alterar cor da rota',
'assistant.change.verb.classifySki': 'Alterar modalidade de esqui',
'assistant.change.verb.setPaddlePlan': 'Alterar plano de remada',
'assistant.change.verb.decideObstacles': 'Decidir sobre obstáculos',
'assistant.change.verb.restoreTrack': 'Voltar ao trajeto gravado',
'assistant.change.verb.importTour': 'Adicionar passeio a partir de arquivo',
'assistant.change.label.field': 'Valor',
'assistant.change.label.difficulty': 'Dificuldade máxima da trilha',
'assistant.change.label.track': 'Trilha gravada',
'assistant.change.label.packing': 'Lista de bagagem',
'assistant.change.label.breaks': 'Pausas',
'assistant.domain.tours': 'Passeios',
'assistant.domain.roadtrip': 'Viagem de carro',
'assistant.domain.journey': 'Jornada',
+9
View File
@@ -424,11 +424,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Torna a comptar a les estadístiques',
'assistant.change.verb.linkPacking': 'Enllaça la llista d’equipatge',
'assistant.change.verb.unlinkPacking': 'Desenllaça la llista d’equipatge',
'assistant.change.verb.reverseTour': "Invertir l'excursió",
'assistant.change.verb.closeLoop': 'Tancar el circuit',
'assistant.change.verb.copyTour': "Copiar l'excursió",
'assistant.change.verb.setRouteColor': 'Canviar el color de la ruta',
'assistant.change.verb.classifySki': "Canviar la modalitat d'esquí",
'assistant.change.verb.setPaddlePlan': 'Canviar el pla de rem',
'assistant.change.verb.decideObstacles': 'Decidir sobre els obstacles',
'assistant.change.verb.restoreTrack': 'Tornar a la traça gravada',
'assistant.change.verb.importTour': 'Afegeix una excursió des d’un fitxer',
'assistant.change.label.field': 'Valor',
'assistant.change.label.difficulty': 'Dificultat màxima del sender',
'assistant.change.label.track': 'Traç enregistrat',
'assistant.change.label.packing': 'Llista d’equipatge',
'assistant.change.label.breaks': 'Pauses',
'assistant.domain.tours': 'Rutes',
'assistant.domain.roadtrip': 'Viatge per carretera',
'assistant.domain.journey': 'Diari de viatge',
+9
View File
@@ -439,11 +439,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Znovu počítat do statistik',
'assistant.change.verb.linkPacking': 'Propojit seznam balení',
'assistant.change.verb.unlinkPacking': 'Odpojit seznam balení',
'assistant.change.verb.reverseTour': 'Otočit túru',
'assistant.change.verb.closeLoop': 'Uzavřít okruh',
'assistant.change.verb.copyTour': 'Kopírovat túru',
'assistant.change.verb.setRouteColor': 'Změnit barvu trasy',
'assistant.change.verb.classifySki': 'Změnit lyžařskou disciplínu',
'assistant.change.verb.setPaddlePlan': 'Změnit plán pádlování',
'assistant.change.verb.decideObstacles': 'Rozhodnout o překážkách',
'assistant.change.verb.restoreTrack': 'Zpět k zaznamenané stopě',
'assistant.change.verb.importTour': 'Přidat výlet ze souboru',
'assistant.change.label.field': 'Hodnota',
'assistant.change.label.difficulty': 'Maximální obtížnost stezky',
'assistant.change.label.track': 'Zaznamenaná trasa',
'assistant.change.label.packing': 'Seznam balení',
'assistant.change.label.breaks': 'Přestávky',
'assistant.domain.tours': 'Túry',
'assistant.domain.roadtrip': 'Cesta autem',
'assistant.domain.journey': 'Cestovní deník',
+9
View File
@@ -421,11 +421,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Wieder in Statistik zählen',
'assistant.change.verb.linkPacking': 'Packliste verknüpfen',
'assistant.change.verb.unlinkPacking': 'Packliste lösen',
'assistant.change.verb.reverseTour': 'Tour umdrehen',
'assistant.change.verb.closeLoop': 'Rundtour schließen',
'assistant.change.verb.copyTour': 'Tour kopieren',
'assistant.change.verb.setRouteColor': 'Routenfarbe ändern',
'assistant.change.verb.classifySki': 'Ski-Disziplin ändern',
'assistant.change.verb.setPaddlePlan': 'Paddelplan ändern',
'assistant.change.verb.decideObstacles': 'Über Hindernisse entscheiden',
'assistant.change.verb.restoreTrack': 'Zurück zur Aufzeichnung',
'assistant.change.verb.importTour': 'Tour aus Datei hinzufügen',
'assistant.change.label.field': 'Wert',
'assistant.change.label.difficulty': 'Maximale Wegschwierigkeit',
'assistant.change.label.track': 'Aufzeichnung',
'assistant.change.label.packing': 'Packliste',
'assistant.change.label.breaks': 'Pausen',
'assistant.domain.tours': 'Touren',
'assistant.domain.roadtrip': 'Roadtrip',
'assistant.domain.journey': 'Reisetagebuch',
+9
View File
@@ -415,11 +415,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Count in stats again',
'assistant.change.verb.linkPacking': 'Link packing list',
'assistant.change.verb.unlinkPacking': 'Unlink packing list',
'assistant.change.verb.reverseTour': 'Reverse tour',
'assistant.change.verb.closeLoop': 'Close the loop',
'assistant.change.verb.copyTour': 'Copy tour',
'assistant.change.verb.setRouteColor': 'Change route colour',
'assistant.change.verb.classifySki': 'Change ski discipline',
'assistant.change.verb.setPaddlePlan': 'Change paddle plan',
'assistant.change.verb.decideObstacles': 'Decide on obstacles',
'assistant.change.verb.restoreTrack': 'Back to recorded track',
'assistant.change.verb.importTour': 'Add tour from file',
'assistant.change.label.field': 'Value',
'assistant.change.label.difficulty': 'Maximum trail difficulty',
'assistant.change.label.track': 'Recorded track',
'assistant.change.label.packing': 'Packing list',
'assistant.change.label.breaks': 'Breaks',
'assistant.domain.tours': 'Tours',
'assistant.domain.roadtrip': 'Road trip',
'assistant.domain.journey': 'Journey',
+9
View File
@@ -419,11 +419,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Volver a contar en estadísticas',
'assistant.change.verb.linkPacking': 'Vincular lista de equipaje',
'assistant.change.verb.unlinkPacking': 'Desvincular lista de equipaje',
'assistant.change.verb.reverseTour': 'Invertir ruta',
'assistant.change.verb.closeLoop': 'Cerrar el circuito',
'assistant.change.verb.copyTour': 'Copiar ruta',
'assistant.change.verb.setRouteColor': 'Cambiar color de la ruta',
'assistant.change.verb.classifySki': 'Cambiar modalidad de esquí',
'assistant.change.verb.setPaddlePlan': 'Cambiar plan de remo',
'assistant.change.verb.decideObstacles': 'Decidir sobre obstáculos',
'assistant.change.verb.restoreTrack': 'Volver al track grabado',
'assistant.change.verb.importTour': 'Añadir excursión desde archivo',
'assistant.change.label.field': 'Valor',
'assistant.change.label.difficulty': 'Dificultad máxima del sendero',
'assistant.change.label.track': 'Track grabado',
'assistant.change.label.packing': 'Lista de equipaje',
'assistant.change.label.breaks': 'Pausas',
'assistant.domain.tours': 'Rutas',
'assistant.domain.roadtrip': 'Viaje por carretera',
'assistant.domain.journey': 'Diario de viaje',
+9
View File
@@ -420,11 +420,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Arvesta taas statistikasse',
'assistant.change.verb.linkPacking': 'Seo pakkimisnimekiri',
'assistant.change.verb.unlinkPacking': 'Eemalda pakkimisnimekirja seos',
'assistant.change.verb.reverseTour': 'Pööra retk ümber',
'assistant.change.verb.closeLoop': 'Sulge ring',
'assistant.change.verb.copyTour': 'Kopeeri retk',
'assistant.change.verb.setRouteColor': 'Muuda marsruudi värvi',
'assistant.change.verb.classifySki': 'Muuda suusaala',
'assistant.change.verb.setPaddlePlan': 'Muuda aerutamisplaani',
'assistant.change.verb.decideObstacles': 'Otsusta takistuste üle',
'assistant.change.verb.restoreTrack': 'Tagasi salvestatud raja juurde',
'assistant.change.verb.importTour': 'Lisa retk failist',
'assistant.change.label.field': 'Väärtus',
'assistant.change.label.difficulty': 'Raja suurim raskusaste',
'assistant.change.label.track': 'Salvestatud rada',
'assistant.change.label.packing': 'Pakkimisnimekiri',
'assistant.change.label.breaks': 'Pausid',
'assistant.domain.tours': 'Matkad',
'assistant.domain.roadtrip': 'Autoreis',
'assistant.domain.journey': 'Reisipäevik',
+9
View File
@@ -426,11 +426,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Recompter dans les statistiques',
'assistant.change.verb.linkPacking': 'Lier la liste de bagages',
'assistant.change.verb.unlinkPacking': 'Délier la liste de bagages',
'assistant.change.verb.reverseTour': "Inverser l'itinéraire",
'assistant.change.verb.closeLoop': 'Fermer la boucle',
'assistant.change.verb.copyTour': "Copier l'itinéraire",
'assistant.change.verb.setRouteColor': 'Changer la couleur du tracé',
'assistant.change.verb.classifySki': 'Changer la discipline de ski',
'assistant.change.verb.setPaddlePlan': 'Modifier le plan de pagaie',
'assistant.change.verb.decideObstacles': 'Décider des obstacles',
'assistant.change.verb.restoreTrack': 'Revenir à la trace enregistrée',
'assistant.change.verb.importTour': 'Ajouter une sortie depuis un fichier',
'assistant.change.label.field': 'Valeur',
'assistant.change.label.difficulty': 'Difficulté maximale du sentier',
'assistant.change.label.track': 'Trace enregistrée',
'assistant.change.label.packing': 'Liste de bagages',
'assistant.change.label.breaks': 'Pauses',
'assistant.domain.tours': 'Randonnées',
'assistant.domain.roadtrip': 'Voyage en voiture',
'assistant.domain.journey': 'Carnet de voyage',
+9
View File
@@ -425,11 +425,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Ξανά μέτρηση στα στατιστικά',
'assistant.change.verb.linkPacking': 'Σύνδεση λίστας αποσκευών',
'assistant.change.verb.unlinkPacking': 'Αποσύνδεση λίστας αποσκευών',
'assistant.change.verb.reverseTour': 'Αντιστροφή εκδρομής',
'assistant.change.verb.closeLoop': 'Κλείσιμο κυκλικής διαδρομής',
'assistant.change.verb.copyTour': 'Αντιγραφή εκδρομής',
'assistant.change.verb.setRouteColor': 'Αλλαγή χρώματος διαδρομής',
'assistant.change.verb.classifySki': 'Αλλαγή είδους σκι',
'assistant.change.verb.setPaddlePlan': 'Αλλαγή σχεδίου κουπιού',
'assistant.change.verb.decideObstacles': 'Απόφαση για εμπόδια',
'assistant.change.verb.restoreTrack': 'Επιστροφή στην καταγεγραμμένη διαδρομή',
'assistant.change.verb.importTour': 'Προσθήκη εκδρομής από αρχείο',
'assistant.change.label.field': 'Τιμή',
'assistant.change.label.difficulty': 'Μέγιστη δυσκολία μονοπατιού',
'assistant.change.label.track': 'Καταγεγραμμένη διαδρομή',
'assistant.change.label.packing': 'Λίστα αποσκευών',
'assistant.change.label.breaks': 'Διαλείμματα',
'assistant.domain.tours': 'Διαδρομές',
'assistant.domain.roadtrip': 'Οδικό ταξίδι',
'assistant.domain.journey': 'Ημερολόγιο ταξιδιού',
+9
View File
@@ -426,11 +426,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Újra beszámítás a statisztikába',
'assistant.change.verb.linkPacking': 'Csomaglista összekapcsolása',
'assistant.change.verb.unlinkPacking': 'Csomaglista leválasztása',
'assistant.change.verb.reverseTour': 'Túra megfordítása',
'assistant.change.verb.closeLoop': 'Kör bezárása',
'assistant.change.verb.copyTour': 'Túra másolása',
'assistant.change.verb.setRouteColor': 'Útvonal színének módosítása',
'assistant.change.verb.classifySki': 'Sísportág módosítása',
'assistant.change.verb.setPaddlePlan': 'Evezési terv módosítása',
'assistant.change.verb.decideObstacles': 'Döntés az akadályokról',
'assistant.change.verb.restoreTrack': 'Vissza a rögzített nyomvonalhoz',
'assistant.change.verb.importTour': 'Túra hozzáadása fájlból',
'assistant.change.label.field': 'Érték',
'assistant.change.label.difficulty': 'Ösvény legnagyobb nehézsége',
'assistant.change.label.track': 'Rögzített nyomvonal',
'assistant.change.label.packing': 'Csomaglista',
'assistant.change.label.breaks': 'Szünetek',
'assistant.domain.tours': 'Túrák',
'assistant.domain.roadtrip': 'Autós körút',
'assistant.domain.journey': 'Útinapló',
+9
View File
@@ -400,11 +400,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Hitung lagi di statistik',
'assistant.change.verb.linkPacking': 'Tautkan daftar bawaan',
'assistant.change.verb.unlinkPacking': 'Lepas tautan daftar bawaan',
'assistant.change.verb.reverseTour': 'Balik arah tur',
'assistant.change.verb.closeLoop': 'Tutup putaran',
'assistant.change.verb.copyTour': 'Salin tur',
'assistant.change.verb.setRouteColor': 'Ubah warna rute',
'assistant.change.verb.classifySki': 'Ubah disiplin ski',
'assistant.change.verb.setPaddlePlan': 'Ubah rencana dayung',
'assistant.change.verb.decideObstacles': 'Putuskan soal rintangan',
'assistant.change.verb.restoreTrack': 'Kembali ke jejak rekaman',
'assistant.change.verb.importTour': 'Tambah tur dari file',
'assistant.change.label.field': 'Nilai',
'assistant.change.label.difficulty': 'Tingkat kesulitan jalur maksimum',
'assistant.change.label.track': 'Jejak terekam',
'assistant.change.label.packing': 'Daftar bawaan',
'assistant.change.label.breaks': 'Istirahat',
'assistant.domain.tours': 'Tur',
'assistant.domain.roadtrip': 'Perjalanan darat',
'assistant.domain.journey': 'Jurnal perjalanan',
+9
View File
@@ -427,11 +427,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Conta di nuovo nelle statistiche',
'assistant.change.verb.linkPacking': 'Collega lista bagagli',
'assistant.change.verb.unlinkPacking': 'Scollega lista bagagli',
'assistant.change.verb.reverseTour': 'Inverti il tour',
'assistant.change.verb.closeLoop': 'Chiudi il giro',
'assistant.change.verb.copyTour': 'Copia il tour',
'assistant.change.verb.setRouteColor': 'Cambia colore del percorso',
'assistant.change.verb.classifySki': 'Cambia disciplina sciistica',
'assistant.change.verb.setPaddlePlan': 'Cambia piano di pagaiata',
'assistant.change.verb.decideObstacles': 'Decidi sugli ostacoli',
'assistant.change.verb.restoreTrack': 'Torna alla traccia registrata',
'assistant.change.verb.importTour': 'Aggiungi escursione da file',
'assistant.change.label.field': 'Valore',
'assistant.change.label.difficulty': 'Difficoltà massima del sentiero',
'assistant.change.label.track': 'Traccia registrata',
'assistant.change.label.packing': 'Lista bagagli',
'assistant.change.label.breaks': 'Soste',
'assistant.domain.tours': 'Percorsi',
'assistant.domain.roadtrip': 'Viaggio su strada',
'assistant.domain.journey': 'Diario di viaggio',
+9
View File
@@ -395,11 +395,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': '統計に再び含める',
'assistant.change.verb.linkPacking': '持ち物リストを紐付け',
'assistant.change.verb.unlinkPacking': '持ち物リストの紐付けを解除',
'assistant.change.verb.reverseTour': 'ツアーを逆向きにする',
'assistant.change.verb.closeLoop': '周回ルートにする',
'assistant.change.verb.copyTour': 'ツアーをコピー',
'assistant.change.verb.setRouteColor': 'ルートの色を変更',
'assistant.change.verb.classifySki': 'スキーの種目を変更',
'assistant.change.verb.setPaddlePlan': 'パドル計画を変更',
'assistant.change.verb.decideObstacles': '障害物について決める',
'assistant.change.verb.restoreTrack': '記録したトラックに戻す',
'assistant.change.verb.importTour': 'ファイルからツアーを追加',
'assistant.change.label.field': '値',
'assistant.change.label.difficulty': '登山道の難易度上限',
'assistant.change.label.track': '記録トラック',
'assistant.change.label.packing': '持ち物リスト',
'assistant.change.label.breaks': '休憩',
'assistant.domain.tours': 'ツアー',
'assistant.domain.roadtrip': 'ロードトリップ',
'assistant.domain.journey': '旅行記',
+9
View File
@@ -391,11 +391,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': '통계에 다시 포함',
'assistant.change.verb.linkPacking': '짐 목록 연결',
'assistant.change.verb.unlinkPacking': '짐 목록 연결 해제',
'assistant.change.verb.reverseTour': '투어 방향 뒤집기',
'assistant.change.verb.closeLoop': '순환 코스로 만들기',
'assistant.change.verb.copyTour': '투어 복사',
'assistant.change.verb.setRouteColor': '경로 색상 변경',
'assistant.change.verb.classifySki': '스키 종목 변경',
'assistant.change.verb.setPaddlePlan': '패들 계획 변경',
'assistant.change.verb.decideObstacles': '장애물 결정',
'assistant.change.verb.restoreTrack': '기록된 트랙으로 되돌리기',
'assistant.change.verb.importTour': '파일에서 투어 추가',
'assistant.change.label.field': '값',
'assistant.change.label.difficulty': '탐방로 최대 난이도',
'assistant.change.label.track': '기록된 트랙',
'assistant.change.label.packing': '짐 목록',
'assistant.change.label.breaks': '휴식',
'assistant.domain.tours': '투어',
'assistant.domain.roadtrip': '로드 트립',
'assistant.domain.journey': '여행 일지',
+9
View File
@@ -422,11 +422,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Weer meetellen in statistieken',
'assistant.change.verb.linkPacking': 'Paklijst koppelen',
'assistant.change.verb.unlinkPacking': 'Paklijst ontkoppelen',
'assistant.change.verb.reverseTour': 'Tour omdraaien',
'assistant.change.verb.closeLoop': 'Rondje sluiten',
'assistant.change.verb.copyTour': 'Tour kopiëren',
'assistant.change.verb.setRouteColor': 'Routekleur wijzigen',
'assistant.change.verb.classifySki': 'Skidiscipline wijzigen',
'assistant.change.verb.setPaddlePlan': 'Peddelplan wijzigen',
'assistant.change.verb.decideObstacles': 'Over obstakels beslissen',
'assistant.change.verb.restoreTrack': 'Terug naar opgenomen track',
'assistant.change.verb.importTour': 'Tocht uit bestand toevoegen',
'assistant.change.label.field': 'Waarde',
'assistant.change.label.difficulty': 'Maximale moeilijkheid van het pad',
'assistant.change.label.track': 'Opgenomen track',
'assistant.change.label.packing': 'Paklijst',
'assistant.change.label.breaks': 'Pauzes',
'assistant.domain.tours': 'Routes',
'assistant.domain.roadtrip': 'Roadtrip',
'assistant.domain.journey': 'Reisdagboek',
+9
View File
@@ -464,11 +464,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Licz ponownie w statystykach',
'assistant.change.verb.linkPacking': 'Połącz listę pakowania',
'assistant.change.verb.unlinkPacking': 'Odłącz listę pakowania',
'assistant.change.verb.reverseTour': 'Odwróć trasę',
'assistant.change.verb.closeLoop': 'Zamknij pętlę',
'assistant.change.verb.copyTour': 'Kopiuj trasę',
'assistant.change.verb.setRouteColor': 'Zmień kolor trasy',
'assistant.change.verb.classifySki': 'Zmień dyscyplinę narciarską',
'assistant.change.verb.setPaddlePlan': 'Zmień plan spływu',
'assistant.change.verb.decideObstacles': 'Zdecyduj o przeszkodach',
'assistant.change.verb.restoreTrack': 'Wróć do nagranego śladu',
'assistant.change.verb.importTour': 'Dodaj wycieczkę z pliku',
'assistant.change.label.field': 'Wartość',
'assistant.change.label.difficulty': 'Maksymalna trudność szlaku',
'assistant.change.label.track': 'Nagrany ślad',
'assistant.change.label.packing': 'Lista pakowania',
'assistant.change.label.breaks': 'Przerwy',
'assistant.domain.tours': 'Trasy',
'assistant.domain.roadtrip': 'Podróż samochodem',
'assistant.domain.journey': 'Dziennik podróży',
+9
View File
@@ -464,11 +464,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Снова учитывать в статистике',
'assistant.change.verb.linkPacking': 'Связать список вещей',
'assistant.change.verb.unlinkPacking': 'Отвязать список вещей',
'assistant.change.verb.reverseTour': 'Развернуть маршрут',
'assistant.change.verb.closeLoop': 'Замкнуть петлю',
'assistant.change.verb.copyTour': 'Копировать маршрут',
'assistant.change.verb.setRouteColor': 'Изменить цвет маршрута',
'assistant.change.verb.classifySki': 'Изменить лыжную дисциплину',
'assistant.change.verb.setPaddlePlan': 'Изменить план сплава',
'assistant.change.verb.decideObstacles': 'Решить по препятствиям',
'assistant.change.verb.restoreTrack': 'Вернуть записанный трек',
'assistant.change.verb.importTour': 'Добавить тур из файла',
'assistant.change.label.field': 'Значение',
'assistant.change.label.difficulty': 'Максимальная сложность тропы',
'assistant.change.label.track': 'Записанный трек',
'assistant.change.label.packing': 'Список вещей',
'assistant.change.label.breaks': 'Перерывы',
'assistant.domain.tours': 'Маршруты',
'assistant.domain.roadtrip': 'Автопутешествие',
'assistant.domain.journey': 'Дневник путешествий',
+9
View File
@@ -439,11 +439,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Znova počítať do štatistík',
'assistant.change.verb.linkPacking': 'Prepojiť zoznam balenia',
'assistant.change.verb.unlinkPacking': 'Odpojiť zoznam balenia',
'assistant.change.verb.reverseTour': 'Otočiť túru',
'assistant.change.verb.closeLoop': 'Uzavrieť okruh',
'assistant.change.verb.copyTour': 'Kopírovať túru',
'assistant.change.verb.setRouteColor': 'Zmeniť farbu trasy',
'assistant.change.verb.classifySki': 'Zmeniť lyžiarsku disciplínu',
'assistant.change.verb.setPaddlePlan': 'Zmeniť plán pádlovania',
'assistant.change.verb.decideObstacles': 'Rozhodnúť o prekážkach',
'assistant.change.verb.restoreTrack': 'Späť na zaznamenanú stopu',
'assistant.change.verb.importTour': 'Pridať túru zo súboru',
'assistant.change.label.field': 'Hodnota',
'assistant.change.label.difficulty': 'Maximálna náročnosť chodníka',
'assistant.change.label.track': 'Zaznamenaná trasa',
'assistant.change.label.packing': 'Zoznam balenia',
'assistant.change.label.breaks': 'Prestávky',
'assistant.domain.tours': 'Túry',
'assistant.domain.roadtrip': 'Cesta autom',
'assistant.domain.journey': 'Cestovný denník',
+9
View File
@@ -420,11 +420,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Räkna med i statistiken igen',
'assistant.change.verb.linkPacking': 'Koppla packlista',
'assistant.change.verb.unlinkPacking': 'Koppla från packlista',
'assistant.change.verb.reverseTour': 'Vänd turen',
'assistant.change.verb.closeLoop': 'Stäng slingan',
'assistant.change.verb.copyTour': 'Kopiera tur',
'assistant.change.verb.setRouteColor': 'Ändra ruttfärg',
'assistant.change.verb.classifySki': 'Ändra skidgren',
'assistant.change.verb.setPaddlePlan': 'Ändra paddelplan',
'assistant.change.verb.decideObstacles': 'Besluta om hinder',
'assistant.change.verb.restoreTrack': 'Tillbaka till inspelat spår',
'assistant.change.verb.importTour': 'Lägg till tur från fil',
'assistant.change.label.field': 'Värde',
'assistant.change.label.difficulty': 'Högsta svårighetsgrad för leden',
'assistant.change.label.track': 'Inspelat spår',
'assistant.change.label.packing': 'Packlista',
'assistant.change.label.breaks': 'Pauser',
'assistant.domain.tours': 'Turer',
'assistant.domain.roadtrip': 'Bilresa',
'assistant.domain.journey': 'Resedagbok',
+9
View File
@@ -392,11 +392,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'นับในสถิติอีกครั้ง',
'assistant.change.verb.linkPacking': 'เชื่อมรายการของที่ต้องเตรียม',
'assistant.change.verb.unlinkPacking': 'ยกเลิกการเชื่อมรายการของ',
'assistant.change.verb.reverseTour': 'กลับทิศทัวร์',
'assistant.change.verb.closeLoop': 'ปิดเป็นเส้นทางวน',
'assistant.change.verb.copyTour': 'คัดลอกทัวร์',
'assistant.change.verb.setRouteColor': 'เปลี่ยนสีเส้นทาง',
'assistant.change.verb.classifySki': 'เปลี่ยนประเภทสกี',
'assistant.change.verb.setPaddlePlan': 'เปลี่ยนแผนพายเรือ',
'assistant.change.verb.decideObstacles': 'ตัดสินใจเรื่องสิ่งกีดขวาง',
'assistant.change.verb.restoreTrack': 'กลับไปใช้เส้นทางที่บันทึกไว้',
'assistant.change.verb.importTour': 'เพิ่มทัวร์จากไฟล์',
'assistant.change.label.field': 'ค่า',
'assistant.change.label.difficulty': 'ระดับความยากสูงสุดของทางเดิน',
'assistant.change.label.track': 'เส้นทางที่บันทึก',
'assistant.change.label.packing': 'รายการของที่ต้องเตรียม',
'assistant.change.label.breaks': 'ช่วงพัก',
'assistant.domain.tours': 'ทัวร์',
'assistant.domain.roadtrip': 'โรดทริป',
'assistant.domain.journey': 'บันทึกการเดินทาง',
+9
View File
@@ -420,11 +420,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'İstatistiklere yeniden kat',
'assistant.change.verb.linkPacking': 'Bavul listesini bağla',
'assistant.change.verb.unlinkPacking': 'Bavul listesinin bağını kaldır',
'assistant.change.verb.reverseTour': 'Turu ters çevir',
'assistant.change.verb.closeLoop': 'Döngüyü kapat',
'assistant.change.verb.copyTour': 'Turu kopyala',
'assistant.change.verb.setRouteColor': 'Rota rengini değiştir',
'assistant.change.verb.classifySki': 'Kayak disiplinini değiştir',
'assistant.change.verb.setPaddlePlan': 'Kürek planını değiştir',
'assistant.change.verb.decideObstacles': 'Engeller hakkında karar ver',
'assistant.change.verb.restoreTrack': 'Kayıtlı izlemeye dön',
'assistant.change.verb.importTour': 'Dosyadan tur ekle',
'assistant.change.label.field': 'Değer',
'assistant.change.label.difficulty': 'En yüksek patika zorluğu',
'assistant.change.label.track': 'Kayıtlı iz',
'assistant.change.label.packing': 'Bavul listesi',
'assistant.change.label.breaks': 'Molalar',
'assistant.domain.tours': 'Turlar',
'assistant.domain.roadtrip': 'Yolculuk',
'assistant.domain.journey': 'Seyahat günlüğü',
+9
View File
@@ -462,11 +462,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Знову враховувати в статистиці',
'assistant.change.verb.linkPacking': 'Пов’язати список речей',
'assistant.change.verb.unlinkPacking': 'Відв’язати список речей',
'assistant.change.verb.reverseTour': 'Розвернути маршрут',
'assistant.change.verb.closeLoop': 'Замкнути петлю',
'assistant.change.verb.copyTour': 'Копіювати маршрут',
'assistant.change.verb.setRouteColor': 'Змінити колір маршруту',
'assistant.change.verb.classifySki': 'Змінити лижну дисципліну',
'assistant.change.verb.setPaddlePlan': 'Змінити план сплаву',
'assistant.change.verb.decideObstacles': 'Вирішити щодо перешкод',
'assistant.change.verb.restoreTrack': 'Повернути записаний трек',
'assistant.change.verb.importTour': 'Додати тур із файлу',
'assistant.change.label.field': 'Значення',
'assistant.change.label.difficulty': 'Максимальна складність стежки',
'assistant.change.label.track': 'Записаний трек',
'assistant.change.label.packing': 'Список речей',
'assistant.change.label.breaks': 'Перерви',
'assistant.domain.tours': 'Маршрути',
'assistant.domain.roadtrip': 'Автоподорож',
'assistant.domain.journey': 'Щоденник подорожей',
+9
View File
@@ -395,11 +395,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': 'Tính lại vào thống kê',
'assistant.change.verb.linkPacking': 'Liên kết danh sách đồ',
'assistant.change.verb.unlinkPacking': 'Bỏ liên kết danh sách đồ',
'assistant.change.verb.reverseTour': 'Đảo chiều chuyến đi',
'assistant.change.verb.closeLoop': 'Khép vòng',
'assistant.change.verb.copyTour': 'Sao chép chuyến đi',
'assistant.change.verb.setRouteColor': 'Đổi màu tuyến đường',
'assistant.change.verb.classifySki': 'Đổi môn trượt tuyết',
'assistant.change.verb.setPaddlePlan': 'Đổi kế hoạch chèo',
'assistant.change.verb.decideObstacles': 'Quyết định về chướng ngại vật',
'assistant.change.verb.restoreTrack': 'Quay lại đường đã ghi',
'assistant.change.verb.importTour': 'Thêm chuyến đi từ tệp',
'assistant.change.label.field': 'Giá trị',
'assistant.change.label.difficulty': 'Độ khó tối đa của đường mòn',
'assistant.change.label.track': 'Hành trình đã ghi',
'assistant.change.label.packing': 'Danh sách đồ',
'assistant.change.label.breaks': 'Nghỉ giải lao',
'assistant.domain.tours': 'Tuyến đi',
'assistant.domain.roadtrip': 'Đi đường bộ',
'assistant.domain.journey': 'Nhật ký du lịch',
+9
View File
@@ -387,11 +387,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': '重新計入統計',
'assistant.change.verb.linkPacking': '連結打包清單',
'assistant.change.verb.unlinkPacking': '取消連結打包清單',
'assistant.change.verb.reverseTour': '反轉路線',
'assistant.change.verb.closeLoop': '閉合環線',
'assistant.change.verb.copyTour': '複製路線',
'assistant.change.verb.setRouteColor': '變更路線顏色',
'assistant.change.verb.classifySki': '變更滑雪項目',
'assistant.change.verb.setPaddlePlan': '變更划槳計畫',
'assistant.change.verb.decideObstacles': '決定障礙物處理',
'assistant.change.verb.restoreTrack': '恢復為記錄的軌跡',
'assistant.change.verb.importTour': '從檔案新增路線',
'assistant.change.label.field': '值',
'assistant.change.label.difficulty': '步道最高難度',
'assistant.change.label.track': '記錄軌跡',
'assistant.change.label.packing': '打包清單',
'assistant.change.label.breaks': '休息',
'assistant.domain.tours': '路線',
'assistant.domain.roadtrip': '公路旅行',
'assistant.domain.journey': '旅行日誌',
+9
View File
@@ -387,11 +387,20 @@ const assistant: TranslationStrings = {
'assistant.change.verb.countTour': '重新计入统计',
'assistant.change.verb.linkPacking': '关联行李清单',
'assistant.change.verb.unlinkPacking': '取消关联行李清单',
'assistant.change.verb.reverseTour': '反转路线',
'assistant.change.verb.closeLoop': '闭合环线',
'assistant.change.verb.copyTour': '复制路线',
'assistant.change.verb.setRouteColor': '更改路线颜色',
'assistant.change.verb.classifySki': '更改滑雪项目',
'assistant.change.verb.setPaddlePlan': '更改划桨计划',
'assistant.change.verb.decideObstacles': '决定障碍物处理',
'assistant.change.verb.restoreTrack': '恢复为记录的轨迹',
'assistant.change.verb.importTour': '从文件添加路线',
'assistant.change.label.field': '值',
'assistant.change.label.difficulty': '步道最高难度',
'assistant.change.label.track': '记录轨迹',
'assistant.change.label.packing': '行李清单',
'assistant.change.label.breaks': '休息',
'assistant.domain.tours': '路线',
'assistant.domain.roadtrip': '自驾游',
'assistant.domain.journey': '旅行日记',
+1
View File
@@ -79,6 +79,7 @@ export * from './tours/tour-walk.schema';
export * from './tours/tour-walk';
export * from './tours/tour-walk-briefing.schema';
export * from './tours/tour-change.schema';
export * from './tours/tour-edit.schema';
export * from './tours/walk-hours';
export * from './tours/walk-remaining';
export * from './tours/walk-ferry';
+68 -3
View File
@@ -1,6 +1,13 @@
import { idSchema } from '../common/primitives.schema';
import { cityWalkStationSchema } from './tour-walk-briefing.schema';
import { stationKeySchema, tourRevisionSchema } from './tours.schema';
import {
MAX_STATION_STAY_MINUTES,
stationImportanceSchema,
stationKeySchema,
TOUR_STATION_HOURS_MAX,
TOUR_STATION_NAME_MAX,
tourRevisionSchema,
} from './tours.schema';
import { z } from 'zod';
@@ -11,14 +18,17 @@ import { z } from 'zod';
* and what could not be. Every change names the stations it touches by their
* keys, the same across saves, so it cannot drift onto another station. A
* spontaneous stop is a change like any other: an `add` after the station the
* traveller is at.
* traveller is at. An `edit` changes what a station says of itself (its name,
* stay, importance, protection, opening hours) and leaves it where it is; a
* `reverse` turns the whole walk round and a `close_loop` takes it back to its
* start, each the only change of its proposal besides edits.
*/
/** The most changes one proposal carries: enough to rework a walk, few enough to review at once. */
export const TOUR_CHANGE_MAX = 10;
/** The operations a proposal can hold; which of them a tour type takes is the server's rule. */
export const TOUR_CHANGE_OPS = ['add', 'remove', 'replace', 'move'] as const;
export const TOUR_CHANGE_OPS = ['add', 'remove', 'replace', 'move', 'edit', 'reverse', 'close_loop'] as const;
export type TourChangeOp = (typeof TOUR_CHANGE_OPS)[number];
const key = stationKeySchema.describe('The key of a station of the saved tour, as get_tour_plan gives it');
@@ -29,11 +39,66 @@ const station = cityWalkStationSchema.describe(
'The new station: its position, name, stay in minutes (0 passed through, null not known), importance, protected, opening hours as OpenStreetMap writes them, and the place of this trip it stands for',
);
/** The fields an `edit` changes, each left out where it stays as it is. */
export const TOUR_STATION_EDIT_FIELDS = ['name', 'stay_minutes', 'importance', 'protected', 'opening_hours'] as const;
/**
* An edit of one station: only the fields given change, null clears one (a
* name, a stay that is then not known, the importance back to normal, the
* opening hours). A stay of 0 is a point passed through, as in the planner.
*/
const stationEdit = z
.object({
op: z.literal('edit'),
key,
name: z
.string()
.trim()
.min(1)
.max(TOUR_STATION_NAME_MAX)
.nullable()
.optional()
.describe('The new name; null clears it'),
stay_minutes: z
.number()
.int()
.min(0)
.max(MAX_STATION_STAY_MINUTES)
.nullable()
.optional()
.describe('The stay in minutes, 0 for a point only passed through; null when it is not known'),
importance: stationImportanceSchema
.nullable()
.optional()
.describe('optional or must; null makes it a normal station again'),
protected: z
.boolean()
.optional()
.describe('true keeps the station where it is in every change proposed later; false lifts that'),
opening_hours: z
.string()
.trim()
.min(1)
.max(TOUR_STATION_HOURS_MAX)
.nullable()
.optional()
.describe('Opening hours as OpenStreetMap writes them, such as "Mo-Fr 09:00-18:00"; null clears them'),
})
.strict()
.refine((edit) => TOUR_STATION_EDIT_FIELDS.some((field) => edit[field] !== undefined), {
message: 'an edit changes at least one field of its station',
});
export const tourChangeSchema = z.discriminatedUnion('op', [
z.object({ op: z.literal('add'), station, after_key: afterKey }).strict(),
z.object({ op: z.literal('remove'), key }).strict(),
z.object({ op: z.literal('replace'), key, station }).strict(),
z.object({ op: z.literal('move'), key, after_key: afterKey }).strict(),
stationEdit,
// The walk the other way round: its last station starts it; a loop stays a loop from the same start.
z.object({ op: z.literal('reverse') }).strict(),
// The walk back to its start: a way back from its last station is added.
z.object({ op: z.literal('close_loop') }).strict(),
]);
export type TourChange = z.infer<typeof tourChangeSchema>;
+105
View File
@@ -0,0 +1,105 @@
import { tourChangeRequestSchema } from './tour-change.schema';
import {
horseRoutesToolRequestSchema,
obstacleDecisionsToolRequestSchema,
skiClassifyToolRequestSchema,
tourCopyToolRequestSchema,
tourDetailsUpdateRequestSchema,
tourRefToolRequestSchema,
tourRouteColorRequestSchema,
} from './tour-edit.schema';
import { tourUpdateRequestSchema } from './tour-hike.schema';
import { describe, expect, it } from 'vitest';
describe('the words and times of a saved tour (P8)', () => {
it('takes any of its fields with the revision, null clearing one', () => {
const body = {
placeId: 4,
expected_revision: 2,
website: 'https://example.org/tour',
break_additional_minutes: 45,
planned_duration_minutes: null,
description: null,
};
expect(tourDetailsUpdateRequestSchema.parse(body)).toEqual(body);
});
it('refuses a change of nothing, a plain http page, breaks past a day and a field it does not take', () => {
const refused = [
{ placeId: 4, expected_revision: 2 },
{ placeId: 4, expected_revision: 2, website: 'http://example.org' },
{ placeId: 4, expected_revision: 2, break_additional_minutes: 1441 },
{ placeId: 4, expected_revision: 2, name: 'Ridge', route_color: '#fff' },
{ placeId: 4, name: 'Ridge' },
];
for (const body of refused) {
expect(tourDetailsUpdateRequestSchema.safeParse(body).success, JSON.stringify(body)).toBe(false);
}
});
it('takes a route colour as hex or null, and a copy by its name', () => {
expect(tourRouteColorRequestSchema.parse({ placeId: 1, route_color: '#e11d48' }).route_color).toBe('#e11d48');
expect(tourRouteColorRequestSchema.parse({ placeId: 1, route_color: null }).route_color).toBeNull();
expect(tourRouteColorRequestSchema.safeParse({ placeId: 1, route_color: 'red' }).success).toBe(false);
expect(tourCopyToolRequestSchema.parse({ placeId: 1, name: ' Short way ' }).name).toBe('Short way');
expect(tourCopyToolRequestSchema.safeParse({ placeId: 1, name: '' }).success).toBe(false);
});
});
describe('the writes of a ski or paddle tour and the reads beside them (P9)', () => {
it('takes a ski classification, a decision about an obstacle, a tour and a map view', () => {
expect(
skiClassifyToolRequestSchema.parse({ placeId: 3, ski_discipline: 'cross_country', ski_technique: 'classic' }),
).toMatchObject({ ski_technique: 'classic' });
expect(skiClassifyToolRequestSchema.safeParse({ placeId: 3, ski_discipline: 'sledge' }).success).toBe(false);
const op = { key: 'node/12', op: 'note', decision: null, note: 'portage on the left', basis: null };
expect(obstacleDecisionsToolRequestSchema.parse({ placeId: 3, ops: [op] }).ops).toEqual([op]);
expect(obstacleDecisionsToolRequestSchema.safeParse({ placeId: 3, ops: [] }).success).toBe(false);
expect(tourRefToolRequestSchema.safeParse({ placeId: 3, extra: true }).success).toBe(false);
expect(horseRoutesToolRequestSchema.parse({ bbox: '47.5,11.2,47.7,11.5' }).bbox).toBe('47.5,11.2,47.7,11.5');
});
});
describe('the new changes of a saved city walk and a hike (P8)', () => {
it('takes an edit of at least one field, a reverse and a close_loop', () => {
const changes = [
{ op: 'edit', key: 'stop-museum', stay_minutes: 0, importance: null, protected: false },
{ op: 'reverse' },
{ op: 'close_loop' },
];
expect(tourChangeRequestSchema.parse({ changes })).toEqual({ changes });
});
it('refuses an edit of nothing, of a field no station has, or a reverse naming a station', () => {
const refused = [
[{ op: 'edit', key: 'stop-museum' }],
[{ op: 'edit', key: 'stop-museum', lat: 48 }],
[{ op: 'edit', key: 'stop-museum', stay_minutes: -1 }],
[{ op: 'edit', key: 'stop-museum', name: '' }],
[{ op: 'reverse', key: 'stop-museum' }],
];
for (const changes of refused) {
expect(tourChangeRequestSchema.safeParse({ changes }).success, JSON.stringify(changes)).toBe(false);
}
});
it('takes a hike reshaped without new points, never with them', () => {
expect(tourUpdateRequestSchema.parse({ placeId: 2, expected_revision: 1, reshape: 'reverse' }).reshape).toBe(
'reverse',
);
const both = {
placeId: 2,
expected_revision: 1,
reshape: 'close_loop',
waypoints: [
{ lat: 47, lng: 11 },
{ lat: 47.1, lng: 11 },
],
};
expect(tourUpdateRequestSchema.safeParse(both).success).toBe(false);
expect(tourUpdateRequestSchema.safeParse({ placeId: 2, expected_revision: 1, reshape: 'flip' }).success).toBe(
false,
);
});
});
+129
View File
@@ -0,0 +1,129 @@
import { idSchema } from '../common/primitives.schema';
import { hexColorSchema } from '../place/place.schema';
import { obstacleReviewOpSchema } from './paddle-check.schema';
import { skiDisciplineSchema, skiTechniqueSchema } from './ski.schema';
import {
plannedTourDurationMinutesSchema,
tourDescriptionSchema,
tourNameSchema,
tourRevisionSchema,
tourWebsiteSchema,
} from './tours.schema';
import { z } from 'zod';
/**
* The edits of a saved tour an assistant makes besides its route, for every
* type, with the rules the planner's save and the tour detail hold them to:
* the words and times of a tour, the colour its line is drawn in, a copy, and
* the writes a ski or paddle tour has of its own. Each names the tour by its
* place id; a write that changes the tour names the revision it was read at.
*/
const placeId = idSchema.describe('The place id of the tour, as list_tours gives it');
const expectedRevision = tourRevisionSchema.describe(
'The revision of the tour as last read (get_tour_plan or list_tours); a tour changed since is refused, not overwritten',
);
/** The fields update_tour_details changes, each left out where it stays as it is. */
export const TOUR_DETAIL_FIELDS = [
'name',
'description',
'website',
'break_additional_minutes',
'planned_duration_minutes',
] as const;
/**
* P8: a tour's words and planned times, for any type and a recorded track
* too, without touching its route, its points or its days. Null clears a
* field; the breaks are minutes on top of the moving time, the planned
* duration a total the travellers set themselves, breaks included.
*/
export const tourDetailsUpdateRequestSchema = z
.object({
placeId,
expected_revision: expectedRevision,
name: tourNameSchema.optional().describe('A new name for the tour'),
description: tourDescriptionSchema.describe('A new description; null clears it'),
website: tourWebsiteSchema.nullable().optional().describe('The web page of the tour, an https URL; null clears it'),
break_additional_minutes: plannedTourDurationMinutesSchema
.optional()
.describe('Minutes of breaks on top of the moving time, 0 to 1440; null clears them'),
planned_duration_minutes: plannedTourDurationMinutesSchema
.optional()
.describe('How long the travellers plan to be out in all, breaks included, in minutes; null clears it'),
})
.strict()
.refine((value) => TOUR_DETAIL_FIELDS.some((field) => value[field] !== undefined), {
message: 'give at least one field to change',
});
export type TourDetailsUpdateRequest = z.infer<typeof tourDetailsUpdateRequestSchema>;
/** P8: the colour a tour's line is drawn in on the map, as the tour detail sets it; null takes the type's colour. */
export const tourRouteColorRequestSchema = z
.object({
placeId,
route_color: hexColorSchema
.nullable()
.describe('A hex colour such as "#e11d48"; null draws the line in the colour of its tour type again'),
})
.strict();
export type TourRouteColorRequest = z.infer<typeof tourRouteColorRequestSchema>;
/** P2C-07 over MCP: the tour saved again as a new tour of the same trip, under its own name, without its days. */
export const tourCopyToolRequestSchema = z
.object({
placeId,
name: tourNameSchema.describe('The name of the copy, such as "Ridge walk (short)"'),
})
.strict();
export type TourCopyToolRequest = z.infer<typeof tourCopyToolRequestSchema>;
/** SKI-02 over MCP: a ski track classified again, its discipline and for cross-country its technique. */
export const skiClassifyToolRequestSchema = z
.object({
placeId,
ski_discipline: skiDisciplineSchema.describe(
'alpine, snowboard, cross_country, touring (ski touring), snowshoe or winter_hike',
),
ski_technique: skiTechniqueSchema
.nullable()
.optional()
.describe('For cross_country only: classic, skating, or unknown when the travellers do not know'),
expected_revision: expectedRevision.optional(),
})
.strict();
export type SkiClassifyToolRequest = z.infer<typeof skiClassifyToolRequestSchema>;
/** PAD-06 over MCP: decisions about the obstacles of a paddle tour, at most one change per obstacle. */
export const obstacleDecisionsToolRequestSchema = z
.object({
placeId,
ops: z
.array(obstacleReviewOpSchema)
.min(1)
.max(100)
.describe(
"Each change to the checklist: key and basis copied from the entry of get_tour_plan's obstacle_check, op decide (with decision pass, portage, reroute or not_affected, and the entry's basis), note (the note only), clear (the decision taken back) or keep (a decision about an object the data no longer holds)",
),
})
.strict();
export type ObstacleDecisionsToolRequest = z.infer<typeof obstacleDecisionsToolRequestSchema>;
/** A read about one saved tour: get_tour_trail_details, restore_recorded_track. */
export const tourRefToolRequestSchema = z.object({ placeId }).strict();
export type TourRefToolRequest = z.infer<typeof tourRefToolRequestSchema>;
/** HOR-01 over MCP: the map view to find the signposted horse routes in. */
export const horseRoutesToolRequestSchema = z
.object({
bbox: z
.string()
.max(200)
.describe(
'The map view as "south,west,north,east" in degrees, such as "47.5,11.2,47.7,11.5"; at most about half a degree on each side',
),
})
.strict();
export type HorseRoutesToolRequest = z.infer<typeof horseRoutesToolRequestSchema>;
+20 -1
View File
@@ -291,6 +291,20 @@ export const hikeCreateRequestSchema = z
.superRefine(refineStages);
export type HikeCreateRequest = z.infer<typeof hikeCreateRequestSchema>;
/**
* PR1-01 and PR1-02 for a saved hike: its points the other way round
* (`reverse`, the last point starts it) or taken back to its start
* (`close_loop`, a way back from its last point), as the planner's route
* tools do. The way is planned anew through the points as they then stand.
*/
export const TOUR_RESHAPES = ['reverse', 'close_loop'] as const;
export const tourReshapeSchema = z
.enum(TOUR_RESHAPES)
.describe(
'reverse turns the saved hike round, its last point starting it; close_loop adds the way back from its last point to its start. Give it without waypoints',
);
export type TourReshape = z.infer<typeof tourReshapeSchema>;
export const tourUpdateRequestSchema = z
.object({
placeId: idSchema.describe('The place id of the hike, as list_tours gives it'),
@@ -307,9 +321,14 @@ export const tourUpdateRequestSchema = z
max_hiking_difficulty: hikeLimitSchema.optional(),
hiking_preferences: hikePreferencesSchema.optional(),
planned_duration_minutes: plannedMinutesSchema.optional(),
reshape: tourReshapeSchema.optional(),
})
.strict()
.superRefine(refineStages);
.superRefine(refineStages)
.refine((value) => value.reshape === undefined || value.waypoints === undefined, {
path: ['reshape'],
message: 'reshape turns the saved points; give it without waypoints',
});
export type TourUpdateRequest = z.infer<typeof tourUpdateRequestSchema>;
/**