Files
TREK/shared/src/assistant/cards/trip-chat.card.ts
T
Maurice 5d334d7ec8 feat(assistant): the assistant opens outside a trip, as a home chat about all trips
A third scope, home, next to trip and journey: threads that name neither a
trip nor a journey (the CHECK now only forbids both), reached under
/api/assistant by their owner only. A home turn reads the user's trips
through list_trips into a short card (under way, next, later, behind,
undated), offers every read (a trip's on the id the model names, checked by
the tool with the user's rights) and only the writes that take no trip or
journey (atlas, vacation planner, collections, tour library, settings), all
held as change cards. open_trip_chat answers with a card that goes on in
that trip's own chat with the question waiting in its composer.

On the desktop the window opens on the home chat outside a trip; its head
lists the trips to switch into and a switched trip chat has the way back.
On the phone the home chat opens full screen from the dashboard head and the
dock's More list, and the card opens the trip with its chat. Both run on
useAssistantHome.
2026-10-23 22:00:06 +02:00

31 lines
1.2 KiB
TypeScript

import { idSchema } from '../../common/primitives.schema';
import { cardCountSchema, cardDateSchema, cardText } from './card-parts';
import { z } from 'zod';
/**
* A trip the chat outside any one trip offers to go on with in that trip's own
* chat: the conversation there knows the trip's days and places and can change
* them, which the chat on the dashboard does not. The question is what the
* user asked about the trip, handed over so it waits there ready to send.
*/
/** Where the trip stands today: under way, the next one to start, later, behind, or without dates. */
export const TRIP_CHAT_PHASES = ['now', 'next', 'upcoming', 'past', 'undated'] as const;
export type TripChatPhase = (typeof TRIP_CHAT_PHASES)[number];
export const tripChatCardSchema = z.object({
kind: z.literal('tripChat'),
trip: z.object({
id: idSchema,
title: cardText(200),
startDate: cardDateSchema.nullable(),
endDate: cardDateSchema.nullable(),
phase: z.enum(TRIP_CHAT_PHASES),
placeCount: cardCountSchema.nullable(),
}),
/** The question to ask in the trip's chat, in the user's words; null when there is none to hand over. */
question: cardText(500).nullable(),
});
export type TripChatCard = z.infer<typeof tripChatCardSchema>;